From b91cd6127ad295a272c52b714d7ebefb3c40f446 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Sat, 20 Apr 2013 03:50:03 +0200 Subject: [PATCH] [REVERT] account_report_company: undo override of res.partner.commercial_partner_id field to store it, as the ORM does not support it and it's not strictly necessary It works when installing the module but would break everytime another module that inherits from res.partner is installed/update from command-line (e.g. -i/-u crm), as account_report_company is low in the dependency graph so the field is dropped when the ORM notices that the current field definition is not stored. This can be solved in trunk by making the field stored directly in 'base'. bzr revid: odo@openerp.com-20130420015003-8y48xrb14cjif60w --- .../account_report_company/account_report_company.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/addons/account_report_company/account_report_company.py b/addons/account_report_company/account_report_company.py index 22719440dec..0c102fcc4e1 100644 --- a/addons/account_report_company/account_report_company.py +++ b/addons/account_report_company/account_report_company.py @@ -28,22 +28,17 @@ class res_partner(osv.Model): def _display_name_compute(self, cr, uid, ids, name, args, context=None): return dict(self.name_get(cr, uid, ids, context=context)) - _commercial_partner_id_store_triggers = { + _display_name_store_triggers = { 'res.partner': (lambda self,cr,uid,ids,context=None: self.search(cr, uid, [('id','child_of',ids)]), ['parent_id', 'is_company'], 10) } - # indirections to avoid passing a copy of the overridable method when declaring the function field - _commercial_partner_id = lambda self, *args, **kwargs: self._commercial_partner_compute(*args, **kwargs) + # indirection to avoid passing a copy of the overridable method when declaring the function field _display_name = lambda self, *args, **kwargs: self._display_name_compute(*args, **kwargs) _columns = { - # make the original field stored, in case it's needed for reporting purposes - 'commercial_partner_id': fields.function(_commercial_partner_id, type='many2one', relation='res.partner', string='Commercial Entity', - store=_commercial_partner_id_store_triggers), - # extra field to allow ORDER BY to match visible names - 'display_name': fields.function(_display_name, type='char', string='Name', store=_commercial_partner_id_store_triggers), + 'display_name': fields.function(_display_name, type='char', string='Name', store=_display_name_store_triggers), } class account_invoice(osv.Model):