Add more information on stock move form

issue11768
review439591003
This commit is contained in:
Cédric Krier
2022-10-09 19:07:16 +02:00
parent 8ef21ecf7e
commit 17b3d539db
3 changed files with 29 additions and 7 deletions
+13 -7
View File
@@ -65,7 +65,7 @@ def set_origin_consignment(func):
to_save = []
move2line = {}
for move in moves:
if all(l.origin != move for l in move.invoice_lines):
if not move.consignment_invoice_lines:
lines = move.get_invoice_lines_consignment()
if lines:
to_save.extend(lines)
@@ -90,12 +90,11 @@ def unset_origin_consignment(func):
InvoiceLine = pool.get('account.invoice.line')
lines, to_save = [], []
for move in moves:
for invoice_line in move.invoice_lines:
if invoice_line.origin == move:
lines.append(invoice_line)
if move.origin == move:
move.origin = None
to_save.append(move)
for invoice_line in move.consignment_invoice_lines:
lines.append(invoice_line)
if move.origin == move:
move.origin = None
to_save.append(move)
if lines:
InvoiceLine.delete(lines)
cls.save(to_save)
@@ -106,6 +105,13 @@ def unset_origin_consignment(func):
class Move(metaclass=PoolMeta):
__name__ = 'stock.move'
consignment_invoice_lines = fields.One2Many(
'account.invoice.line', 'origin', "Consignment Invoice Lines",
readonly=True,
states={
'invisible': ~Eval('consignment_invoice_lines'),
})
@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)
+6
View File
@@ -8,5 +8,11 @@ this repository contains the full copyright notices and license terms. -->
<field name="inherit" ref="stock.location_view_form"/>
<field name="name">location_form</field>
</record>
<record model="ir.ui.view" id="stock_move_view_form">
<field name="model">stock.move</field>
<field name="inherit" ref="stock.move_view_form"/>
<field name="name">stock_move_form</field>
</record>
</data>
</tryton>
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="//notebook" position="inside">
<page name="consignment_invoice_lines">
<field name="consignment_invoice_lines" colspan="4"/>
</page>
</xpath>
</data>