summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/automatic_purchase.py
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-02-07 10:45:51 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-02-07 10:45:51 +0700
commitf6be42d37a363b86f4a9ec71ccb38c78cbe2d887 (patch)
tree9c297e776f67e35671012e94d3c64007bd5090d7 /indoteknik_custom/models/automatic_purchase.py
parentedb3c1c80931078d40a8f56149aeca9efdcdc07d (diff)
parent29a9ec94f1ad131f398cf119a03a7b927a4c6cba (diff)
Merge branch 'production' into purchasing-job
# Conflicts: # indoteknik_custom/__manifest__.py # indoteknik_custom/models/__init__.py # indoteknik_custom/models/automatic_purchase.py # indoteknik_custom/models/purchase_order_line.py # indoteknik_custom/security/ir.model.access.csv # indoteknik_custom/views/automatic_purchase.xml # indoteknik_custom/views/purchase_order.xml
Diffstat (limited to 'indoteknik_custom/models/automatic_purchase.py')
-rw-r--r--indoteknik_custom/models/automatic_purchase.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py
index 94dd9cdf..5919467f 100644
--- a/indoteknik_custom/models/automatic_purchase.py
+++ b/indoteknik_custom/models/automatic_purchase.py
@@ -68,8 +68,6 @@ class AutomaticPurchase(models.Model):
if self.is_po:
raise UserError('Sudah pernah di create PO')
- # self.validate_so_is_po()
-
current_time = datetime.now()
vendor_ids = self.env['automatic.purchase.line'].read_group(
[('automatic_purchase_id', '=', self.id), ('partner_id', '!=', False)],
@@ -389,7 +387,7 @@ class AutomaticPurchase(models.Model):
], order='count_trx_po desc, count_trx_po_vendor desc', limit=1)
vendor_id = purchase_price.vendor_id.id
- price = self._get_valid_purchase_price(purchase_price)
+ price, taxes = self._get_valid_purchase_price(purchase_price)
if self.vendor_id and self.vendor_id.id != vendor_id:
continue
@@ -405,6 +403,7 @@ class AutomaticPurchase(models.Model):
# 'last_price': po_line.price_unit,
'partner_id': vendor_id,
'last_price': price,
+ 'taxes_id': taxes,
'subtotal': qty_purchase * price,
'last_order_id': po_line.order_id.id,
'last_orderline_id': po_line.id,
@@ -420,12 +419,12 @@ class AutomaticPurchase(models.Model):
human_last_update = purchase_price.human_last_update or datetime.min
system_last_update = purchase_price.system_last_update or datetime.min
+ price = purchase_price.product_price
+ taxes = purchase_price.taxes_product_id.id
+
if system_last_update > human_last_update:
price = purchase_price.system_price
taxes = purchase_price.taxes_system_id.id
- else:
- price = purchase_price.product_price
- taxes = purchase_price.taxes_product_id.id
return price, taxes