From 63ab9b352113f550a19cea3cf8f4525ee1ffdbe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 4 Sep 2008 18:28:51 +0200 Subject: [PATCH] Fix for new domain evaluation --- sale.py | 40 ++++++++++++++++++++-------------------- sale.xml | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/sale.py b/sale.py index b87d31e6fd..ac8abfece2 100644 --- a/sale.py +++ b/sale.py @@ -687,8 +687,8 @@ class SaleLine(OSV): 'required': "product", 'invisible': "type != 'line'", }, domain="[('category', '=', (product, 'product'))]", - on_change=['product', 'quantity', 'unit', 'parent.currency', - 'parent.party']) + on_change=['product', 'quantity', 'unit', '_parent_sale.currency', + '_parent_sale.party']) unit_digits = fields.Function('get_unit_digits', type='integer', string='Unit Digits', on_change_with=['unit']) product = fields.Many2One('product.product', 'Product', @@ -696,20 +696,20 @@ class SaleLine(OSV): states={ 'invisible': "type != 'line'", }, on_change=['product', 'unit', 'quantity', 'description', - 'parent.party', 'parent.currency'], - context="{'locations': [parent.warehouse], " \ - "'stock_date_end': parent.sale_date}") + '_parent_sale.party', '_parent_sale.currency'], + context="{'locations': [_parent_sale.warehouse], " \ + "'stock_date_end': _parent_sale.sale_date}") unit_price = fields.Numeric('Unit Price', digits=(16, 4), states={ 'invisible': "type != 'line'", 'required': "type == 'line'", }) amount = fields.Function('get_amount', type='numeric', string='Amount', - digits="(16, parent.currency_digits)", + digits="(16, _parent_sale.currency_digits)", states={ 'invisible': "type not in ('line', 'subtotal')", }, on_change_with=['type', 'quantity', 'unit_price', - 'parent.currency']) + '_parent_sale.currency']) description = fields.Char('Description', size=None, required=True) comment = fields.Text('Comment', states={ @@ -820,8 +820,8 @@ class SaleLine(OSV): ctx = context.copy() party = None - if vals.get('parent.party'): - party = party_obj.browse(cursor, user, vals['parent.party'], + if vals.get('_parent_sale.party'): + party = party_obj.browse(cursor, user, vals['_parent_sale.party'], context=context) if party.lang: ctx['language'] = party.lang.code @@ -830,10 +830,10 @@ class SaleLine(OSV): context=context) ctx2 = context.copy() - if vals.get('parent.currency'): - ctx2['currency'] = vals['parent.currency'] - if vals.get('parent.party'): - ctx2['customer'] = vals['parent.party'] + if vals.get('_parent_sale.currency'): + ctx2['currency'] = vals['_parent_sale.currency'] + if vals.get('_parent_sale.party'): + ctx2['customer'] = vals['_parent_sale.party'] if vals.get('unit'): ctx2['uom'] = vals['unit'] res['unit_price'] = product_obj.get_sale_price(cursor, user, @@ -873,10 +873,10 @@ class SaleLine(OSV): context=context) ctx2 = context.copy() - if vals.get('parent.currency'): - ctx2['currency'] = vals['parent.currency'] - if vals.get('parent.party'): - ctx2['customer'] = vals['parent.party'] + if vals.get('_parent_sale.currency'): + ctx2['currency'] = vals['_parent_sale.currency'] + if vals.get('_parent_sale.party'): + ctx2['customer'] = vals['_parent_sale.party'] if vals.get('unit'): ctx2['uom'] = vals['unit'] res['unit_price'] = product_obj.get_sale_price(cursor, user, @@ -887,11 +887,11 @@ class SaleLine(OSV): def on_change_with_amount(self, cursor, user, ids, vals, context=None): currency_obj = self.pool.get('currency.currency') if vals.get('type') == 'line': - if isinstance(vals.get('parent.currency'), (int, long)): + if isinstance(vals.get('_parent_sale.currency'), (int, long)): currency = currency_obj.browse(cursor, user, - vals['parent.currency'], context=context) + vals['_parent_sale.currency'], context=context) else: - currency = vals['parent.currency'] + currency = vals['_parent_sale.currency'] return currency_obj.round(cursor, user, currency, Decimal(str(vals.get('quantity') or '0.0')) * \ (vals.get('unit_price') or Decimal('0.0'))) diff --git a/sale.xml b/sale.xml index 962cae2a5d..902788713c 100644 --- a/sale.xml +++ b/sale.xml @@ -682,7 +682,7 @@ - + ]]>