From 8de161c2436861158c63aa072b1bd344834e7d76 Mon Sep 17 00:00:00 2001 From: Maxime Chambreuil <> Date: Wed, 10 Aug 2011 11:36:07 +0530 Subject: [PATCH 1/2] [FIX] Made changes in account.py and installer.py inorder to get the company information while loading account module lp bug: https://launchpad.net/bugs/822976 fixed bzr revid: bde@tinyerp.com-20110810060607-9gltlhrpiwyqu3yv --- addons/account/account.py | 6 +++--- addons/account/installer.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 72208314ed9..255eec8fc92 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1331,7 +1331,7 @@ class account_move(osv.osv): def _centralise(self, cr, uid, move, mode, context=None): assert mode in ('debit', 'credit'), 'Invalid Mode' #to prevent sql injection - currency_obj = self.pool.get('res.currency') + currency_obj = self.pool.get('res.currency') if context is None: context = {} @@ -1593,7 +1593,7 @@ class account_tax_code(osv.osv): (parent_ids,) + where_params) res=dict(cr.fetchall()) obj_precision = self.pool.get('decimal.precision') - res2 = {} + res2 = {} for record in self.browse(cr, uid, ids, context=context): def _rec_get(record): amount = res.get(record.id, 0.0) @@ -2699,7 +2699,7 @@ class wizard_multi_charts_accounts(osv.osv_memory): unconfigured_cmp = list(set(company_ids)-set(configured_cmp)) for field in res['fields']: if field == 'company_id': - res['fields'][field]['domain'] = unconfigured_cmp + res['fields'][field]['domain'] = [('id','in',unconfigured_cmp)] res['fields'][field]['selection'] = [('', '')] if unconfigured_cmp: cmp_select = [(line.id, line.name) for line in self.pool.get('res.company').browse(cr, uid, unconfigured_cmp)] diff --git a/addons/account/installer.py b/addons/account/installer.py index 1f16e066578..33ddaa94b12 100644 --- a/addons/account/installer.py +++ b/addons/account/installer.py @@ -100,7 +100,7 @@ class account_installer(osv.osv_memory): unconfigured_cmp = list(set(company_ids)-set(configured_cmp)) for field in res['fields']: if field == 'company_id': - res['fields'][field]['domain'] = unconfigured_cmp + res['fields'][field]['domain'] = [('id','in',unconfigured_cmp)] res['fields'][field]['selection'] = [('', '')] if unconfigured_cmp: cmp_select = [(line.id, line.name) for line in self.pool.get('res.company').browse(cr, uid, unconfigured_cmp)] From 3611c379654b12c739bad2c249836bc92baec592 Mon Sep 17 00:00:00 2001 From: "Bharat (OpenERP)" Date: Thu, 15 Sep 2011 17:33:03 +0530 Subject: [PATCH 2/2] [MERGE] merged with main addons bzr revid: bde@tinyerp.com-20110915120303-cwl491qebv0lwhgx --- addons/sale_layout/sale_layout.py | 30 ++++++++++++++----------- addons/sale_layout/sale_layout_view.xml | 4 +++- addons/sale_margin/sale_margin.py | 4 ++-- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/addons/sale_layout/sale_layout.py b/addons/sale_layout/sale_layout.py index 853783c218d..fed7ec14c7c 100644 --- a/addons/sale_layout/sale_layout.py +++ b/addons/sale_layout/sale_layout.py @@ -124,17 +124,21 @@ class sale_order_line(osv.osv): sale_order_line() -class one2many_mod2(fields.one2many): - def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None): - if not values: - values = {} - res = {} - for id in ids: - res[id] = [] - ids2 = obj.pool.get(self._obj).search(cr, user, [(self._fields_id, 'in', ids), ('layout_type', '=', 'article')], limit=self._limit) - for r in obj.pool.get(self._obj)._read_flat(cr, user, ids2, [self._fields_id], context=context, load='_classic_write'): - res[r[self._fields_id]].append( r['id'] ) - return res +#class one2many_mod2(fields.one2many): +# print "one2many_mod2 CLASSSSS" +# def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None): +# print "GET", ids +# if not values: +# values = {} +# res = {} +# for id in ids: +# res[id] = [] +# ids2 = obj.pool.get(self._obj).search(cr, user, [(self._fields_id, 'in', ids), ('layout_type', '=', 'article')], limit=self._limit) +# print "ids2", ids2 +# for r in obj.pool.get(self._obj)._read_flat(cr, user, ids2, [self._fields_id], context=context, load='_classic_write'): +# res[r[self._fields_id]].append( r['id'] ) +# print "res", res +# return res class sale_order(osv.osv): @@ -147,8 +151,8 @@ class sale_order(osv.osv): _inherit = "sale.order" _columns = { - 'abstract_line_ids': fields.one2many('sale.order.line', 'order_id', 'Order Lines', readonly=True, states={'draft': [('readonly', False)]}), - 'order_line': one2many_mod2('sale.order.line', 'order_id', 'Order Lines', readonly=True, states={'draft': [('readonly', False)]}), + #'abstract_line_ids': fields.one2many('sale.order.line', 'order_id', 'Order Lines', readonly=True, states={'draft': [('readonly', False)]}), + 'order_line': fields.one2many('sale.order.line', 'order_id', 'Order Lines', readonly=True, states={'draft': [('readonly', False)]}), } sale_order() diff --git a/addons/sale_layout/sale_layout_view.xml b/addons/sale_layout/sale_layout_view.xml index dbea639f86e..ed006aae529 100644 --- a/addons/sale_layout/sale_layout_view.xml +++ b/addons/sale_layout/sale_layout_view.xml @@ -13,7 +13,7 @@ form - +
@@ -46,6 +46,7 @@ + @@ -81,6 +82,7 @@ + diff --git a/addons/sale_margin/sale_margin.py b/addons/sale_margin/sale_margin.py index 24f36b9f94b..0aead824015 100644 --- a/addons/sale_margin/sale_margin.py +++ b/addons/sale_margin/sale_margin.py @@ -25,10 +25,10 @@ class sale_order_line(osv.osv): def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False, qty_uos=0, uos=False, name='', partner_id=False, - lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False): + lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False, context=None): res = super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty=qty, uom=uom, qty_uos=qty_uos, uos=uos, name=name, partner_id=partner_id, - lang=lang, update_tax=update_tax, date_order=date_order, packaging=packaging, fiscal_position=fiscal_position, flag=flag) + lang=lang, update_tax=update_tax, date_order=date_order, packaging=packaging, fiscal_position=fiscal_position, flag=flag, context=context) frm_cur = self.pool.get('res.users').browse(cr, uid, uid).company_id.currency_id.id to_cur = self.pool.get('res.partner').browse(cr, uid, partner_id).property_product_pricelist.currency_id.id if product: