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
111 changes: 111 additions & 0 deletions stock_move_purchase_price_update/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
================================
Stock Move Purchase Price Update
================================

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

.. |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/stock_move_purchase_price_update
: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-stock_move_purchase_price_update
: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|

Allow update purchase price from incoming picking operations, picking
detailed operations and picking batch detailed operations if the
purchase order is not invoiced.

**Table of contents**

.. contents::
:local:

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

- Go to 'Inventory > Configuration > Operations' Types
- Select Reception operation
- Enable 'Show Detailed Operations' option.
- Go to Reception picking
- Add optional column 'Purchase price' in operations and/or detailed
operations

Usage
=====

- Go to Purchase > Products > Products and edit/create one
- Set Product Type as Storable Product
- Go to Purchase > Orders > Requests for Quotation
- Create new RQ with the previous product in the order lines
- Confirm the Purchase Order
- Now you have a new button called 'Receive Products' > Press it
- Add optional column 'Purchase Price' in operations and or detailed
operations
- You can change the price of the purchase order line from here

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:%20stock_move_purchase_price_update%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
-------

* Tecnativa

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

- `Tecnativa <https://www.tecnativa.com>`__:

- Carlos Dauden

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-carlosdauden| image:: https://github.com/carlosdauden.png?size=40px
:target: https://github.com/carlosdauden
:alt: carlosdauden

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

|maintainer-carlosdauden|

