[FIX] warning: onchange_partner_id
When the warning module is installed, `onchange_picking_type` is not called anymore. When the method `onchange_picking_type` was introduced, it was not taken into account that the warning module would change the onchange property on the `partner_id` field thanks to the method `onchange_partner_id`. opw-672091 Fixes #11342
This commit is contained in:
@@ -142,7 +142,7 @@ class account_invoice(osv.osv):
|
||||
class stock_picking(osv.osv):
|
||||
_inherit = 'stock.picking'
|
||||
|
||||
def onchange_partner_id(self, cr, uid, ids, partner_id=None, context=None):
|
||||
def onchange_picking_type(self, cr, uid, ids, picking_type_id, partner_id, context=None):
|
||||
if not partner_id:
|
||||
return {}
|
||||
partner = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
|
||||
@@ -167,12 +167,20 @@ class stock_picking(osv.osv):
|
||||
if partner.picking_warn == 'block':
|
||||
return {'value': {'partner_id': False}, 'warning': warning}
|
||||
|
||||
result = {'value': {}}
|
||||
result = super(stock_picking, self).onchange_picking_type(cr, uid, ids, picking_type_id, partner_id, context=context)
|
||||
if result.get('warning', False):
|
||||
warning['title'] = title and title + ' & '+ result['warning']['title'] or result['warning']['title']
|
||||
warning['message'] = message and message + ' ' + result['warning']['message'] or result['warning']['message']
|
||||
|
||||
if warning:
|
||||
result['warning'] = warning
|
||||
return result
|
||||
|
||||
# FORWARD-PORT UP TO SAAS-10, REMOVE THIS METHOD IN MASTER
|
||||
def onchange_partner_id(self, cr, uid, ids, partner_id=None, context=None):
|
||||
return self.onchange_picking_type(cr, uid, ids, False, partner_id, context=context)
|
||||
|
||||
|
||||
class product_product(osv.osv):
|
||||
_inherit = 'product.template'
|
||||
_columns = {
|
||||
|
||||
@@ -63,8 +63,8 @@
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="inherit_id" ref="stock.view_picking_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<!-- FORWARD-PORT UP TO SAAS-10, REMOVE THE RECORD COMPLETELY IN MASTER -->
|
||||
<field name="partner_id" position="attributes">
|
||||
<attribute name="on_change">onchange_partner_id(partner_id)</attribute>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user