From f6220c39cf47fae976d9c65c96ec21a1dfcaa712 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sun, 18 Jan 2009 23:28:05 +0100 Subject: [PATCH] bugfix bzr revid: fp@tinyerp.com-20090118222805-d3enwc00b47ebwwr --- addons/account/account.py | 30 ------------------------------ addons/account/account_view.xml | 2 -- addons/sale/sale.py | 4 ++++ 3 files changed, 4 insertions(+), 32 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index e1f9d699815..46c923850eb 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1108,35 +1108,6 @@ class account_tax_code(osv.osv): This code is used for some tax declarations. """ - def _sum(self, cr, uid, ids, name, args, context, where =''): - ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) - acc_set = ",".join(map(str, ids2)) - if context.get('based_on', 'invoices') == 'payments': - cr.execute('SELECT line.tax_code_id, sum(line.tax_amount) \ - FROM account_move_line AS line, \ - account_move AS move \ - LEFT JOIN account_invoice invoice ON \ - (invoice.move_id = move.id) \ - WHERE line.tax_code_id in ('+acc_set+') '+where+' \ - AND move.id = line.move_id \ - AND ((invoice.state = \'paid\') \ - OR (invoice.id IS NULL)) \ - GROUP BY line.tax_code_id') - else: - cr.execute('SELECT line.tax_code_id, sum(line.tax_amount) \ - FROM account_move_line AS line \ - WHERE line.tax_code_id in ('+acc_set+') '+where+' \ - GROUP BY line.tax_code_id') - res=dict(cr.fetchall()) - for record in self.browse(cr, uid, ids, context): - def _rec_get(record): - amount = res.get(record.id, 0.0) - for rec in record.child_ids: - amount += _rec_get(rec) * rec.sign - return amount - res[record.id] = round(_rec_get(record), 2) - return res - def _sum_period(self, cr, uid, ids, name, args, context): if 'period_id' in context and context['period_id']: period_id = context['period_id'] @@ -1155,7 +1126,6 @@ class account_tax_code(osv.osv): 'name': fields.char('Tax Case Name', size=64, required=True), 'code': fields.char('Case Code', size=64), 'info': fields.text('Description'), - 'sum': fields.function(_sum, method=True, string="Year Sum"), 'sum_period': fields.function(_sum_period, method=True, string="Period Sum"), 'parent_id': fields.many2one('account.tax.code', 'Parent Code', select=True), 'child_ids': fields.one2many('account.tax.code', 'parent_id', 'Childs Codes'), diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 42fa70cd174..ec6470f8c36 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -527,7 +527,6 @@ - @@ -544,7 +543,6 @@ - diff --git a/addons/sale/sale.py b/addons/sale/sale.py index f79ce5de3cb..907dbe775ab 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -866,6 +866,10 @@ class sale_order_line(osv.osv): result = {} product_obj = product_obj.browse(cr, uid, product, context=context) + if not packaging and product_obj.packaging: + packaging = product_obj.packaging[0].id + result['product_packaging'] = packaging + if packaging: default_uom = product_obj.uom_id and product_obj.uom_id.id pack = self.pool.get('product.packaging').browse(cr, uid, packaging, context)