summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/purchase_order.py
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-01-22 16:58:11 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-01-22 16:58:11 +0700
commite5dbcd62560f4083d413d474b123ed971926a2a0 (patch)
tree050e1fbb121ae69a8be62dbd7baf3689e6540053 /indoteknik_custom/models/purchase_order.py
parent53d5d5869f62d73be785400c050b389efb10b511 (diff)
final fix bug purchase pricelist
Diffstat (limited to 'indoteknik_custom/models/purchase_order.py')
-rwxr-xr-xindoteknik_custom/models/purchase_order.py28
1 files changed, 15 insertions, 13 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index 7a575748..5303f2c3 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -104,18 +104,18 @@ class PurchaseOrder(models.Model):
i += 1
current_time = datetime.utcnow()
# print(i, len(self.order_line))
+
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 tax_include:
- price_unit = price_unit + (price_unit * tax_amt / 100)
- else:
- price_unit = price_unit + (price_unit * 11 / 100)
- else:
- price_unit = price_unit + (price_unit * 11 / 100)
+ # for tax in taxes:
+ # tax_include = tax.price_include
+ # if taxes:
+ # if tax_include:
+ # price_unit = price_unit
+ # else:
+ # price_unit = price_unit + (price_unit * 11 / 100)
+ # else:
+ # price_unit = price_unit + (price_unit * 11 / 100)
purchase_pricelist = self.env['purchase.pricelist'].search([
('product_id', '=', line.product_id.id),
@@ -126,13 +126,15 @@ class PurchaseOrder(models.Model):
purchase_pricelist.create([{
'vendor_id': line.order_id.partner_id.id,
'product_id': line.product_id.id,
- 'product_price': 0.00,
+ 'product_price': 0,
+ 'taxes_system_id': taxes.id,
'system_price': price_unit,
- 'system_last_update': current_time,
+ 'system_last_update': current_time
}])
else:
purchase_pricelist.write({
'system_last_update': current_time,
+ 'taxes_system_id': taxes.id,
'system_price': price_unit
})
@@ -303,7 +305,7 @@ class PurchaseOrder(models.Model):
if not self.sale_order_id and not self.env.user.is_purchasing_manager and not self.env.user.is_leader:
raise UserError("Tidak ada link dengan SO, harus approval Manager")
send_email = False
- # self.add_product_to_pricelist()
+ self.add_product_to_pricelist()
for line in self.order_line:
if not line.product_id.purchase_ok:
raise UserError("Terdapat barang yang tidak bisa diproses")