diff options
| author | Josse Colpaert <jco@odoo.com> | 2014-06-11 14:05:13 +0200 |
|---|---|---|
| committer | Josse Colpaert <jco@odoo.com> | 2014-06-11 14:05:13 +0200 |
| commit | f30cf0cf1bfa0ffd45a82f568edc33f9d8fb12b9 (patch) | |
| tree | 5ac83aca7dba8560e29ee250e7768147e75bc125 /addons/procurement/procurement.py | |
| parent | c1cab324028392547f6d21ed240cc1107916c2bc (diff) | |
[IMP] Run schedulers and minimum stock rules done by company + purchase order should change date when adding (to) lines
Diffstat (limited to 'addons/procurement/procurement.py')
| -rw-r--r-- | addons/procurement/procurement.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py index 787178723ab..e45651a30a2 100644 --- a/addons/procurement/procurement.py +++ b/addons/procurement/procurement.py @@ -267,7 +267,7 @@ class procurement_order(osv.osv): # # Scheduler # - def run_scheduler(self, cr, uid, use_new_cursor=False, context=None): + def run_scheduler(self, cr, uid, use_new_cursor=False, company_id = False, context=None): ''' Call the scheduler to check the procurement order. This is intented to be done for all existing companies at the same time, so we're running all the methods as SUPERUSER to avoid intercompany and access rights issues. @@ -288,8 +288,11 @@ class procurement_order(osv.osv): cr = openerp.registry(cr.dbname).cursor() # Run confirmed procurements + dom = [('state', '=', 'confirmed')] + if company_id: + dom += [('company_id', '=', company_id)] while True: - ids = self.search(cr, SUPERUSER_ID, [('state', '=', 'confirmed')], context=context) + ids = self.search(cr, SUPERUSER_ID, dom, context=context) if not ids: break self.run(cr, SUPERUSER_ID, ids, context=context) @@ -298,8 +301,11 @@ class procurement_order(osv.osv): # Check if running procurements are done offset = 0 + dom = [('state', '=', 'running')] + if company_id: + dom += [('company_id', '=', company_id)] while True: - ids = self.search(cr, SUPERUSER_ID, [('state', '=', 'running')], offset=offset, context=context) + ids = self.search(cr, SUPERUSER_ID, dom, offset=offset, context=context) if not ids: break done = self.check(cr, SUPERUSER_ID, ids, context=context) |
