Skip to content

Commit

Permalink
[ADD] purchase_stock_price_unit_sync (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
AungKoKoLin1997 authored Feb 14, 2024
1 parent 7305226 commit 54fb751
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 0 deletions.
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.

0 comments on commit 54fb751

Please sign in to comment.