[ADD] product_update_price_last_purchase

This commit is contained in:
Luis 2022-03-29 12:25:28 +02:00
parent 27f0791503
commit 5f4bb24894
18 changed files with 942 additions and 0 deletions

View file

@ -0,0 +1,39 @@
<?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="state">code</field>
<field name="code">
records._compute_theoritical_price()
</field>
</record>
<!-- 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>
<field name="res_model">product.template</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="product.product_template_tree_view"/>
<field name="domain">[]</field>
<field name="context">{"search_default_products_updated_filter": 1}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Todos los productos están actualizados.
</p>
</field>
</record>
-->
</odoo>

View file

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<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>
<!-- 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="name">res.config.settings.view.form.inherit.sale.pricelists</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>
<!--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>
</data>
</odoo>