summaryrefslogtreecommitdiff
path: root/indoteknik_api/models
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-03-28 16:35:49 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-03-28 16:35:49 +0700
commit60d0b36cf33785c0cf6bea1d10b344dcdb37695a (patch)
tree7dfaea6f94277c94a3308cfecf0d4dcee015ab41 /indoteknik_api/models
parentd9f3333103ff3190c4c6ccf2365ccbb41cdb16b4 (diff)
fix API get transaction, invoice
Diffstat (limited to 'indoteknik_api/models')
-rw-r--r--indoteknik_api/models/account_move.py5
-rw-r--r--indoteknik_api/models/sale_order.py6
2 files changed, 11 insertions, 0 deletions
diff --git a/indoteknik_api/models/account_move.py b/indoteknik_api/models/account_move.py
index 9bbe8c94..54e06f84 100644
--- a/indoteknik_api/models/account_move.py
+++ b/indoteknik_api/models/account_move.py
@@ -37,6 +37,11 @@ class AccountMove(models.Model):
}
for line in account_move.invoice_line_ids:
product = self.env['product.product'].api_single_response(line.product_id)
+ product['price'] = {
+ 'price': line.price_unit,
+ 'discount_percentage': line.discount,
+ 'price_discount': line.price_unit - (line.price_unit * (line.discount/100))
+ }
product['quantity'] = line.quantity
data_with_detail['products'].append(product)
data.update(data_with_detail)
diff --git a/indoteknik_api/models/sale_order.py b/indoteknik_api/models/sale_order.py
index ca6baff0..76532d20 100644
--- a/indoteknik_api/models/sale_order.py
+++ b/indoteknik_api/models/sale_order.py
@@ -10,6 +10,7 @@ class SaleOrder(models.Model):
'id': sale_order.id,
'name': sale_order.name,
'sales': sale_order.user_id.name,
+ 'amount_tax': sale_order.amount_tax,
'amount_total': sale_order.amount_total,
'purchase_order_name': sale_order.partner_purchase_order_name,
'purchase_order_file': True if sale_order.partner_purchase_order_file else False,
@@ -56,6 +57,11 @@ class SaleOrder(models.Model):
}
for line in sale_order.order_line:
product = self.env['product.product'].api_single_response(line.product_id)
+ product['price'] = {
+ 'price': line.price_unit,
+ 'discount_percentage': line.discount,
+ 'price_discount': line.price_unit - (line.price_unit * (line.discount/100))
+ }
product['quantity'] = line.product_uom_qty
data_with_detail['products'].append(product)
for invoice in sale_order.invoice_ids: