[FIX] sale, sale_stock, sale_analytic_plans: fixed error in yalm tests or sale_mrp if sale_analytic_plans was installed before, due to value returned for a field not present in the view (project_id). Moved back onchange_shop_id into sale module from sale_stock
bzr revid: qdp-launchpad@openerp.com-20121005091516-y7typs1hep5exd3q
This commit is contained in:
parent
f2cc9b9f5e
commit
1e14590784
|
@ -50,6 +50,16 @@ class sale_order(osv.osv):
|
|||
_inherit = ['mail.thread', 'ir.needaction_mixin']
|
||||
_description = "Sales Order"
|
||||
|
||||
def onchange_shop_id(self, cr, uid, ids, shop_id, context=None):
|
||||
v = {}
|
||||
if shop_id:
|
||||
shop = self.pool.get('sale.shop').browse(cr, uid, shop_id, context=context)
|
||||
if shop.project_id.id:
|
||||
v['project_id'] = shop.project_id.id
|
||||
if shop.pricelist_id.id:
|
||||
v['pricelist_id'] = shop.pricelist_id.id
|
||||
return {'value': v}
|
||||
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
if not default:
|
||||
default = {}
|
||||
|
|
|
@ -181,7 +181,7 @@
|
|||
</group>
|
||||
<group>
|
||||
<field name="date_order"/>
|
||||
<field name="shop_id" invisible="1"/>
|
||||
<field name="shop_id" groups="base.extended" on_change="onchange_shop_id(shop_id, context)" widget="selection"/>
|
||||
<field name="client_order_ref"/>
|
||||
<field domain="[('type','=','sale')]" name="pricelist_id" groups="product.group_sale_pricelist" on_change="onchange_pricelist_id(pricelist_id,order_line)"/>
|
||||
</group>
|
||||
|
|
|
@ -39,4 +39,14 @@ class sale_order_line(osv.osv):
|
|||
|
||||
sale_order_line()
|
||||
|
||||
class sale_order(osv.osv):
|
||||
_inherit = "sale.order"
|
||||
|
||||
def onchange_shop_id(self, cr, uid, ids, shop_id, context=None):
|
||||
# Remove the project_id from the result of super() call, if any, as this field is not in the view anymore
|
||||
res = super(sale_order, self).onchange_shop_id(cr, uid, ids, shopd_id, context=context)
|
||||
if res.get('value',{}).get('project_id'):
|
||||
del(res['value']['porject_id'])
|
||||
return {'value': res}
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -165,16 +165,6 @@ class sale_order(osv.osv):
|
|||
|
||||
return osv.osv.unlink(self, cr, uid, unlink_ids, context=context)
|
||||
|
||||
def onchange_shop_id(self, cr, uid, ids, shop_id):
|
||||
v = {}
|
||||
if shop_id:
|
||||
shop = self.pool.get('sale.shop').browse(cr, uid, shop_id)
|
||||
v['project_id'] = shop.project_id.id
|
||||
# Que faire si le client a une pricelist a lui ?
|
||||
if shop.pricelist_id.id:
|
||||
v['pricelist_id'] = shop.pricelist_id.id
|
||||
return {'value': v}
|
||||
|
||||
def action_view_delivery(self, cr, uid, ids, context=None):
|
||||
'''
|
||||
This function returns an action that display existing delivery orders of given sale order ids. It can either be a in a list or in a form view, if there is only one delivery order to show.
|
||||
|
|
Loading…
Reference in New Issue