Skip to content

Commit

Permalink
[IMP] keep to_invoice value of existing orders
Browse files Browse the repository at this point in the history
  • Loading branch information
huguesdk committed Nov 1, 2024
1 parent 0a50268 commit 240a518
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pos_auto_invoice/static/src/js/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,19 @@ odoo.define("pos_auto_invoice.models", function (require) {

const AutoInvoiceOrder = (OriginalOrder) =>
class extends OriginalOrder {
constructor() {
constructor(obj, options) {
super(...arguments);
if (this.pos.config.invoice_by_default) {
if (!options.json && this.pos.config.invoice_by_default) {
this.to_invoice = true;
}
}

init_from_JSON(json) {
super.init_from_JSON(...arguments);
// This should be done in the original method, but curiously
// it is not (to_invoice is always set to false).
this.to_invoice = json.to_invoice;
}
};

Registries.Model.extend(Order, AutoInvoiceOrder);
Expand Down

0 comments on commit 240a518

Please sign in to comment.