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/analytic | |
| 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/analytic')
| -rw-r--r-- | addons/analytic/analytic.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/addons/analytic/analytic.py b/addons/analytic/analytic.py index 1d728ba1e7c..e31efa0eb2a 100644 --- a/addons/analytic/analytic.py +++ b/addons/analytic/analytic.py @@ -159,7 +159,8 @@ class account_analytic_account(osv.osv): if account.company_id.currency_id.id != value: raise osv.except_osv(_('Error!'), _("If you set a company, the currency selected has to be the same as it's currency. \nYou can remove the company belonging, and thus change the currency, only on analytic account of type 'view'. This can be really useful for consolidation purposes of several companies charts with different currencies, for example.")) if value: - return cr.execute("""update account_analytic_account set currency_id=%s where id=%s""", (value, account.id, )) + cr.execute("""update account_analytic_account set currency_id=%s where id=%s""", (value, account.id)) + self.invalidate_cache(cr, uid, ['currency_id'], [account.id], context=context) def _currency(self, cr, uid, ids, field_name, arg, context=None): result = {} @@ -173,7 +174,7 @@ class account_analytic_account(osv.osv): _columns = { 'name': fields.char('Account/Contract Name', required=True, track_visibility='onchange'), 'complete_name': fields.function(_get_full_name, type='char', string='Full Name'), - 'code': fields.char('Reference', select=True, track_visibility='onchange'), + 'code': fields.char('Reference', select=True, track_visibility='onchange', copy=False), 'type': fields.selection([('view','Analytic View'), ('normal','Analytic Account'),('contract','Contract or Project'),('template','Template of Contract')], 'Type of Account', required=True, help="If you select the View Type, it means you won\'t allow to create journal entries using that account.\n"\ "The type 'Analytic account' stands for usual accounts that you only want to use in accounting.\n"\ @@ -196,7 +197,14 @@ class account_analytic_account(osv.osv): 'date_start': fields.date('Start Date'), 'date': fields.date('Expiration Date', select=True, track_visibility='onchange'), 'company_id': fields.many2one('res.company', 'Company', required=False), #not required because we want to allow different companies to use the same chart of account, except for leaf accounts. - 'state': fields.selection([('template', 'Template'),('draft','New'),('open','In Progress'),('pending','To Renew'),('close','Closed'),('cancelled', 'Cancelled')], 'Status', required=True, track_visibility='onchange'), + 'state': fields.selection([('template', 'Template'), + ('draft','New'), + ('open','In Progress'), + ('pending','To Renew'), + ('close','Closed'), + ('cancelled', 'Cancelled')], + 'Status', required=True, + track_visibility='onchange', copy=False), 'currency_id': fields.function(_currency, fnct_inv=_set_company_currency, #the currency_id field is readonly except if it's a view account and if there is no company store = { 'res.company': (_get_analytic_account, ['currency_id'], 10), @@ -266,10 +274,7 @@ class account_analytic_account(osv.osv): if not default: default = {} analytic = self.browse(cr, uid, id, context=context) - default.update( - code=False, - line_ids=[], - name=_("%s (copy)") % (analytic['name'])) + default['name'] = _("%s (copy)") % analytic['name'] return super(account_analytic_account, self).copy(cr, uid, id, default, context=context) def on_change_company(self, cr, uid, id, company_id): |
