Skip to content
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
98 changes: 98 additions & 0 deletions product_supplierinfo_update_price/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
=================================
Product Supplierinfo Update Price
=================================

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

.. |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%2Fpurchase--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/purchase-workflow/tree/18.0/product_supplierinfo_update_price
:alt: OCA/purchase-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/purchase-workflow-18-0/purchase-workflow-18-0-product_supplierinfo_update_price
: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/purchase-workflow&target_branch=18.0
:alt: Try me on Runboat

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

This module allows updating the product's vendor price from the purchase
order line.

**Table of contents**

.. contents::
:local:

Usage
=====

To use this module, you need to:

- Go to Purchase > New Purchase

- Set the supplier and add a purchase order line with a product and its
price

- If the price of the product on the purchase order line for that
supplier is different from the price set in the product's vendor list
(on the purchase tab), or if no vendor entry exists, a refresh button
will appear to the right of the unit price. Otherwise, the button will
not be shown.

- If you click the refresh button, the vendor price will be updated or a
new vendor entry will be created, as appropriate.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/purchase-workflow/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/purchase-workflow/issues/new?body=module:%20product_supplierinfo_update_price%0Aversion:%2018.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
-------

* Dixmit

Contributors
------------

- `Dixmit <https://www.dixmit.com>`__:

- Luis Rodríguez <[email protected]>

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.

This module is part of the `OCA/purchase-workflow <https://github.com/OCA/purchase-workflow/tree/18.0/product_supplierinfo_update_price>`_ 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_supplierinfo_update_price/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
20 changes: 20 additions & 0 deletions product_supplierinfo_update_price/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2025 Dixmit
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Product Supplierinfo Update Price",
"summary": """Updates the product's vendor price with the price
set in a purchase order.""",
"version": "18.0.1.0.0",
"license": "AGPL-3",
"author": "Dixmit,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/purchase-workflow",
"depends": [
"purchase",
"product",
],
"data": [
"views/purchase_views.xml",
],
"demo": [],
}
32 changes: 32 additions & 0 deletions product_supplierinfo_update_price/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_supplierinfo_update_price
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2025-06-06 14:50+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.10.4\n"

#. module: product_supplierinfo_update_price
#: model:ir.model.fields,field_description:product_supplierinfo_update_price.field_purchase_order_line__can_update_product_supplierinfo
msgid "Can Update Product Supplierinfo"
msgstr "Può aggiornare le informazioni fornitore del prodotto"

#. module: product_supplierinfo_update_price
#: model:ir.model,name:product_supplierinfo_update_price.model_purchase_order_line
msgid "Purchase Order Line"
msgstr "Riga ordine di acquisto"

#. module: product_supplierinfo_update_price
#: model_terms:ir.ui.view,arch_db:product_supplierinfo_update_price.purchase_order_form
msgid "Update Product Supplierinfo Price"
msgstr "Aggiorna prezzo informazioni fornitore prodotto"
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_supplierinfo_update_price
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \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_supplierinfo_update_price
#: model:ir.model.fields,field_description:product_supplierinfo_update_price.field_purchase_order_line__can_update_product_supplierinfo
msgid "Can Update Product Supplierinfo"
msgstr ""

#. module: product_supplierinfo_update_price
#: model:ir.model,name:product_supplierinfo_update_price.model_purchase_order_line
msgid "Purchase Order Line"
msgstr ""

#. module: product_supplierinfo_update_price
#: model_terms:ir.ui.view,arch_db:product_supplierinfo_update_price.purchase_order_form
msgid "Update Product Supplierinfo Price"
msgstr ""
1 change: 1 addition & 0 deletions product_supplierinfo_update_price/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import purchase_order_line
75 changes: 75 additions & 0 deletions product_supplierinfo_update_price/models/purchase_order_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Copyright 2025 Dixmit
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class PurchaseOrderLine(models.Model):
_inherit = "purchase.order.line"

can_update_product_supplierinfo = fields.Boolean(
compute="_compute_can_update_product_supplierinfo",
)

def action_update_product_supplierinfo(self):
self.ensure_one()

product_supplierinfo = (
self.product_id._select_seller(
partner_id=self.partner_id,
quantity=self.product_qty,
date=self.order_id.date_order
and self.order_id.date_order.date()
or fields.Date.context_today(self),
uom_id=self.product_uom,
params=self._get_select_sellers_params(),
)
if self.product_id
else False
)

if product_supplierinfo:
product_supplierinfo.write(
{
"price": self.price_unit,
}
)
else:
self.product_id.seller_ids.create(
{
"partner_id": self.partner_id.id,
"product_tmpl_id": self.product_id.product_tmpl_id.id,
"price": self.price_unit,
}
)

@api.onchange("product_id", "partner_id", "price_unit")
def _compute_can_update_product_supplierinfo(self):
for line in self:
# We need this condition because in some situations
# the onchange methods can fail.
if (
not line._origin.id
or not line.product_id
or not line.partner_id
or not line.price_unit
):
line.can_update_product_supplierinfo = False
continue
product_supplierinfo = (
line.product_id._select_seller(
partner_id=line.partner_id,
quantity=line.product_qty,
date=line.order_id.date_order
and line.order_id.date_order.date()
or fields.Date.context_today(self),
uom_id=line.product_uom,
params=line._get_select_sellers_params(),
)
if line.product_id
else False
)
line.can_update_product_supplierinfo = bool(
not product_supplierinfo
or product_supplierinfo.price != line.price_unit
)
3 changes: 3 additions & 0 deletions product_supplierinfo_update_price/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
2 changes: 2 additions & 0 deletions product_supplierinfo_update_price/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- [Dixmit](https://www.dixmit.com):
- Luis Rodríguez \<<[email protected]>\>
1 change: 1 addition & 0 deletions product_supplierinfo_update_price/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module allows updating the product's vendor price from the purchase order line.
9 changes: 9 additions & 0 deletions product_supplierinfo_update_price/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
To use this module, you need to:

- Go to Purchase > New Purchase

- Set the supplier and add a purchase order line with a product and its price

- If the price of the product on the purchase order line for that supplier is different from the price set in the product's vendor list (on the purchase tab), or if no vendor entry exists, a refresh button will appear to the right of the unit price. Otherwise, the button will not be shown.

- If you click the refresh button, the vendor price will be updated or a new vendor entry will be created, as appropriate.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading