add product_sale_price_from_pricelist

This commit is contained in:
Luis 2025-02-04 21:15:51 +01:00
parent 6a3293b9a3
commit 188f32a052
13 changed files with 979 additions and 0 deletions

View file

@ -0,0 +1 @@
from . import models

View file

@ -0,0 +1,25 @@
{
"name": "Product Sale Price from Pricelist",
"version": "16.0.1.0.0",
"category": "product",
"summary": "Set sale price from pricelist based on last purchase price",
"description": """
Set sale price from pricelist based on last purchase price
""",
"author": "Criptomart",
"website": "https://criptomart.net",
"license": "AGPL-3",
"depends": [
"product_get_price_helper",
"sale",
"purchase",
"account",
"stock_account",
"product_template_tags",
],
"data": [
"views/actions.xml",
"views/product_view.xml",
],
"installable": True,
}

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="paperformat_barcode" model="report.paperformat">
<field name="name">Barcodes stickers format</field>
<field name="default" eval="True" />
<field name="format">A4</field>
<field name="page_height">0</field>
<field name="page_width">0</field>
<field name="orientation">Portrait</field>
<field name="margin_top">10</field>
<field name="margin_bottom">5</field>
<field name="margin_left">8</field>
<field name="margin_right">8</field>
<field name="header_line" eval="False" />
<field name="header_spacing">0</field>
<field name="dpi">75</field>
</record>
</odoo>

View file

