Fix for new domain evaluation
This commit is contained in:
1 parent
b53bd7a77c
commit
63ab9b3521
2 files changed
+21
-21
No files matched your search
@@ -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')))
|
||||
|
||||
@@ -682,7 +682,7 @@
|
||||
<separator name="taxes" colspan="4"/>
|
||||
<field name="taxes" colspan="4"/>
|
||||
<separator name="comment" colspan="4"/>
|
||||
<field name="comment" colspan="4" spell="parent.party_lang"/>
|
||||
<field name="comment" colspan="4" spell="_parent_sale.party_lang"/>
|
||||
<field name="unit_digits" invisible="1"/>
|
||||
</form>
|
||||
]]>
|
||||
|
||||
Reference in new issue
Block a user