summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/purchase_order.py
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2023-10-20 10:17:52 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2023-10-20 10:17:52 +0700
commitd4be2f65948da27992841f99ffe1ff04b4de0194 (patch)
treee35365b0c47dd5646b8e0033fc2aa74fe835f4a0 /indoteknik_custom/models/purchase_order.py
parent956a77b7ad29af3620ee37e66c3b13de6a562deb (diff)
parent1e08cea66f4b4b3e4664f09986b1e41d0ba57830 (diff)
Merge branch 'production' of bitbucket.org:altafixco/indoteknik-addons into production
Diffstat (limited to 'indoteknik_custom/models/purchase_order.py')
-rwxr-xr-xindoteknik_custom/models/purchase_order.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index 5e4617d4..e8cd86fa 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -56,6 +56,14 @@ class PurchaseOrder(models.Model):
def add_product_to_pricelist(self):
for line in self.order_line:
current_time = datetime.utcnow()
+ price_unit = line.price_unit
+ taxes = line.taxes_id
+ for tax in taxes:
+ tax_include = tax.price_include
+ tax_amt = tax.amount
+ if taxes:
+ if not tax_include:
+ price_unit = price_unit + (price_unit * tax_amt / 100)
purchase_pricelist = self.env['purchase.pricelist'].search([
('product_id', '=', line.product_id.id),
@@ -67,7 +75,7 @@ class PurchaseOrder(models.Model):
'vendor_id': line.order_id.partner_id.id,
'product_id': line.product_id.id,
'product_price': 0.00,
- 'system_price': line.price_unit,
+ 'system_price': price_unit,
'system_last_update': current_time,
}])
return True
@@ -75,7 +83,7 @@ class PurchaseOrder(models.Model):
for pricelist in purchase_pricelist:
pricelist.write({
'system_last_update': current_time,
- 'system_price': line.price_unit
+ 'system_price': price_unit
})
def _compute_date_planned(self):