diff options
| author | Raphael Collet <rco@openerp.com> | 2014-07-06 16:44:26 +0200 |
|---|---|---|
| committer | Antony Lesuisse <al@openerp.com> | 2014-07-06 17:05:41 +0200 |
| commit | cbe2dbb672a6c55d86f2e515f9d1cdfee426ef80 (patch) | |
| tree | d6ff62b719fce32392397783c961b734b1e4c50e /addons/procurement | |
| parent | d78192c489d3be66cd6487b39f5ce7ba4733a187 (diff) | |
[MERGE] new v8 api by rco
A squashed merge is required as the conversion of the apiculture branch from
bzr to git was not correctly done. The git history contains irrelevant blobs
and commits. This branch brings a lot of changes and fixes, too many to list
exhaustively.
- New orm api, objects are now used instead of ids
- Environements to encapsulates cr uid context while maintaining backward compatibility
- Field compute attribute is a new object oriented way to define function fields
- Shared browse record cache
- New onchange protocol
- Optional copy flag on fields
- Documentation update
- Dead code cleanup
- Lots of fixes
Diffstat (limited to 'addons/procurement')
| -rw-r--r-- | addons/procurement/procurement.py | 2 | ||||
| -rw-r--r-- | addons/procurement/wizard/schedulers_all.py | 24 |
2 files changed, 14 insertions, 12 deletions
diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py index 1fc25171e7f..df8534e703d 100644 --- a/addons/procurement/procurement.py +++ b/addons/procurement/procurement.py @@ -134,7 +134,7 @@ class procurement_order(osv.osv): ('exception', 'Exception'), ('running', 'Running'), ('done', 'Done') - ], 'Status', required=True, track_visibility='onchange'), + ], 'Status', required=True, track_visibility='onchange', copy=False), } _defaults = { diff --git a/addons/procurement/wizard/schedulers_all.py b/addons/procurement/wizard/schedulers_all.py index 34d4758c5d5..47f4dac440b 100644 --- a/addons/procurement/wizard/schedulers_all.py +++ b/addons/procurement/wizard/schedulers_all.py @@ -22,6 +22,7 @@ import threading from openerp.osv import osv +from openerp.api import Environment class procurement_compute_all(osv.osv_memory): _name = 'procurement.order.compute.all' @@ -35,17 +36,18 @@ class procurement_compute_all(osv.osv_memory): @param ids: List of IDs selected @param context: A standard dictionary """ - proc_obj = self.pool.get('procurement.order') - #As this function is in a new thread, i need to open a new cursor, because the old one may be closed - - new_cr = self.pool.cursor() - user = self.pool.get('res.users').browse(new_cr, uid, uid, context=context) - comps = [x.id for x in user.company_ids] - for comp in comps: - proc_obj.run_scheduler(new_cr, uid, use_new_cursor=new_cr.dbname, company_id = comp, context=context) - #close the new cursor - new_cr.close() - return {} + with Environment.manage(): + proc_obj = self.pool.get('procurement.order') + #As this function is in a new thread, i need to open a new cursor, because the old one may be closed + + new_cr = self.pool.cursor() + user = self.pool.get('res.users').browse(new_cr, uid, uid, context=context) + comps = [x.id for x in user.company_ids] + for comp in comps: + proc_obj.run_scheduler(new_cr, uid, use_new_cursor=new_cr.dbname, company_id = comp, context=context) + #close the new cursor + new_cr.close() + return {} def procure_calculation(self, cr, uid, ids, context=None): """ |
