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

[10.0][4268][ADD] purchase_stock_price_unit_sync #222

Merged
merged 1 commit into from
Feb 14, 2024
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
1 change: 1 addition & 0 deletions purchase_stock_price_unit_sync/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
12 changes: 12 additions & 0 deletions purchase_stock_price_unit_sync/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2024 Quartile Limited
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
'name': 'Showing actual received quantity of Purchase Order',
'version': '10.0.1.0.0',
'author': 'Quartile Limited',
'website': 'https://www.quartile.co',
'category': 'Purchase',
'license': "AGPL-3",
'depends': ['purchase'],
'installable': True,
}
1 change: 1 addition & 0 deletions purchase_stock_price_unit_sync/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import purchase_order_line
17 changes: 17 additions & 0 deletions purchase_stock_price_unit_sync/models/purchase_order_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2024 Quartile Limited
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api,models


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

@api.multi
def write(self, values):
res = super(PurchaseOrderLine, self).write(values)
lines = self.filtered(lambda l: l.order_id.state == 'purchase')
if 'price_unit' in values:
for line in lines:
moves = line.move_ids.filtered(lambda s: s.state not in ('cancel', 'done') and s.product_id == line.product_id)
moves.write({'price_unit': line._get_stock_move_price_unit()})
3 changes: 3 additions & 0 deletions purchase_stock_price_unit_sync/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This module updates the price_unit field of the stock move to match the price_unit
of the purchase order line when the price_unit is modified after the purchase order
has been confirmed.
Loading