summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorPierre Masereel <pim@odoo.com>2021-04-27 12:42:50 +0000
committerPierre Masereel <pim@odoo.com>2021-04-27 12:42:50 +0000
commit02ee7a505fa8cdc57ea26cb0bccd7b3f5792f30c (patch)
treeab4cb1e15ed7d9d64d336e99a63b6def13335c69 /addons
parent02c3ecdefbe19c6a645c4a3ebd846e1c7126ca0f (diff)
[FIX] pos_sale: display lot on invoices from POS
When a product is sold from POS, the lot is not present in the invoice. As in 14.0, this feature is only in sale, we need to have POS and sale to make it work.
Diffstat (limited to 'addons')
-rw-r--r--addons/pos_sale/models/__init__.py1
-rw-r--r--addons/pos_sale/models/account_move.py28
2 files changed, 29 insertions, 0 deletions
diff --git a/addons/pos_sale/models/__init__.py b/addons/pos_sale/models/__init__.py
index a1233390863..a819ee04965 100644
--- a/addons/pos_sale/models/__init__.py
+++ b/addons/pos_sale/models/__init__.py
@@ -5,3 +5,4 @@ from . import pos_config
from . import pos_order
from . import crm_team
from . import pos_session
+from . import account_move
diff --git a/addons/pos_sale/models/account_move.py b/addons/pos_sale/models/account_move.py
new file mode 100644
index 00000000000..2ab94c2c34e
--- /dev/null
+++ b/addons/pos_sale/models/account_move.py
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+from odoo import fields, models, api
+
+class AccountMove(models.Model):
+ _inherit = 'account.move'
+
+ def _get_invoiced_lot_values(self):
+ self.ensure_one()
+
+ lot_values = super(AccountMove, self)._get_invoiced_lot_values()
+
+ if self.state == 'draft':
+ return lot_values
+
+ for order in self.pos_order_ids:
+ for line in order.lines:
+ lots = line.pack_lot_ids or False
+ if lots:
+ for lot in lots:
+ lot_values.append({
+ 'product_name': lot.product_id.name,
+ 'quantity': line.qty if lot.product_id.tracking == 'lot' else 1.0,
+ 'uom_name': line.product_uom_id.name,
+ 'lot_name': lot.lot_name,
+ })
+
+ return lot_values