@ -0,0 +1,317 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_laosa
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-03-26 09:31+0000\n"
"PO-Revision-Date: 2024-03-26 10:32+0100\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.4.2\n"
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_product_product__list_price_automatic
#: model:ir.model.fields,field_description:product_laosa.field_product_template__list_price_automatic
msgid "Automatic Sale Price"
msgstr "Precio de venta automático"
#. module: product_laosa
#: model:ir.model.fields,help:product_laosa.field_product_product__list_price_automatic
#: model:ir.model.fields,help:product_laosa.field_product_template__list_price_automatic
msgid "Automatic computation of the PVP from the cost price and the rate defined in the configuration."
msgstr "Cálculo automático del PVP a partir del precio de coste y la tarifa definida en la configuración."
#. module: product_laosa
#: model:ir.model.fields,help:product_laosa.field_product_pricelist_item__base
msgid ""
"Base price for computation.\n"
"Public Price: The base price will be the Sale/public Price.\n"
"Cost Price : The base price will be the cost price.\n"
"Other Pricelist : Computation of the base price based on another Pricelist."
msgstr ""
"Precio base de cálculo.\n"
"Precio Público: El precio base será el Precio Público / Venta.\n"
"Precio de costo: El precio base será el precio de costo.\n"
"Otra lista de precios: cálculo del precio base basado en otra lista de precios."
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_product_pricelist_item__base
msgid "Based on"
msgstr "Basado en"
#. module: product_laosa
#: model:ir.model.fields,help:product_laosa.field_product_product__last_purchase_price_compute_type
#: model:ir.model.fields,help:product_laosa.field_product_template__last_purchase_price_compute_type
msgid ""
"Choose whether discounts should influence the calculation of the last purchase price. Select Never update for manual configuration of cost and sale prices.\n"
"\n"
"* Without discounts: does not take into account discounts when updating the last purchase price.\n"
"* First discount: take into account only first discount when updating the last purchase price.\n"
"* Triple discount: take into account all discounts when updating the last purchase price. Needs \"Purchase Triple Discount\" OCA module.\n"
"* Manual update: Select this for manual configuration of cost and sale price. The sales price will not be calculated automatically."
msgstr ""
"Elija si los descuentos deben influir en la actualización del último precio de compra. Seleccione No actualizar nunca para la configuración manual de los precios de coste y venta.\n"
"\n"
"* Sin descuentos: no tiene en cuenta ningún descuento al actualizar el último precio de compra.\n"
"* Primer descuento: tiene en cuenta sólo el primer descuento al actualizar el último precio de compra.\n"
"* Triple descuento: tiene en cuenta todos los descuentos al actualizar el último precio de compra. Necesita el módulo OCA \"Purchase Triple Discount\".\n"
"* Actualización manual: configuración manual del precio de coste y de venta. El precio de venta no se calculará automáticamente."
#. module: product_laosa
#: model:ir.model,name:product_laosa.model_res_company
msgid "Companies"
msgstr "Compañías"
#. module: product_laosa
#: model:ir.model,name:product_laosa.model_res_config_settings
msgid "Config Settings"
msgstr "Opciones de Configuración"
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_product_packaging__qty
msgid "Contained Quantity"
msgstr "Cantidad contenida"
#. module: product_laosa
#: selection:product.pricelist.item,base:0
msgid "Cost"
msgstr "Coste"
#. module: product_laosa
#: selection:product.pricelist.item,base:0
msgid "Cost Price Tax Included"
msgstr "Precio de coste con impuesto incluido"
#. module: product_laosa
#: model_terms:ir.ui.view,arch_db:product_laosa.res_config_settings_view_form_pricelists
msgid "Default pricelists for Coops"
msgstr "Tarifas por defecto para cooperativas"
#. module: product_laosa
#: selection:product.template,last_purchase_price_compute_type:0
msgid "Double discount"
msgstr "Doble descuento"
#. module: product_laosa
#: selection:product.template,last_purchase_price_compute_type:0
msgid "First discount"
msgstr "Primer descuento"
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_product_product__last_print_label_date
#: model:ir.model.fields,field_description:product_laosa.field_product_template__last_print_label_date
msgid "Last Print Label Date"
msgstr "Fecha de la última impresión de la etiqueta"
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_product_product__last_purchase_price
#: model:ir.model.fields,field_description:product_laosa.field_product_template__last_purchase_price
#: model_terms:ir.ui.view,arch_db:product_laosa.product_view_inherit_list_price_auto
#: selection:product.pricelist.item,base:0
msgid "Last purchase price"
msgstr "Último precio de compra"
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_product_product__last_purchase_price_compute_type
#: model:ir.model.fields,field_description:product_laosa.field_product_template__last_purchase_price_compute_type
msgid "Last purchase price calculation type"
msgstr "Cálculo de último precio de compra"
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_product_product__list_price_updated
#: model:ir.model.fields,field_description:product_laosa.field_product_template__list_price_updated
msgid "Last purchase price updated"
msgstr "Último precio de compra actualizado"
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_product_template_tag__image
msgid "Logo"
msgstr "Logo"
#. module: product_laosa
#: selection:product.template,last_purchase_price_compute_type:0
msgid "Manual update"
msgstr "Actualización manual"
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_product_product__name_wordpress
#: model:ir.model.fields,field_description:product_laosa.field_product_template__name_wordpress
msgid "Name for WordPress"
msgstr "Nombre para WordPress"
#. module: product_laosa
#: code:addons/product_laosa/models/product_template.py:55
#, python-format
msgid "Not found a valid pricelist to compute sale price. Check configuration in General Settings."
msgstr "No se ha encontrado una lista de precios válida para calcular el precio de venta. Compruebe la configuración en los Ajustes Generales."
#. module: product_laosa
#: selection:product.pricelist.item,base:0
msgid "Other Pricelist"
msgstr "Otra tarifa"
#. module: product_laosa
#: model:ir.model.fields,help:product_laosa.field_product_product__list_price
#: model:ir.model.fields,help:product_laosa.field_product_template__list_price
msgid "Price calculated according to the configured pricelist, including VAT."
msgstr "Precio calculado según la tarifa configurada, incluyendo el IVA."
#. module: product_laosa
#: model:ir.model,name:product_laosa.model_product_pricelist
msgid "Pricelist"
msgstr "Tarifa"
#. module: product_laosa
#: model:ir.model,name:product_laosa.model_product_pricelist_item
msgid "Pricelist Item"
msgstr "Elemento de tarifa"
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_res_config_settings__product_pricelist_automatic
msgid "Pricelist applied to automatic calculation of sales price"
msgstr "Tarifa aplicada al cálculo automático del precio de venta"
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_res_company__product_pricelist_automatic
msgid "Pricelist applied to the automatic selling price"
msgstr "Tarifa aplicada al PVP automáticamente"
#. module: product_laosa
#: model:ir.model,name:product_laosa.model_product_product
msgid "Product"
msgstr "Producto"
#. module: product_laosa
#: model:ir.model,name:product_laosa.model_product_packaging
msgid "Product Packaging"
msgstr "Empaquetado del producto"
#. module: product_laosa
#: model:ir.model,name:product_laosa.model_product_template_tag
msgid "Product Tag"
msgstr "Etiqueta de producto"
#. module: product_laosa
#: model:ir.model,name:product_laosa.model_product_template
msgid "Product Template"
msgstr "Plantilla de producto"
#. module: product_laosa
#: model_terms:ir.ui.view,arch_db:product_laosa.view_product_search_form_inherit_tags
msgid "Products that have changed their sales price and no label has been printed."
msgstr "Productos que han cambiado su PVP y no se ha impreso su etiqueta."
#. module: product_laosa
#: model_terms:ir.ui.view,arch_db:product_laosa.view_product_search_form_inherit_updated
msgid "Products that have recently changed their cost price and have not updated their selling price."
msgstr "Productos que han cambiado recientemente su precio de coste y no han actualizado su PVP."
#. module: product_laosa
#: selection:product.pricelist.item,base:0
msgid "Public Price"
msgstr "Precio público"
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_product_product__is_wordpress_public
#: model:ir.model.fields,field_description:product_laosa.field_product_template__is_wordpress_public
msgid "Publish on WordPress"
msgstr "Publicar en WordPress"
#. module: product_laosa
#: model:ir.model.fields,help:product_laosa.field_res_company__product_pricelist_automatic
#: model:ir.model.fields,help:product_laosa.field_res_config_settings__product_pricelist_automatic
msgid "Rate that applies to all products that update the selling price automatically."
msgstr "Tarifa que se aplica a todos los productos que actualizan el precio de venta automáticamente."
#. module: product_laosa
#: model:ir.model,name:product_laosa.model_ir_actions_report
msgid "Report Action"
msgstr "Reportar la acción"
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_product_product__list_price
#: model:ir.model.fields,field_description:product_laosa.field_product_template__list_price
msgid "Sale price with VAT"
msgstr "PVP con impuestos"
#. module: product_laosa
#: model_terms:ir.ui.view,arch_db:product_laosa.product_view_inherit_list_price_auto
msgid "Sale price."
msgstr "PVP"
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_product_template_tag__sequence
msgid "Sequence"
msgstr "Secuencia"
#. module: product_laosa
#: model:ir.model,name:product_laosa.model_stock_move
msgid "Stock Move"
msgstr "Movimiento de stock"
#. module: product_laosa
#: model:ir.model.fields,help:product_laosa.field_product_product__list_price_updated
#: model:ir.model.fields,help:product_laosa.field_product_template__list_price_updated
msgid "The last cost price has been updated and you need to update the selling price in the database, shelves and scales."
msgstr "Se ha actualizado el último precio de coste y hay que actualizar el PVP en la base de datos, lineales y las balanzas."
#. module: product_laosa
#: model:ir.model.fields,help:product_laosa.field_product_product__last_purchase_price
#: model:ir.model.fields,help:product_laosa.field_product_template__last_purchase_price
msgid "The last price at which the product was purchased. It is used as the base price field for calculating the product sale price."
msgstr "El último precio al que se compró el producto. Se utiliza como campo de precio base para calcular el precio de venta del producto."
#. module: product_laosa
#: model:ir.model.fields,help:product_laosa.field_product_product__to_print
#: model:ir.model.fields,help:product_laosa.field_product_template__to_print
msgid "The sale price has been updated on this product and needs to be updated on the shelf."
msgstr "El PVP ha sido actualizado en este producto y necesita ser actualizado en el lineal."
#. module: product_laosa
#: model:ir.model.fields,help:product_laosa.field_product_packaging__qty
msgid "The total number of products you can have per pallet or box."
msgstr "El numero total de productos que puede tener por palé o caja."
#. module: product_laosa
#: model_terms:ir.ui.view,arch_db:product_laosa.view_product_search_form_inherit_tags
msgid "To print"
msgstr "Para imprimir"
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_product_product__to_print
#: model:ir.model.fields,field_description:product_laosa.field_product_template__to_print
msgid "To print label"
msgstr "Pendiente de imprimir etiqueta"
#. module: product_laosa
#: model_terms:ir.ui.view,arch_db:product_laosa.view_product_search_form_inherit_updated
msgid "To update sales price"
msgstr "Pendiente de actualizar PVP"
#. module: product_laosa
#: selection:product.template,last_purchase_price_compute_type:0
msgid "Triple discount"
msgstr "Triple decuento"
#. module: product_laosa
#: model:ir.actions.server,name:product_laosa.action_product_calculate_theoritical_price
msgid "Update Sales Price"
msgstr "Actualizar PVP"
#. module: product_laosa
#: selection:product.template,last_purchase_price_compute_type:0
msgid "Without discounts"
msgstr "Sin descuentos"
#. module: product_laosa
#: model_terms:ir.ui.view,arch_db:product_laosa.product_view_inherit_wordpress_laosa
msgid "WordPress"
msgstr "WordPress"

