Set inventory lines readonly until inventory date and location are filled

Date and location fields are required
but become readonly when you start filling
lines manually even if those fields are not filled.
When you save your inventory, you have to delete all
your lines to fill those mandatory fields...

issue6978
review36861002
This commit is contained in:
Maxime Richez committed 2017-12-10 12:44:40 +01:00
1 parent 4a4005cace
commit 2c58dd113b
1 file changed
+6 -2
+6 -2
View File
@@ -40,8 +40,12 @@ class Inventory(Workflow, ModelSQL, ModelView):
'stock.location', 'Lost and Found', required=True,
domain=[('type', '=', 'lost_found')], states=STATES, depends=DEPENDS)
lines = fields.One2Many(
'stock.inventory.line', 'inventory', 'Lines', states=STATES,
depends=DEPENDS)
'stock.inventory.line', 'inventory', 'Lines',
states={
'readonly': (STATES['readonly'] | ~Eval('location')
| ~Eval('date')),
},
depends=['location', 'date'] + DEPENDS)
company = fields.Many2One('company.company', 'Company', required=True,
states={
'readonly': (Eval('state') != 'draft') | Eval('lines', [0]),