This module is part of the `OCA/purchase-workflow <https://github.com/OCA/purchase-workflow/tree/18.0/stock_move_purchase_price_update>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions stock_move_purchase_price_update/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
21 changes: 21 additions & 0 deletions stock_move_purchase_price_update/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2024 Tecnativa - Carlos Dauden
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Stock Move Purchase Price Update",
"summary": "Allow update purchase price from incoming picking operations",
"version": "18.0.1.0.0",
"development_status": "Beta",
"category": "stock",
"website": "https://github.com/OCA/purchase-workflow",
"author": "Tecnativa, Odoo Community Association (OCA)",
"maintainers": ["carlosdauden"],
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"purchase_stock",
],
"data": [
"views/stock_move_views.xml",
],
}
45 changes: 45 additions & 0 deletions stock_move_purchase_price_update/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_move_purchase_price_update
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-09-13 08:27+0000\n"
"PO-Revision-Date: 2024-09-13 10:30+0200\n"
"Last-Translator: Carlos Dauden <[email protected]>\n"
"Language-Team: none\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.0.1\n"

#. module: stock_move_purchase_price_update
#: model:ir.model.fields,field_description:stock_move_purchase_price_update.field_stock_move__is_purchase_price_editable
#: model:ir.model.fields,field_description:stock_move_purchase_price_update.field_stock_move_line__is_purchase_price_editable
msgid "Is Purchase Price Editable"
msgstr "Precio de compra es editable"

#. module: stock_move_purchase_price_update
#: model:ir.model,name:stock_move_purchase_price_update.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr "Movimientos de Producto (Stock Move Line)"

#. module: stock_move_purchase_price_update
#: model:ir.model.fields,field_description:stock_move_purchase_price_update.field_stock_move_line__purchase_line_id
msgid "Purchase Line"
msgstr "Línea de compra"

#. module: stock_move_purchase_price_update
#: model:ir.model.fields,field_description:stock_move_purchase_price_update.field_stock_move__purchase_price_unit
#: model:ir.model.fields,field_description:stock_move_purchase_price_update.field_stock_move_line__purchase_price_unit
msgid "Purchase price"
msgstr "Precio compra"

#. module: stock_move_purchase_price_update
#: model:ir.model,name:stock_move_purchase_price_update.model_stock_move
msgid "Stock Move"
msgstr "Movimiento de existencias"
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_move_purchase_price_update
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.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: stock_move_purchase_price_update
#: model:ir.model.fields,field_description:stock_move_purchase_price_update.field_stock_move__is_purchase_price_editable
#: model:ir.model.fields,field_description:stock_move_purchase_price_update.field_stock_move_line__is_purchase_price_editable
msgid "Is Purchase Price Editable"
msgstr ""

#. module: stock_move_purchase_price_update
#: model:ir.model,name:stock_move_purchase_price_update.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr ""

#. module: stock_move_purchase_price_update
#: model:ir.model.fields,field_description:stock_move_purchase_price_update.field_stock_move_line__purchase_line_id
msgid "Purchase Line"
msgstr ""

#. module: stock_move_purchase_price_update
#: model:ir.model.fields,field_description:stock_move_purchase_price_update.field_stock_move__purchase_price_unit
#: model:ir.model.fields,field_description:stock_move_purchase_price_update.field_stock_move_line__purchase_price_unit
msgid "Purchase price"
msgstr ""

#. module: stock_move_purchase_price_update
#: model:ir.model,name:stock_move_purchase_price_update.model_stock_move
msgid "Stock Move"
msgstr ""
4 changes: 4 additions & 0 deletions stock_move_purchase_price_update/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import stock_move
from . import stock_move_line
29 changes: 29 additions & 0 deletions stock_move_purchase_price_update/models/stock_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2024 Tecnativa - Carlos Dauden
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class StockMove(models.Model):
_inherit = "stock.move"

purchase_price_unit = fields.Float(
string="Purchase price",
compute="_compute_purchase_fields",
inverse="_inverse_purchase_price_unit",
digits="Product Price",
)
is_purchase_price_editable = fields.Boolean(
compute="_compute_purchase_fields",
)

@api.depends("purchase_line_id.price_unit", "purchase_line_id.qty_invoiced")
def _compute_purchase_fields(self):
for line in self:
line.purchase_price_unit = line.purchase_line_id.price_unit
line.is_purchase_price_editable = line.purchase_line_id.qty_invoiced == 0.0

# Use compute with inverse because related field don't save the value
def _inverse_purchase_price_unit(self):
for line in self:
line.purchase_line_id.price_unit = line.purchase_price_unit
36 changes: 36 additions & 0 deletions stock_move_purchase_price_update/models/stock_move_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 2024 Tecnativa - Carlos Dauden
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class StockMoveLine(models.Model):
_inherit = "stock.move.line"

purchase_line_id = fields.Many2one(
comodel_name="purchase.order.line",
compute="_compute_purchase_fields",
)
purchase_price_unit = fields.Float(
string="Purchase price",
compute="_compute_purchase_fields",
inverse="_inverse_purchase_price_unit",
digits="Product Price",
)
is_purchase_price_editable = fields.Boolean(
compute="_compute_purchase_fields",
)

@api.depends(
"move_id.purchase_line_id.price_unit", "move_id.purchase_line_id.qty_invoiced"
)
def _compute_purchase_fields(self):
for line in self:
line.purchase_line_id = line.move_id.purchase_line_id
line.purchase_price_unit = line.purchase_line_id.price_unit
line.is_purchase_price_editable = line.purchase_line_id.qty_invoiced == 0.0

# Use compute with inverse because related field don't save the value
def _inverse_purchase_price_unit(self):
for line in self:
line.move_id.purchase_line_id.price_unit = line.purchase_price_unit
3 changes: 3 additions & 0 deletions stock_move_purchase_price_update/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
5 changes: 5 additions & 0 deletions stock_move_purchase_price_update/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- Go to 'Inventory \> Configuration \> Operations' Types
- Select Reception operation
- Enable 'Show Detailed Operations' option.
- Go to Reception picking
- Add optional column 'Purchase price' in operations and/or detailed operations
2 changes: 2 additions & 0 deletions stock_move_purchase_price_update/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- [Tecnativa](https://www.tecnativa.com):
- Carlos Dauden
2 changes: 2 additions & 0 deletions stock_move_purchase_price_update/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Allow update purchase price from incoming picking operations, picking detailed
operations and picking batch detailed operations if the purchase order is not invoiced.
8 changes: 8 additions & 0 deletions stock_move_purchase_price_update/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- Go to Purchase \> Products \> Products and edit/create one
- Set Product Type as Storable Product
- Go to Purchase \> Orders \> Requests for Quotation
- Create new RQ with the previous product in the order lines
- Confirm the Purchase Order
- Now you have a new button called 'Receive Products' \> Press it
- Add optional column 'Purchase Price' in operations and or detailed operations
- You can change the price of the purchase order line from here
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading