Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][ADD] product_list_price_from_pricelist: Automatically compute product list prices based on a pricelist. #1852

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 119 additions & 0 deletions product_list_price_from_pricelist/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
============================================
Compute product sales price from a pricelist
============================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:1033e6116f2ea3d86c1b0a87d872a082b85b265a83f24fd660f9425936d37b6b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github
:target: https://github.com/OCA/product-attribute/tree/16.0/product_list_price_from_pricelist
:alt: OCA/product-attribute
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_list_price_from_pricelist
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/product-attribute&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module enables the automatic computation of a product's sale price based on the configuration of a pricelist.

**Table of contents**

.. contents::
:local:

Configuration
=============

- Go to `Sales` -> `Products` -> `Pricelists`.
- Create a new pricelist and add at least one rule.
- Specify the product template or category for the rule.
- Set the `computation mode` and save

**Note**: Ensure the minimum quantity is not great than 1 for the rule to apply effectively.

- Go to `Sales` -> `Configuration` -> `Settings`.
- In the `Pricing` section, select the `Pricelist to compute sale price` created in the previous step.
- Optionally and only with a multi-company environment enabled, set the `Main company for compute sale price` to restrict the computation to a specific company.
- Save the configuration

The module creates a cron job to update the product list price every day. The cron job is disabled by default.
To enable it, go to `Settings` -> `Technical` -> `Automation` -> `Scheduled Actions` and search for `Product sale price: Update price from pricelist`.

Usage
=====

**To update product prices according to the pricelist rules**

- Stay in the settings configuration with the selected Pricelist.
- Click the **Update Product Prices** button to apply the rules and update the sale prices of all products.

Known issues / Roadmap
======================

The `list_price` field is not `company-dependent`, meaning that if a product is shared across multiple companies, the same list price will apply to all of them.
To minimize errors, you can set a primary company to take precedence. This can be configured in the settings under the field `Main company for computing sale price`.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/product-attribute/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/product-attribute/issues/new?body=module:%20product_list_price_from_pricelist%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Tecnativa

Contributors
~~~~~~~~~~~~

* `Tecnativa <https://www.tecnativa.com>`_

* Pedro M. Baeza
* Carlos López

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-carlos-lopez-tecnativa| image:: https://github.com/carlos-lopez-tecnativa.png?size=40px
:target: https://github.com/carlos-lopez-tecnativa
:alt: carlos-lopez-tecnativa

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-carlos-lopez-tecnativa|

