[FIX] stock_landed_cost: instead of inheriting the view to add an on_change that returns a warning, I switched the res_config on_change to the new api

This fixes a traceback when changing the settings since the view inheritance broke the widget='radio' introduced by @tivisse
This commit is contained in:
Damien Bouvy
2015-09-07 16:08:44 +02:00
parent bd03435c56
commit 97dbfe54de
3 changed files with 6 additions and 18 deletions
-1
View File
@@ -22,7 +22,6 @@ This module allows you to easily add extra costs on pickings and decide the spli
'product_view.xml',
'stock_landed_costs_view.xml',
'stock_landed_costs_data.xml',
'purchase_config_settings_views.xml',
],
'test': [
'../account/test/account_minimal_test.xml',
@@ -1,15 +1,17 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp.osv import fields, osv
from openerp import api, models
from openerp.tools.translate import _
class purchase_config_settings(osv.osv_memory):
class PurchaseConfigSettings(models.TransientModel):
_name = 'purchase.config.settings'
_inherit = 'purchase.config.settings'
def onchange_costing_method(self, cr, uid, ids, group_costing_method, context=None):
if not group_costing_method:
@api.onchange('group_costing_method')
def onchange_costing_method(self):
if self.group_costing_method == 0:
return {
'warning': {
'title': _('Warning!'),
@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_purchase_configuration_costing_methods" model="ir.ui.view">
<field name="name">purchase.res.config.view</field>
<field name="model">purchase.config.settings</field>
<field name="inherit_id" ref="purchase.view_purchase_configuration"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='group_costing_method']" position="replace">
<field name="group_costing_method" class="oe_inline" on_change="onchange_costing_method(group_costing_method)"/>
</xpath>
</field>
</record>
</odoo>