View file

@ -0,0 +1,304 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_laosa
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-03-26 09:39+0000\n"
"PO-Revision-Date: 2024-03-26 09:39+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_laosa
#: model:ir.model.fields,field_description:product_laosa.field_product_product__list_price_automatic
#: model:ir.model.fields,field_description:product_laosa.field_product_template__list_price_automatic
msgid "Automatic Sale Price"
msgstr ""
#. module: product_laosa
#: model:ir.model.fields,help:product_laosa.field_product_product__list_price_automatic
#: model:ir.model.fields,help:product_laosa.field_product_template__list_price_automatic
msgid "Automatic computation of the PVP from the cost price and the rate defined in the configuration."
msgstr ""
#. module: product_laosa
#: model:ir.model.fields,help:product_laosa.field_product_pricelist_item__base
msgid "Base price for computation.\n"
"Public Price: The base price will be the Sale/public Price.\n"
"Cost Price : The base price will be the cost price.\n"
"Other Pricelist : Computation of the base price based on another Pricelist."
msgstr ""
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_product_pricelist_item__base
msgid "Based on"
msgstr ""
#. module: product_laosa
#: model:ir.model.fields,help:product_laosa.field_product_product__last_purchase_price_compute_type
#: model:ir.model.fields,help:product_laosa.field_product_template__last_purchase_price_compute_type
msgid "Choose whether discounts should influence the calculation of the last purchase price. Select Never update for manual configuration of cost and sale prices.\n"
"\n"
"* Without discounts: does not take into account discounts when updating the last purchase price.\n"
"* First discount: take into account only first discount when updating the last purchase price.\n"
"* Triple discount: take into account all discounts when updating the last purchase price. Needs \"Purchase Triple Discount\" OCA module.\n"
"* Manual update: Select this for manual configuration of cost and sale price. The sales price will not be calculated automatically."
msgstr ""
#. module: product_laosa
#: model:ir.model,name:product_laosa.model_res_company
msgid "Companies"
msgstr ""
#. module: product_laosa
#: model:ir.model,name:product_laosa.model_res_config_settings
msgid "Config Settings"
msgstr ""
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_product_packaging__qty
msgid "Contained Quantity"
msgstr ""
#. module: product_laosa
#: selection:product.pricelist.item,base:0
msgid "Cost"
msgstr ""
#. module: product_laosa
#: selection:product.pricelist.item,base:0
msgid "Cost Price Tax Included"
msgstr ""
#. module: product_laosa
#: model_terms:ir.ui.view,arch_db:product_laosa.res_config_settings_view_form_pricelists
msgid "Default pricelists for Coops"
msgstr ""
#. module: product_laosa
#: selection:product.template,last_purchase_price_compute_type:0
msgid "Double discount"
msgstr ""
#. module: product_laosa
#: selection:product.template,last_purchase_price_compute_type:0
msgid "First discount"
msgstr ""
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_product_product__last_print_label_date
#: model:ir.model.fields,field_description:product_laosa.field_product_template__last_print_label_date
msgid "Last Print Label Date"
msgstr ""
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_product_product__last_purchase_price
#: model:ir.model.fields,field_description:product_laosa.field_product_template__last_purchase_price
#: model_terms:ir.ui.view,arch_db:product_laosa.product_view_inherit_list_price_auto
#: selection:product.pricelist.item,base:0
msgid "Last purchase price"
msgstr ""
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_product_product__last_purchase_price_compute_type
#: model:ir.model.fields,field_description:product_laosa.field_product_template__last_purchase_price_compute_type
msgid "Last purchase price calculation type"
msgstr ""
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_product_product__list_price_updated
#: model:ir.model.fields,field_description:product_laosa.field_product_template__list_price_updated
msgid "Last purchase price updated"
msgstr ""
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_product_template_tag__image
msgid "Logo"
msgstr ""
#. module: product_laosa
#: selection:product.template,last_purchase_price_compute_type:0
msgid "Manual update"
msgstr ""
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_product_product__name_wordpress
#: model:ir.model.fields,field_description:product_laosa.field_product_template__name_wordpress
msgid "Name for WordPress"
msgstr ""
#. module: product_laosa
#: code:addons/product_laosa/models/product_template.py:55
#, python-format
msgid "Not found a valid pricelist to compute sale price. Check configuration in General Settings."
msgstr ""
#. module: product_laosa
#: selection:product.pricelist.item,base:0
msgid "Other Pricelist"
msgstr ""
#. module: product_laosa
#: model:ir.model.fields,help:product_laosa.field_product_product__list_price
#: model:ir.model.fields,help:product_laosa.field_product_template__list_price
msgid "Price calculated according to the configured pricelist, including VAT."
msgstr ""
#. module: product_laosa
#: model:ir.model,name:product_laosa.model_product_pricelist
msgid "Pricelist"
msgstr ""
#. module: product_laosa
#: model:ir.model,name:product_laosa.model_product_pricelist_item
msgid "Pricelist Item"
msgstr ""
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_res_config_settings__product_pricelist_automatic
msgid "Pricelist applied to automatic calculation of sales price"
msgstr ""
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_res_company__product_pricelist_automatic
msgid "Pricelist applied to the automatic selling price"
msgstr ""
#. module: product_laosa
#: model:ir.model,name:product_laosa.model_product_product
msgid "Product"
msgstr ""
#. module: product_laosa
#: model:ir.model,name:product_laosa.model_product_packaging
msgid "Product Packaging"
msgstr ""
#. module: product_laosa
#: model:ir.model,name:product_laosa.model_product_template_tag
msgid "Product Tag"
msgstr ""
#. module: product_laosa
#: model:ir.model,name:product_laosa.model_product_template
msgid "Product Template"
msgstr ""
#. module: product_laosa
#: model_terms:ir.ui.view,arch_db:product_laosa.view_product_search_form_inherit_tags
msgid "Products that have changed their sales price and no label has been printed."
msgstr ""
#. module: product_laosa
#: model_terms:ir.ui.view,arch_db:product_laosa.view_product_search_form_inherit_updated
msgid "Products that have recently changed their cost price and have not updated their selling price."
msgstr ""
#. module: product_laosa
#: selection:product.pricelist.item,base:0
msgid "Public Price"
msgstr ""
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_product_product__is_wordpress_public
#: model:ir.model.fields,field_description:product_laosa.field_product_template__is_wordpress_public
msgid "Publish on WordPress"
msgstr ""
#. module: product_laosa
#: model:ir.model.fields,help:product_laosa.field_res_company__product_pricelist_automatic
#: model:ir.model.fields,help:product_laosa.field_res_config_settings__product_pricelist_automatic
msgid "Rate that applies to all products that update the selling price automatically."
msgstr ""
#. module: product_laosa
#: model:ir.model,name:product_laosa.model_ir_actions_report
msgid "Report Action"
msgstr ""
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_product_product__list_price
#: model:ir.model.fields,field_description:product_laosa.field_product_template__list_price
msgid "Sale price with VAT"
msgstr ""
#. module: product_laosa
#: model_terms:ir.ui.view,arch_db:product_laosa.product_view_inherit_list_price_auto
msgid "Sale price."
msgstr ""
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_product_template_tag__sequence
msgid "Sequence"
msgstr ""
#. module: product_laosa
#: model:ir.model,name:product_laosa.model_stock_move
msgid "Stock Move"
msgstr ""
#. module: product_laosa
#: model:ir.model.fields,help:product_laosa.field_product_product__list_price_updated
#: model:ir.model.fields,help:product_laosa.field_product_template__list_price_updated
msgid "The last cost price has been updated and you need to update the selling price in the database, shelves and scales."
msgstr ""
#. module: product_laosa
#: model:ir.model.fields,help:product_laosa.field_product_product__last_purchase_price
#: model:ir.model.fields,help:product_laosa.field_product_template__last_purchase_price
msgid "The last price at which the product was purchased. It is used as the base price field for calculating the product sale price."
msgstr ""
#. module: product_laosa
#: model:ir.model.fields,help:product_laosa.field_product_product__to_print
#: model:ir.model.fields,help:product_laosa.field_product_template__to_print
msgid "The sale price has been updated on this product and needs to be updated on the shelf."
msgstr ""
#. module: product_laosa
#: model:ir.model.fields,help:product_laosa.field_product_packaging__qty
msgid "The total number of products you can have per pallet or box."
msgstr ""
#. module: product_laosa
#: model_terms:ir.ui.view,arch_db:product_laosa.view_product_search_form_inherit_tags
msgid "To print"
msgstr ""
#. module: product_laosa
#: model:ir.model.fields,field_description:product_laosa.field_product_product__to_print
#: model:ir.model.fields,field_description:product_laosa.field_product_template__to_print
msgid "To print label"
msgstr ""
#. module: product_laosa
#: model_terms:ir.ui.view,arch_db:product_laosa.view_product_search_form_inherit_updated
msgid "To update sales price"
msgstr ""
#. module: product_laosa
#: selection:product.template,last_purchase_price_compute_type:0
msgid "Triple discount"
msgstr ""
#. module: product_laosa
#: model:ir.actions.server,name:product_laosa.action_product_calculate_theoritical_price
msgid "Update Sales Price"
msgstr ""
#. module: product_laosa
#: selection:product.template,last_purchase_price_compute_type:0
msgid "Without discounts"
msgstr ""
#. module: product_laosa
#: model_terms:ir.ui.view,arch_db:product_laosa.product_view_inherit_wordpress_laosa
msgid "WordPress"
msgstr ""

View file

@ -0,0 +1,5 @@
from . import product_pricelist
from . import product_pricelist_item
from . import product_template
from . import res_config
from . import stock_move

View file

@ -0,0 +1,30 @@
# Copyright (C) 2020: Criptomart (https://criptomart.net)
# @author Santi Noreña (<santi@criptomart.net>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# import logging
from odoo import api, models
# _logger = logging.getLogger(__name__)
class ProductPricelist(models.Model):
_inherit = "product.pricelist"
def _compute_price_rule(self, products, qty, uom=None, date=False, **kwargs):
ProductPricelistItem = self.env["product.pricelist.item"]
ProductProduct = self.env["product.product"]
res = super()._compute_price_rule(products, date=date, qty=1)
new_res = res.copy()
item_id = []
for product_id, values in res.items():
if values[1]:
item_id = values[1]
if item_id:
item = ProductPricelistItem.browse(item_id)
if item.base == "last_purchase_price":
price = ProductProduct.browse(product_id).last_purchase_price
price = (price - (price * (item.price_discount / 100))) or 0.0
new_res[product_id] = (price, item_id)
return new_res

View file

@ -0,0 +1,14 @@
# Copyright (C) 2020: Criptomart (https://criptomart.net)
# @author Santi Noreña (<santi@criptomart.net>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class ProductPricelistItem(models.Model):
_inherit = "product.pricelist.item"
base = fields.Selection(
selection_add=[("last_purchase_price", "Last purchase price")],
ondelete={"last_purchase_price": "set default"},
)

