summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-10-30 16:10:56 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-10-30 16:10:56 +0700
commit9206adc3ce8f5011b4b2e42c25a310419c1947d5 (patch)
tree397b2b4d360cb7d438728297a3943b9c3315de57
parent8710bda7da6915023f916d42df20a7b6df431b69 (diff)
cr bill pelunasan
-rwxr-xr-xindoteknik_custom/models/purchase_order.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index c24bdbb3..393fc562 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -121,11 +121,23 @@ class PurchaseOrder(models.Model):
data_line_bills = []
+ move_line = self.env['account.move.line'].search([
+ ('move_id', '=', self.bills_dp_id.id),
+ ('product_id', '=', product_dp.id),
+ ])
+
+ bills.message_post(
+ body=f"<div>"
+ f"<b>DP :</b><br>{move_line.price_unit}</div>",
+ subtype_id=self.env.ref("mail.mt_note").id
+ )
+
data_line_bills.append({
'move_id': bills.id,
'product_id': product_dp.id, # product down payment
'name': '[IT.121456] Down Payment', # product down payment
'account_id': 401, # Uang Muka persediaan barang dagang
+ # 'price_unit': move_line.price_unit,
'quantity': -1,
'product_uom_id': 1,
'tax_ids': [(5, 0, 0)] + [(4, tax.id) for tax in product_dp.taxes_id],
@@ -139,9 +151,11 @@ class PurchaseOrder(models.Model):
'name': self.name + ": " + line.product_id.display_name,
'account_id': 439, # Uang Muka persediaan barang dagang
'quantity': line.product_qty,
- 'price_unit': line.price_unit,
+ # 'price_unit': line.price_subtotal,
'product_uom_id': line.product_uom.id,
'tax_ids': [(5, 0, 0)] + [(4, tax.id) for tax in line.taxes_id],
+ 'purchase_line_id': line.id,
+ 'purchase_order_id': line[0].order_id.id,
})
bills_line = self.env['account.move.line'].create(data_line_bills)