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

[14.0][IMP] product_pricelist_last_purchase_price: If find more than … #3034

Merged
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
10 changes: 10 additions & 0 deletions product_pricelist_last_purchase_price/i18n/en_GB.po
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,13 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:product_pricelist_last_purchase_price.view_res_partner_filter
msgid "Update Price From Order"
msgstr ""

#. module: product_pricelist_last_purchase_price
#: code:addons/product_pricelist_last_purchase_price/models/account_move.py:0
#: code:addons/product_pricelist_last_purchase_price/models/purchase_order.py:0
#, python-format
msgid ""
"The product: %(product)s has been repeated more than once by supplier: "
"%(supplier)s."
msgstr ""

12 changes: 12 additions & 0 deletions product_pricelist_last_purchase_price/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,15 @@ msgstr "Actualizar precio desde factura"
#: model_terms:ir.ui.view,arch_db:product_pricelist_last_purchase_price.view_res_partner_filter
msgid "Update Price From Order"
msgstr "Actualizar precio desde pedido"

#. module: product_pricelist_last_purchase_price
#: code:addons/product_pricelist_last_purchase_price/models/account_move.py:0
#: code:addons/product_pricelist_last_purchase_price/models/purchase_order.py:0
#, python-format
msgid ""
"The product: %(product)s has been repeated more than once by supplier: "
"%(supplier)s."
msgstr ""
"El producto: %(product)s tiene repetido mas de una vez al proveedor: "
"%(supplier)s."

Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,13 @@ msgstr ""
#: model_terms:ir.ui.view,arch_db:product_pricelist_last_purchase_price.view_res_partner_filter
msgid "Update Price From Order"
msgstr ""

#. module: product_pricelist_last_purchase_price
#: code:addons/product_pricelist_last_purchase_price/models/account_move.py:0
#: code:addons/product_pricelist_last_purchase_price/models/purchase_order.py:0
#, python-format
msgid ""
"The product: %(product)s has been repeated more than once by supplier: "
"%(supplier)s."
msgstr ""

10 changes: 8 additions & 2 deletions product_pricelist_last_purchase_price/models/account_move.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2024 Alfredo de la Fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
from odoo.exceptions import AccessError
from odoo import _, fields, models
from odoo.exceptions import AccessError, ValidationError


class AccountMove(models.Model):
Expand Down Expand Up @@ -93,6 +93,12 @@ def _find_seller_to_update_suppliernfo_to_product(self, line, partner):
lambda x: x.name == partner
and (x.price != line.price_unit or x.discount != line.discount)
)
if len(seller) > 1:
message = _(
"The product: %(product)s has been repeated more than "
"once by supplier: %(supplier)s."
) % {"product": line.product_id.name, "supplier": partner.name}
raise ValidationError(message)
if seller and seller.not_update_price_from_invoice:
seller = False
return seller
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright 2024 Alfredo de la Fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models
from odoo import _, models
from odoo.exceptions import ValidationError


class PurchaseOrder(models.Model):
Expand All @@ -10,6 +11,12 @@ def _find_seller_to_update_suppliernfo_to_product(self, line, partner):
seller = super(
PurchaseOrder, self
)._find_seller_to_update_suppliernfo_to_product(line, partner)
if len(seller) > 1:
message = _(
"The product: %(product)s has been repeated more than "
"once by supplier: %(supplier)s."
) % {"product": line.product_id.name, "supplier": partner.name}
raise ValidationError(message)
if seller and seller.not_update_price_from_order:
seller = False
return seller
Loading