View file

@ -0,0 +1,90 @@
# Copyright (C) 2020: Criptomart (https://criptomart.net)
# @author Santi Noreña (<santi@criptomart.net>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import logging
from odoo import exceptions, models, fields, api, _
from odoo.exceptions import UserError
_logger = logging.getLogger(__name__)
class ProductTemplate(models.Model):
_inherit = "product.template"
last_purchase_price_updated = fields.Boolean(
string="Last purchase price updated",
help="The last purchase price has been updated and you need to update the selling price in the database, shelves and scales.",
default=False,
company_dependent=True,
)
list_price_theoritical = fields.Float(
"Theoritical price",
readonly=True,
company_dependent=True,
)
last_purchase_price = fields.Float(
string="Last purchase price",
help="The last price at which the product was purchased. It is used as the base price field for calculating the product sale price.",
readonly=True,
digits="Product Price",
company_dependent=True,
)
last_purchase_price_compute_type = fields.Selection(
[
("without_discounts", "Without discounts"),
("with_discount", "First discount"),
("with_two_discounts", "Double discount"),
("with_three_discounts", "Triple discount"),
("manual_update", "Manual update"),
],
string="Last purchase price calculation type",
help="Choose whether discounts should influence the calculation of the last purchase price. Select Never update for manual configuration of cost and sale prices.\n"
"\n* Without discounts: does not take into account discounts when updating the last purchase price.\n"
"* First discount: take into account only first discount when updating the last purchase price.\n"
'* Triple discount: take into account all discounts when updating the last purchase price. Needs "Purchase Triple Discount" OCA module.\n'
"* Manual update: Select this for manual configuration of cost and sale price. The sales price will not be calculated automatically.",
default="without_discounts",
required=True,
company_dependent=True,
)
def _compute_theoritical_price(self):
pricelist_obj = self.env["product.pricelist"]
pricelist_id = (
self.env["ir.config_parameter"]
.sudo()
.get_param("product_sale_price_from_pricelist.product_pricelist_automatic")
or False
)
pricelist = pricelist_obj.browse(int(pricelist_id))
if pricelist:
for template in self:
_logger.debug(("company: %s" % self.env.company))
_logger.debug("compute pre price : %s" % template.last_purchase_price)
if (
template.name
and template.id
and template.product_variant_id
and template.last_purchase_price_compute_type != "manual_update"
):
partial_price = template.product_variant_id._get_price(
qty=1, pricelist=pricelist
)
_logger.debug("partial price : %s" % partial_price)
template.list_price_theoritical = partial_price["value"]
template.last_purchase_price_updated = True
_logger.debug("final price : %s" % template.list_price_theoritical)
else:
raise UserError(
_(
"Not found a valid pricelist to compute sale price. Check configuration in General Settings."
)
)
def action_update_list_price(self):
for template in self:
template.list_price = template.list_price_theoritical
template.last_purchase_price_updated = False

