#15 new module product_update_price_last_purchase based on product_margin_classification to update sell prices on products when purchase price changes.
This commit is contained in:
parent
f9d660c245
commit
1bd3fab4dc
18 changed files with 279 additions and 536 deletions
|
|
@ -1,24 +1,23 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" ?>
|
||||
<!--
|
||||
Copyright (C) 2020-Today: La Osa (<https://laosa.coop/>)
|
||||
@author: Criptomart (https://criptomart.net)
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
<!-- Add action entry in the Action Menu for calculate sale price in Products -->
|
||||
<record id="action_product_calculate_theoritical_price" model="ir.actions.server">
|
||||
<field name="name">Update Sales Price</field>
|
||||
<field name="model_id" ref="product.model_product_template"/>
|
||||
<field name="binding_model_id" ref="product.model_product_template"/>
|
||||
<field name="model_id" ref="product.model_product_template" />
|
||||
<field name="binding_model_id" ref="product.model_product_template" />
|
||||
<field name="state">code</field>
|
||||
<field name="code">
|
||||
records._compute_theoritical_price()
|
||||
records.use_theoretical_price()
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Open products window with filter
|
||||
<!-- Open products window with filter
|
||||
<record id="action_product_template_list_price_updated" model="ir.actions.act_window">
|
||||
<field name="name">Productos con PVP actualizable</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
|
|
@ -35,4 +34,3 @@
|
|||
</record>
|
||||
-->
|
||||
</odoo>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,91 +1,66 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
<data>
|
||||
|
||||
<!-- list automatic price tick in product sheet -->
|
||||
<record model="ir.ui.view" id="product_view_inherit_list_price_auto">
|
||||
<field name="name">product.list.price.automatic.form</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="product.product_template_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="list_price" position="replace">
|
||||
<field name="list_price"
|
||||
string="Sale price."
|
||||
widget="monetary"
|
||||
options="{'currency_field': 'currency_id', 'field_digits': True}"
|
||||
attrs="{'readonly': [('last_purchase_price_compute_type','!=', 'manual_update')]}"
|
||||
/>
|
||||
<field name="last_purchase_price"
|
||||
string="Last purchase price"
|
||||
widget="monetary"
|
||||
options="{'currency_field': 'currency_id', 'field_digits': True}"
|
||||
attrs="{'readonly': 1}"
|
||||
/>
|
||||
<field name="last_purchase_price_compute_type"/>
|
||||
<field name="list_price_updated"/>
|
||||
<field name="to_print"/>
|
||||
</field>
|
||||
<field name="standard_price" position="replace">
|
||||
<field name="standard_price" attrs="{'readonly': [('last_purchase_price_compute_type','!=', 'manual_update')]}" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
<!-- list automatic price tick in product sheet -->
|
||||
<record model="ir.ui.view" id="product_view_inherit_list_price_auto">
|
||||
<field name="name">product.list.price.automatic.form</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="product.product_template_form_view" />
|
||||
<field name="arch" type="xml">
|
||||
<label for="list_price" position="before">
|
||||
<field name="last_purchase_price_received" />
|
||||
<!-- attrs="{'readonly': 1}"-->
|
||||
<!-- />-->
|
||||
<field name="last_purchase_price_received_compute_type" />
|
||||
<field name="to_print_label" />
|
||||
</label>
|
||||
<field name="standard_price" position="replace">
|
||||
<field
|
||||
name="standard_price"
|
||||
attrs="{'readonly': [('last_purchase_price_received_compute_type','!=', 'manual_update')]}"
|
||||
/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Settings Window -->
|
||||
<record id="res_config_settings_view_form_pricelists" model="ir.ui.view">
|
||||
<field name="name">product_update_price_last_purchase.res.config.settings.form</field>
|
||||
<field name="model">res.config.settings</field>
|
||||
<field name="priority" eval="100"/>
|
||||
<field name="inherit_id" ref="stock.res_config_settings_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@data-key='stock']" position="inside">
|
||||
<h2>Default pricelists for Coops</h2>
|
||||
<div class="row mt16 o_settings_container" name="coop_setting_container">
|
||||
<div class="row mt16 o_settings_container">
|
||||
<label for="product_pricelist_automatic"/>
|
||||
<field name="product_pricelist_automatic"/>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="product_template_tree_view" model="ir.ui.view">
|
||||
<field name="name">product.template.product.tree</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_tree_view" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="standard_price" position="after">
|
||||
<field name="last_purchase_price_received" />
|
||||
<field name="margin_state" invisible="1" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!--Filter for products that should update its sales price -->
|
||||
<record id="view_product_search_form_inherit_updated" model="ir.ui.view">
|
||||
<field name="name">view.product.search.form.inherit.updated</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_search_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//filter[@name='services']" position="before">
|
||||
<separator/>
|
||||
<filter string="To update sales price"
|
||||
name="products_updated_filter"
|
||||
domain="[('list_price_updated', '=', True), ('last_purchase_price_compute_type', '!=', 'manual_update')]"
|
||||
help="Products that have recently changed their cost price and have not updated their selling price."
|
||||
icon="terp-project"
|
||||
/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!--Filter for products that should print its shelf label -->
|
||||
<record id="view_product_search_form_inherit_tags" model="ir.ui.view">
|
||||
<field name="name">product_update_price_last_purchase.product.search.form.inherit.tags</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_search_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//filter[@name='products_updated_filter']" position="after">
|
||||
<filter string="To print"
|
||||
name="products_ready_to_print_filter"
|
||||
domain="[('to_print', '=', True)]"
|
||||
help="Products that have changed their sales price and no label has been printed."
|
||||
icon="terp-project"
|
||||
/>
|
||||
<separator/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<!--Filter for products that should update its sales price -->
|
||||
<record id="view_product_search_form_inherit_updated" model="ir.ui.view">
|
||||
<field name="name">view.product.search.form.inherit.updated</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_search_view" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//filter[@name='services']" position="before">
|
||||
<filter
|
||||
string="To update sales price"
|
||||
name="products_updated_filter"
|
||||
domain="[
|
||||
('last_purchase_price_received_compute_type', '!=', 'manual_update'),
|
||||
('margin_state','in', ['too_cheap', 'too_expensive'])
|
||||
]"
|
||||
/>
|
||||
<filter
|
||||
string="To print"
|
||||
name="products_ready_to_print_filter"
|
||||
domain="[('to_print_label', '=', True)]"
|
||||
/>
|
||||
<separator />
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</data>
|
||||
</odoo>
|
||||
|
|
|
|||
32
product_update_price_last_purchase/views/res_config.xml
Normal file
32
product_update_price_last_purchase/views/res_config.xml
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record
|
||||
id="res_config_settings_view_form__compute_pvp_pricelist"
|
||||
model="ir.ui.view"
|
||||
>
|
||||
<field
|
||||
name="name"
|
||||
>product.update.price.last.purchase.res.config.settings.form</field>
|
||||
<field name="model">res.config.settings</field>
|
||||
<field name="priority" eval="120" />
|
||||
<field name="inherit_id" ref="sale.res_config_settings_view_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@id='pricing_setting_container']" position="inside">
|
||||
<div
|
||||
class="col-12 col-lg-6 o_setting_box"
|
||||
name="update_price_settigs_container"
|
||||
>
|
||||
<div class="o_setting_right_pane">
|
||||
<label
|
||||
for="product_pricelist_automatic"
|
||||
string="PVP Pricelist"
|
||||
/>
|
||||
<field name="product_pricelist_automatic" />
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
Loading…
Add table
Add a link
Reference in a new issue