trytond-patches/issue9911002_80001.diff

81 lines
2.8 KiB
Diff

# HG changeset patch
# User Guillem Barba <guillembarba@gmail.com>
Add warning message for late production
issue4375
review9911002
Index: modules/stock_supply_production/production.py
===================================================================
--- .a/trytond/trytond/modules/stock_supply_production/production.py
+++ .b/trytond/trytond/modules/stock_supply_production/production.py
@@ -212,13 +212,33 @@
])
create_ = StateAction('stock_supply_production.act_production_request')
+ @classmethod
+ def __setup__(cls):
+ super(CreateProductionRequest, cls).__setup__()
+ cls._error_messages.update({
+ 'late_productions': 'There are some late productions.',
+ })
+
@property
def _requests_parameters(self):
return {}
def do_create_(self, action):
pool = Pool()
+ Date = pool.get('ir.date')
+ Move = pool.get('stock.move')
Production = pool.get('production')
+
+ today = Date.today()
+ if Move.search([
+ ('from_location.type', '=', 'production'),
+ ('to_location.type', '=', 'storage'),
+ ('state', '=', 'draft'),
+ ('planned_date', '<', today),
+ ], order=[]):
+ self.raise_user_warning('%s@%s' % (self.__name__, today),
+ 'late_productions')
+
Production.generate_requests(**self._requests_parameters)
return action, {}
Index: modules/stock_supply_production/locale/ca_ES.po
===================================================================
--- a/trytond/trytond/modules/stock_supply_production/locale/ca_ES.po Tue Feb 17 21:08:47 2015 +0100
+++ b/trytond/trytond/modules/stock_supply_production/locale/ca_ES.po Wed Mar 04 11:16:09 2015 +0100
@@ -2,6 +2,10 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
+msgctxt "error:production.create_request:"
+msgid "There are some late productions."
+msgstr "Hi ha algunes produccions endarrerides."
+
msgctxt "field:production.configuration,supply_period:"
msgid "Supply Period"
msgstr "Període de subministre"
Index: modules/stock_supply_production/locale/es_ES.po
===================================================================
--- a/trytond/trytond/modules/stock_supply_production/locale/es_ES.po Tue Feb 17 21:08:47 2015 +0100
+++ b/trytond/trytond/modules/stock_supply_production/locale/es_ES.po Wed Mar 04 11:16:09 2015 +0100
@@ -2,6 +2,10 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
+msgctxt "error:production.create_request:"
+msgid "There are some late productions."
+msgstr "Hay algunas producciones retrasadas."
+
msgctxt "field:production.configuration,supply_period:"
msgid "Supply Period"
msgstr "Período de suministro"