[IMP] useability, warning on change of pricelist in the middle of the SO

lp bug: https://launchpad.net/bugs/782168 fixed

bzr revid: fp@tinyerp.com-20110921073359-t20q6m88ocnm746z
This commit is contained in:
Fabien Pinckaers 2011-09-21 09:33:59 +02:00
parent b9869f9354
commit 354a4d48c0
2 changed files with 11 additions and 1 deletions

View File

@ -322,6 +322,16 @@ class sale_order(osv.osv):
self.log(cr, uid, id, message)
return True
def onchange_pricelist_id(self, cr, uid, ids, pricelist_id, order_lines, context={}):
print order_lines
if (not pricelist_id) or (not order_lines):
return {}
warning = {
'title': _('Pricelist Warning!'),
'message' : _('If you change the pricelist of this order (and eventually the currency), prices of existing order lines will not be updated.')
}
return {'warning': warning}
def onchange_partner_id(self, cr, uid, ids, part):
if not part:
return {'value': {'partner_invoice_id': False, 'partner_shipping_id': False, 'partner_order_id': False, 'payment_term': False, 'fiscal_position': False}}

View File

@ -112,7 +112,7 @@
<field domain="[('partner_id','=',partner_id)]" name="partner_order_id"/>
<field domain="[('partner_id','=',partner_id)]" name="partner_invoice_id" groups="base.group_extended"/>
<field domain="[('partner_id','=',partner_id)]" name="partner_shipping_id" groups="base.group_extended"/>
<field domain="[('type','=','sale')]" name="pricelist_id" groups="base.group_extended"/>
<field domain="[('type','=','sale')]" name="pricelist_id" groups="base.group_extended" on_change="onchange_pricelist_id(pricelist_id,order_line)"/>
<field name="project_id" context="{'partner_id':partner_id, 'contact_id':partner_order_id, 'pricelist_id':pricelist_id, 'default_name':name}" groups="analytic.group_analytic_accounting" domain="[('parent_id','!=',False)]"/>
<newline/>
<field colspan="4" mode="tree,form,graph" name="order_line" nolabel="1" widget="one2many_list">