changeset 9f9087425634 in modules/stock_consignment:default
details:
https://hg.tryton.org/modules/stock_consignment?cmd=changeset&node=9f9087425634
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
diffstat:
stock.py | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diffs (31 lines):
diff -r 9cbd16b1106c -r 9f9087425634 stock.py
--- a/stock.py Thu Sep 29 09:08:06 2022 +0200
+++ b/stock.py Sun Oct 09 13:22:59 2022 +0200
@@ -65,7 +65,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)
@@ -93,7 +93,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:
@@ -106,9 +106,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)