summaryrefslogtreecommitdiff
path: root/indoteknik_api/models
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2023-03-31 14:01:35 +0700
committerstephanchrst <stephanchrst@gmail.com>2023-03-31 14:01:35 +0700
commit92ca4ca8d5e16a90c1cfa8d00248c1e12c95d9fd (patch)
tree2069fd0295c5538e8023dc7c3331e6470dd7acea /indoteknik_api/models
parent690903a2cc7a83e8ec2453a703241539016036b6 (diff)
parent4cbb23cd48f70788d440a55b552b6fa3be44ddfe (diff)
Merge branch 'release' of bitbucket.org:altafixco/indoteknik-addons into release
Diffstat (limited to 'indoteknik_api/models')
-rw-r--r--indoteknik_api/models/account_move.py5
-rw-r--r--indoteknik_api/models/product_product.py5
-rw-r--r--indoteknik_api/models/sale_order.py6
3 files changed, 16 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/product_product.py b/indoteknik_api/models/product_product.py
index f83ede27..284900de 100644
--- a/indoteknik_api/models/product_product.py
+++ b/indoteknik_api/models/product_product.py
@@ -19,6 +19,11 @@ class ProductProduct(models.Model):
'code': product_product.default_code or '',
'name': product_product.display_name,
'price': self.env['product.pricelist'].compute_price(product_pricelist_default_discount_id, product_product.id),
+ 'price': {
+ 'price': product_product._get_website_price_exclude_tax(),
+ 'discount_percentage': product_product._get_website_disc(0),
+ 'price_discount': product_product._get_website_price_after_disc_and_tax()
+ },
'stock': product_product.qty_stock_vendor,
'weight': product_product.weight,
'attributes': [x.name for x in product_product.product_template_attribute_value_ids],
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: