diff options
| -rw-r--r-- | addons/purchase/res_config_view.xml | 2 | ||||
| -rw-r--r-- | addons/stock_landed_costs/__init__.py | 1 | ||||
| -rw-r--r-- | addons/stock_landed_costs/__openerp__.py | 3 | ||||
| -rw-r--r-- | addons/stock_landed_costs/purchase_config_settings.py | 22 | ||||
| -rw-r--r-- | addons/stock_landed_costs/purchase_config_settings_views.xml | 13 | ||||
| -rw-r--r-- | addons/stock_landed_costs/stock_landed_costs_data.xml | 4 |
6 files changed, 43 insertions, 2 deletions
diff --git a/addons/purchase/res_config_view.xml b/addons/purchase/res_config_view.xml index 36c6af0743c..e8cced12c64 100644 --- a/addons/purchase/res_config_view.xml +++ b/addons/purchase/res_config_view.xml @@ -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"> diff --git a/addons/stock_landed_costs/__init__.py b/addons/stock_landed_costs/__init__.py index 840fc1c884a..9bc047a6ee8 100644 --- a/addons/stock_landed_costs/__init__.py +++ b/addons/stock_landed_costs/__init__.py @@ -3,3 +3,4 @@ import product import stock_landed_costs +import purchase_config_settings
\ No newline at end of file diff --git a/addons/stock_landed_costs/__openerp__.py b/addons/stock_landed_costs/__openerp__.py index b9d30a68b6a..e8ed925f597 100644 --- a/addons/stock_landed_costs/__openerp__.py +++ b/addons/stock_landed_costs/__openerp__.py @@ -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', diff --git a/addons/stock_landed_costs/purchase_config_settings.py b/addons/stock_landed_costs/purchase_config_settings.py new file mode 100644 index 00000000000..f57ac936035 --- /dev/null +++ b/addons/stock_landed_costs/purchase_config_settings.py @@ -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 {} diff --git a/addons/stock_landed_costs/purchase_config_settings_views.xml b/addons/stock_landed_costs/purchase_config_settings_views.xml new file mode 100644 index 00000000000..5daf9b0e0d7 --- /dev/null +++ b/addons/stock_landed_costs/purchase_config_settings_views.xml @@ -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>
\ No newline at end of file diff --git a/addons/stock_landed_costs/stock_landed_costs_data.xml b/addons/stock_landed_costs/stock_landed_costs_data.xml index 31f6d57e49f..1f9fceffd59 100644 --- a/addons/stock_landed_costs/stock_landed_costs_data.xml +++ b/addons/stock_landed_costs/stock_landed_costs_data.xml @@ -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> |