View file

@ -0,0 +1,11 @@
from odoo import models, fields, api
class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"
product_pricelist_automatic = fields.Many2one(
comodel_name="product.pricelist",
string="Pricelist applied to automatic calculation of sales price",
config_parameter="product_sale_price_from_pricelist.product_pricelist_automatic",
)

View file

@ -0,0 +1,65 @@
# Copyright 2016-2019 Akretion (http://www.akretion.com/)
# Copyright 2020 Criptomart <tech@criptomart.net>
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# @author Santi Noreña (<santi@criptomart.net>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging
import math
from odoo import exceptions, models, fields, api, _
from odoo.tools import float_is_zero, float_round, float_compare
_logger = logging.getLogger(__name__)
class StockMove(models.Model):
_inherit = "stock.move"
def product_price_update_before_done(self):
super(StockMove, self).product_price_update_before_done()
for move in self.filtered(lambda move: move.location_id.usage == "supplier"):
if (
move.product_id.last_purchase_price_compute_type
== "with_three_discounts"
):
price_updated = float_round(
move.purchase_line_id.price_subtotal
/ move.purchase_line_id.product_qty,
precision_digits=2,
)
elif move.product_id.last_purchase_price_compute_type == "with_discount":
price_updated = float_round(
move.purchase_line_id.price_unit
* (1 - move.purchase_line_id.discount / 100),
precision_digits=2,
)
elif (
move.product_id.last_purchase_price_compute_type == "with_two_discounts"
):
price_updated = float_round(
move.purchase_line_id.price_unit
* (1 - move.purchase_line_id.discount / 100)
* (1 - move.purchase_line_id.discount2 / 100),
precision_digits=2,
)
else:
price_updated = move.purchase_line_id.price_unit
if float_compare(
move.product_id.last_purchase_price, price_updated, precision_digits=2
) and not float_is_zero(move.quantity_done, precision_digits=3):
_logger.info(
"Update last_purchase_price: %s for product %s Previous price: %s"
% (
price_updated,
move.product_id.default_code,
move.product_id.last_purchase_price,
)
)
move.product_id.with_company(move.company_id).last_purchase_price = (
price_updated
)
move.product_id.with_company(
move.company_id
).product_tmpl_id._compute_theoritical_price()

View file

@ -0,0 +1,22 @@
<?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.action_update_list_price()
</field>
</record>
</odoo>

View file

@ -0,0 +1,75 @@
<?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">
<xpath expr="//label[@for='list_price']" position="before">
<field name="last_purchase_price"
widget="monetary"
options="{'currency_field': 'currency_id', 'field_digits': True}"
attrs="{'readonly': 0}"
/>
<field name="last_purchase_price_compute_type" />
<field name="list_price_theoritical" />
</xpath>
<field name="standard_price" position="attributes">
<attribute name="attrs">
{'readonly':[('last_purchase_price_compute_type','!=','manual_update')]}
</attribute>
</field>
<group name="group_standard_price" position="after">
<group></group>
<group name="label_info" string="Label Info">
<field name="last_purchase_price_updated" />
</group>
</group>
</field>
</record>
<record id="res_config_settings_view_form_pricelists" model="ir.ui.view">
<field name="name">product.print.supermarket.res.config.settings.form</field>
<field name="model">res.config.settings</field>
<field name="priority" eval="100" />
<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="supermarket_settigs_container"
>
<div class="o_setting_right_pane">
<label for="product_pricelist_automatic" string="Sale Price Pricelist" />
<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="[('last_purchase_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>
</data>
</odoo>