Added in production field to extend window domain record.

>
> This commit refs #24553
This commit is contained in:
Sergio Morillo 2022-10-19 10:42:08 +02:00
parent f3df670eb0
commit 09ff6d0827
3 changed files with 18 additions and 1 deletions

View File

@ -186,6 +186,10 @@ msgctxt "field:stock.unit_load,dropped:"
msgid "Dropped"
msgstr "Volcado"
msgctxt "field:stock.unit_load,in_production:"
msgid "In production"
msgstr "En producción"
msgctxt "field:stock.unit_load,rec_name:"
msgid "Record Name"
msgstr "Nombre del registro"

View File

@ -231,6 +231,9 @@ class UnitLoad(ModelSQL, ModelView):
at_warehouse = fields.Function(
fields.Many2One('stock.location', 'Warehouse at date'),
'get_at_warehouse')
in_production = fields.Function(
fields.Boolean('In production'),
'get_in_production', searcher='search_in_production')
@classmethod
def __setup__(cls):
@ -1764,6 +1767,16 @@ class UnitLoad(ModelSQL, ModelView):
"""Cases digits to use on reports"""
return cases_digits[1]
def get_in_production(self, name=None):
return self.production_state == 'running'
@classmethod
def search_in_production(cls, name, clause):
assert clause[1] == '=' and clause[2]
return [
('production_state', '=', 'running')
]
class UnitLoadMove(ModelSQL, ModelView):
"""Unit load movement"""

View File

@ -49,7 +49,7 @@
<record model="ir.action.act_window.domain" id="act_unit_load_domain_in_production">
<field name="name">In production</field>
<field name="sequence" eval="1"/>
<field name="domain" eval="[('production_state', '=', 'running')]" pyson="1"/>
<field name="domain" eval="[('in_production', '=', True)]" pyson="1"/>
<field name="act_window" ref="act_unit_load"/>
</record>
<record model="ir.action.act_window.domain" id="act_unit_load_domain_pending">