[IMP] The group_costing_method is mandatory for the landed costs to be usable
- Set purchase module as a dependency of stock_landed_costs module - Add a warning on the group_costing_method option to prevent the user to disable it if the stock_landed_costs module is installed
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
</data>
|
||||
<data>
|
||||
<record id="view_purchase_configuration" model="ir.ui.view">
|
||||
<field name="name">purchase settings</field>
|
||||
<field name="name">purchase.res.config.view</field>
|
||||
<field name="model">purchase.config.settings</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Configure Purchases" class="oe_form_configuration">
|
||||
|
||||
@@ -3,3 +3,4 @@
|
||||
|
||||
import product
|
||||
import stock_landed_costs
|
||||
import purchase_config_settings
|
||||
@@ -12,7 +12,7 @@ Landed Costs Management
|
||||
This module allows you to easily add extra costs on pickings and decide the split of these costs among their stock moves in order to take them into account in your stock valuation.
|
||||
""",
|
||||
'website': 'https://www.odoo.com/page/warehouse',
|
||||
'depends': ['stock_account'],
|
||||
'depends': ['stock_account', 'purchase'],
|
||||
'category': 'Warehouse Management',
|
||||
'sequence': 16,
|
||||
'demo': [
|
||||
@@ -23,6 +23,7 @@ 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',
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from openerp.osv import fields, osv
|
||||
from openerp.tools.translate import _
|
||||
|
||||
class purchase_config_settings(osv.osv_memory):
|
||||
_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:
|
||||
return {
|
||||
'warning': {
|
||||
'title': _('Warning!'),
|
||||
'message': _('Disabling the costing methods will prevent you to use the landed costs feature.'),
|
||||
},
|
||||
'value': {
|
||||
'group_costing_method': True
|
||||
}
|
||||
}
|
||||
return {}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?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>
|
||||
@@ -9,5 +9,9 @@
|
||||
<field name="description">Landed cost validated</field>
|
||||
</record>
|
||||
|
||||
<record model="res.groups" id="base.group_user">
|
||||
<field name="implied_ids" eval="[(4, ref('stock_account.group_inventory_valuation'))]"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
Reference in New Issue
Block a user