Skip to content
Permalink
Browse files

[FIX] point_of_sale: create invoice when offline

When a pos order is created and should be invoiced, the argument
to_invoiced is sent when the order is finalized. But if you were offline
during this sale, when you are back online, the 'to_invoice' is lost,
because the value stored on the order is not sent to the server.

So we are now sending the value from the order.

closes #39936

X-original-commit: c3e7781
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
  • Loading branch information...
pimodoo authored and fw-bot committed Nov 6, 2019
1 parent c8d3615 commit 3fda9885169b7b8b0cd5aae3825c1405decc2e43
Showing with 3 additions and 2 deletions.
  1. +1 −1 addons/point_of_sale/models/pos_order.py
  2. +2 −1 addons/point_of_sale/static/src/js/models.js
@@ -723,7 +723,7 @@ def create_from_ui(self, orders):
order_ids = []

for tmp_order in orders_to_save:
to_invoice = tmp_order['to_invoice']
to_invoice = tmp_order['to_invoice'] or tmp_order['data'].get('to_invoice')
order = tmp_order['data']
if to_invoice:
self._match_payment_to_invoice(order)
@@ -2103,7 +2103,8 @@ exports.Order = Backbone.Model.extend({
uid: this.uid,
sequence_number: this.sequence_number,
creation_date: this.validation_date || this.creation_date, // todo: rename creation_date in master
fiscal_position_id: this.fiscal_position ? this.fiscal_position.id : false
fiscal_position_id: this.fiscal_position ? this.fiscal_position.id : false,
to_invoice: this.to_invoice ? this.to_invoice : false,
};
},
export_for_printing: function(){

0 comments on commit 3fda988

Please sign in to comment.
You can’t perform that action at this time.