Create invoice line based on line origin instead of move origin
Since issue8253, the inventory move has an origin set to the outgoing/incoming move, so we can not rely on it to decide to create invoice lines or not. issue8566 review270101002
This commit is contained in:
1 parent
98e7337f5d
commit
d1f511c381
2 files changed
+11
-8
No files matched your search
@@ -51,11 +51,12 @@ def set_origin_consignment(func):
|
||||
to_save = []
|
||||
move2line = {}
|
||||
for move in moves:
|
||||
if not move.origin:
|
||||
if not move.invoice_lines:
|
||||
lines = move.get_invoice_lines_consignment()
|
||||
if lines:
|
||||
to_save.extend(lines)
|
||||
move2line[move] = lines[0]
|
||||
if not move.origin:
|
||||
move2line[move] = lines[0]
|
||||
if to_save:
|
||||
InvoiceLine.save(to_save)
|
||||
for move, line in move2line.items():
|
||||
@@ -76,10 +77,12 @@ def unset_origin_consignment(func):
|
||||
InvoiceLine = pool.get('account.invoice.line')
|
||||
lines, to_save = [], []
|
||||
for move in moves:
|
||||
if isinstance(move.origin, InvoiceLine):
|
||||
lines.extend(move.invoice_lines)
|
||||
move.origin = None
|
||||
to_save.append(move)
|
||||
for invoice_line in move.invoice_lines:
|
||||
if invoice_line.origin == move:
|
||||
lines.append(invoice_line)
|
||||
if isinstance(move.origin, InvoiceLine):
|
||||
move.origin = None
|
||||
to_save.append(move)
|
||||
if lines:
|
||||
InvoiceLine.delete(lines)
|
||||
cls.save(to_save)
|
||||
|
||||
@@ -185,8 +185,8 @@ Use supplier consignment stock for shipment out::
|
||||
>>> shipment_out.click('assign_try')
|
||||
True
|
||||
>>> move, = shipment_out.inventory_moves
|
||||
>>> isinstance(move.origin, InvoiceLine)
|
||||
True
|
||||
>>> len(move.invoice_lines)
|
||||
1
|
||||
|
||||
Fill customer consignment location::
|
||||
|
||||
|
||||
Reference in new issue
Block a user