changeset 1029186f1f21 in modules/stock_consignment:6.0
details: 
https://hg.tryton.org/modules/stock_consignment?cmd=changeset&node=1029186f1f21
description:
        Remove conflicted definition of invoice_lines field on stock move

        invoice_lines is already defined by account_invoice_stock but as a 
Many2Many
        but as consignment invoice lines are filled also the stock_moves, they 
appears
        also on the Many2Many. So we can use the invoice_lines from 
account_invoice if
        we check the origin.

        issue11766
        review421831003
        (grafted from 9f9087425634448e894a11ee139705be3de8ce51)
diffstat:

 stock.py |  7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diffs (31 lines):

diff -r 662ec5d8e66f -r 1029186f1f21 stock.py
--- a/stock.py  Wed Aug 03 23:26:23 2022 +0200
+++ b/stock.py  Sun Oct 09 13:22:59 2022 +0200
@@ -67,7 +67,7 @@
         to_save = []
         move2line = {}
         for move in moves:
-            if not move.invoice_lines:
+            if all(l.origin != move for l in move.invoice_lines):
                 lines = move.get_invoice_lines_consignment()
                 if lines:
                     to_save.extend(lines)
@@ -95,7 +95,7 @@
             for invoice_line in move.invoice_lines:
                 if invoice_line.origin == move:
                     lines.append(invoice_line)
-                    if isinstance(move.origin, InvoiceLine):
+                    if move.origin == move:
                         move.origin = None
                     to_save.append(move)
         if lines:
@@ -108,9 +108,6 @@
 class Move(metaclass=PoolMeta):
     __name__ = 'stock.move'
 
-    invoice_lines = fields.One2Many(
-        'account.invoice.line', 'origin', "Invoice Lines", readonly=True)
-
     @fields.depends('state', 'from_location', 'to_location')
     def on_change_with_unit_price_required(self, name=None):
         required = super().on_change_with_unit_price_required(name)

Reply via email to