[FIX] sale: unremove boring, old-fashioned onchange method on pricelist_id
This commit is contained in:
@@ -227,6 +227,12 @@ class sale_order(osv.osv):
|
||||
return 'sale.mt_order_sent'
|
||||
return super(sale_order, self)._track_subtype(cr, uid, ids, init_values, context=context)
|
||||
|
||||
def onchange_pricelist_id(self, cr, uid, ids, pricelist_id, order_lines, context=None):
|
||||
if not pricelist_id:
|
||||
return {}
|
||||
pricelist = self.pool['product.pricelist'].browse(cr, uid, pricelist_id, context=context)
|
||||
return {'value': {'currency_id': pricelist.currency_id.id}}
|
||||
|
||||
def get_salenote(self, cr, uid, ids, partner_id, context=None):
|
||||
context_lang = context.copy()
|
||||
if partner_id:
|
||||
|
||||
@@ -170,7 +170,7 @@
|
||||
</group>
|
||||
<group>
|
||||
<field name="date_order"/>
|
||||
<field domain="[('type','=','sale')]" name="pricelist_id" groups="product.group_sale_pricelist"/>
|
||||
<field domain="[('type','=','sale')]" name="pricelist_id" groups="product.group_sale_pricelist" on_change="onchange_pricelist_id(pricelist_id,order_line)"/>
|
||||
<field name="currency_id" invisible="1"/>
|
||||
<field name="validity_date"/>
|
||||
<field name="payment_term_id" options="{'no_create': True}"/>
|
||||
|
||||
@@ -315,6 +315,7 @@ class website(orm.Model):
|
||||
# update the pricelist
|
||||
if update_pricelist:
|
||||
values = {'pricelist_id': pricelist_id}
|
||||
values.update(sale_order.onchange_pricelist_id(pricelist_id, None)['value'])
|
||||
sale_order.write(values)
|
||||
for line in sale_order.order_line:
|
||||
if line.exists():
|
||||
|
||||
Reference in New Issue
Block a user