Add secondary unit to sale amendment

Closes #13256
This commit is contained in:
Cédric Krier
2024-05-21 18:56:03 +02:00
parent 6ffe8bcea0
commit bbd5e521f3
7 changed files with 73 additions and 7 deletions
+10 -5
View File
@@ -304,11 +304,6 @@ class AmendmentLine(ModelSQL, ModelView):
})
unit = fields.Many2One(
'product.uom', "Unit", ondelete='RESTRICT',
domain=[
If(Eval('product_uom_category'),
('category', '=', Eval('product_uom_category')),
()),
],
states={
'readonly': Eval('state') != 'draft',
'invisible': Eval('action') != 'line',
@@ -336,6 +331,16 @@ class AmendmentLine(ModelSQL, ModelView):
def __setup__(cls):
super().__setup__()
cls.__access__.add('amendment')
unit_categories = cls._unit_categories()
cls.unit.domain = [
If(Bool(Eval('product_uom_category')),
('category', 'in', [Eval(c) for c in unit_categories]),
('category', '!=', -1)),
]
@classmethod
def _unit_categories(cls):
return ['product_uom_category']
@fields.depends(
'amendment',