Add warning message for late production
issue4375 review9911002
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
* Add warning for late production when creating production request.
|
||||
|
||||
Version 3.4.0 - 2014-10-20
|
||||
* Bug fixes (see mercurial logs for details)
|
||||
* Allow to calculate production requests filtered by warehouse
|
||||
|
||||
@@ -212,13 +212,33 @@ class CreateProductionRequest(Wizard):
|
||||
])
|
||||
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, {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user