This module is part of the `OCA/product-attribute <https://github.com/OCA/product-attribute/tree/16.0/product_list_price_from_pricelist>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions product_list_price_from_pricelist/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
14 changes: 14 additions & 0 deletions product_list_price_from_pricelist/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "Compute product sales price from a pricelist",
"version": "16.0.1.0.0",
"author": "Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/product-attribute",
"depends": [
"sale",
],
"data": ["data/cron.xml", "views/res_config_settings_views.xml"],
"maintainers": ["carlos-lopez-tecnativa"],
"installable": True,
"auto_install": False,
"license": "AGPL-3",
}
15 changes: 15 additions & 0 deletions product_list_price_from_pricelist/data/cron.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record forcecreate="True" id="ir_cron_update_product_sale_price" model="ir.cron">
<field name="name">Product sale price: Update price from pricelist</field>
<field name="model_id" ref="base.model_res_company" />
<field name="state">code</field>
<field name="code">model._cron_update_product_list_price()</field>
<field name="user_id" ref="base.user_root" />
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="active" eval="False" />
<field name="doall" eval="False" />
</record>
</odoo>
101 changes: 101 additions & 0 deletions product_list_price_from_pricelist/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_list_price_from_pricelist
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-23 17:33+0000\n"
"PO-Revision-Date: 2025-01-23 12:33-0500\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.5\n"

#. module: product_list_price_from_pricelist
#: model_terms:ir.ui.view,arch_db:product_list_price_from_pricelist.view_res_config_settings_form
msgid "Are you sure you want to update the prices for all products?. This operations cannot be undone."
msgstr ""
"¿Estás seguro de actualizar el precio de venta en todos los productos?. Esta operación no puede revertirse."

#. module: product_list_price_from_pricelist
#: model:ir.model,name:product_list_price_from_pricelist.model_res_company
msgid "Companies"
msgstr "Compañías"

#. module: product_list_price_from_pricelist
#: model:ir.model,name:product_list_price_from_pricelist.model_res_config_settings
msgid "Config Settings"
msgstr "Ajustes de configuración"

#. module: product_list_price_from_pricelist
#: model_terms:ir.ui.view,arch_db:product_list_price_from_pricelist.view_res_config_settings_form
msgid ""
"If set, prices will be computed only if the company in the product matches the company specified here or is "
"empty.\n"
" Otherwise, prices will be computed based on the current company."
msgstr ""
"Si está configurada, los precios serán calculados solo si la compañía coincide con la compañía del producto "
"(o si esta vacía).\n"
" De lo contrario, los precios se calcularan basados en la compañía actual."

#. module: product_list_price_from_pricelist
#: model:ir.model.fields,field_description:product_list_price_from_pricelist.field_res_config_settings__main_company_compute_price_id
msgid "Main company for compute sale price"
msgstr "Compañía principal para calcular precios de venta"

#. module: product_list_price_from_pricelist
#: model:ir.model,name:product_list_price_from_pricelist.model_product_pricelist
msgid "Pricelist"
msgstr "Lista de precios"

#. module: product_list_price_from_pricelist
#: model:ir.model,name:product_list_price_from_pricelist.model_product_pricelist_item
msgid "Pricelist Rule"
msgstr "Regla de la lista de precios"

#. module: product_list_price_from_pricelist
#: model:ir.model.fields,help:product_list_price_from_pricelist.field_res_company__base_pricelist_compute_price_id
#: model:ir.model.fields,help:product_list_price_from_pricelist.field_res_config_settings__base_pricelist_compute_price_id
msgid "Pricelist used to calculate the price of all products"
msgstr "Lista de precio usada para calcular el precio de venta de todos los productos"

#. module: product_list_price_from_pricelist
#: model:ir.actions.server,name:product_list_price_from_pricelist.ir_cron_update_product_sale_price_ir_actions_server
#: model:ir.cron,cron_name:product_list_price_from_pricelist.ir_cron_update_product_sale_price
msgid "Product sale price: Update price from pricelist"
msgstr "Precio de venta de productos: Actualizar precio desde tarifas de venta"

#. module: product_list_price_from_pricelist
#: model:ir.model.fields,field_description:product_list_price_from_pricelist.field_res_company__base_pricelist_compute_price_id
#: model:ir.model.fields,field_description:product_list_price_from_pricelist.field_res_config_settings__base_pricelist_compute_price_id
msgid "Recomputing pricelist"
msgstr "Lista de precio para calcular precio de venta"

#. module: product_list_price_from_pricelist
#: model_terms:ir.ui.view,arch_db:product_list_price_from_pricelist.view_res_config_settings_form
msgid ""
"Set the base pricelist to compute the sales price for all the products.\n"
" <br/>"
msgstr ""
"Configure la tarifa de precios base para calcular el precio de venta de los productos.\n"
" <br/>"

#. module: product_list_price_from_pricelist
#: model_terms:ir.ui.view,arch_db:product_list_price_from_pricelist.view_res_config_settings_form
msgid "Update product prices"
msgstr "Actualizar precio de venta en productos"

#. module: product_list_price_from_pricelist
#: model_terms:ir.ui.view,arch_db:product_list_price_from_pricelist.view_res_config_settings_form
msgid ""
"WARNING: Prices are always computed for a quantity of 1, so rules with a minimum quantity higher than that "
"won't be taken into account"
msgstr ""
"ADVERTENCIA: Los precios siempre se calculan para la cantidad de 1, las reglas con cantidad mínima mayor a "
"esto no serán tomadas en cuenta"
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_list_price_from_pricelist
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-23 17:32+0000\n"
"PO-Revision-Date: 2025-01-23 17:32+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: product_list_price_from_pricelist
#: model_terms:ir.ui.view,arch_db:product_list_price_from_pricelist.view_res_config_settings_form
msgid ""
"Are you sure you want to update the prices for all products?. This "
"operations cannot be undone."
msgstr ""

#. module: product_list_price_from_pricelist
#: model:ir.model,name:product_list_price_from_pricelist.model_res_company
msgid "Companies"
msgstr ""

#. module: product_list_price_from_pricelist
#: model:ir.model,name:product_list_price_from_pricelist.model_res_config_settings
msgid "Config Settings"
msgstr ""

#. module: product_list_price_from_pricelist
#: model_terms:ir.ui.view,arch_db:product_list_price_from_pricelist.view_res_config_settings_form
msgid ""
"If set, prices will be computed only if the company in the product matches the company specified here or is empty.\n"
" Otherwise, prices will be computed based on the current company."
msgstr ""

#. module: product_list_price_from_pricelist
#: model:ir.model.fields,field_description:product_list_price_from_pricelist.field_res_config_settings__main_company_compute_price_id
msgid "Main company for compute sale price"
msgstr ""

#. module: product_list_price_from_pricelist
#: model:ir.model,name:product_list_price_from_pricelist.model_product_pricelist
msgid "Pricelist"
msgstr ""

#. module: product_list_price_from_pricelist
#: model:ir.model,name:product_list_price_from_pricelist.model_product_pricelist_item
msgid "Pricelist Rule"
msgstr ""

#. module: product_list_price_from_pricelist
#: model:ir.model.fields,help:product_list_price_from_pricelist.field_res_company__base_pricelist_compute_price_id
#: model:ir.model.fields,help:product_list_price_from_pricelist.field_res_config_settings__base_pricelist_compute_price_id
msgid "Pricelist used to calculate the price of all products"
msgstr ""

#. module: product_list_price_from_pricelist
#: model:ir.actions.server,name:product_list_price_from_pricelist.ir_cron_update_product_sale_price_ir_actions_server
#: model:ir.cron,cron_name:product_list_price_from_pricelist.ir_cron_update_product_sale_price
msgid "Product sale price: Update price from pricelist"
msgstr ""

#. module: product_list_price_from_pricelist
#: model:ir.model.fields,field_description:product_list_price_from_pricelist.field_res_company__base_pricelist_compute_price_id
#: model:ir.model.fields,field_description:product_list_price_from_pricelist.field_res_config_settings__base_pricelist_compute_price_id
msgid "Recomputing pricelist"
msgstr ""

#. module: product_list_price_from_pricelist
#: model_terms:ir.ui.view,arch_db:product_list_price_from_pricelist.view_res_config_settings_form
msgid ""
"Set the base pricelist to compute the sales price for all the products.\n"
" <br/>"
msgstr ""

#. module: product_list_price_from_pricelist
#: model_terms:ir.ui.view,arch_db:product_list_price_from_pricelist.view_res_config_settings_form
msgid "Update product prices"
msgstr ""

#. module: product_list_price_from_pricelist
#: model_terms:ir.ui.view,arch_db:product_list_price_from_pricelist.view_res_config_settings_form
msgid ""
"WARNING: Prices are always computed for a quantity of 1, so rules with a "
"minimum quantity higher than that won't be taken into account"
msgstr ""
3 changes: 3 additions & 0 deletions product_list_price_from_pricelist/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import res_company
from . import res_config_settings
from . import product_pricelist
Loading
Loading