From 09ff6d0827fd1fed8eecb054a8655d5829bd67a4 Mon Sep 17 00:00:00 2001 From: Sergio Morillo Date: Wed, 19 Oct 2022 10:42:08 +0200 Subject: [PATCH] Added in production field to extend window domain record. > > This commit refs #24553 --- locale/es.po | 4 ++++ unit_load.py | 13 +++++++++++++ unit_load.xml | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/locale/es.po b/locale/es.po index 1ec7889..f88ed07 100644 --- a/locale/es.po +++ b/locale/es.po @@ -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" diff --git a/unit_load.py b/unit_load.py index 9376543..7482c33 100644 --- a/unit_load.py +++ b/unit_load.py @@ -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""" diff --git a/unit_load.xml b/unit_load.xml index c6162b9..46c3455 100644 --- a/unit_load.xml +++ b/unit_load.xml @@ -49,7 +49,7 @@ In production - +