summaryrefslogtreecommitdiff
path: root/fixco_api/models
diff options
context:
space:
mode:
Diffstat (limited to 'fixco_api/models')
-rw-r--r--fixco_api/models/__init__.py1
-rw-r--r--fixco_api/models/sale.py25
2 files changed, 26 insertions, 0 deletions
diff --git a/fixco_api/models/__init__.py b/fixco_api/models/__init__.py
new file mode 100644
index 0000000..8a0dc04
--- /dev/null
+++ b/fixco_api/models/__init__.py
@@ -0,0 +1 @@
+from . import sale
diff --git a/fixco_api/models/sale.py b/fixco_api/models/sale.py
new file mode 100644
index 0000000..4c81fad
--- /dev/null
+++ b/fixco_api/models/sale.py
@@ -0,0 +1,25 @@
+from odoo import models
+
+
+class SaleOrder(models.Model):
+ _inherit = 'sale.order.line'
+
+ def api_single_response(self, line):
+ tax = 0
+ for taxes in line.tax_id:
+ tax = taxes.name
+ data = {
+ 'product_id': line.product_id.id,
+ 'product_name': line.product_id.name,
+ 'qty': line.product_uom_qty,
+ 'tax': tax,
+ 'price_unit': line.price_unit,
+ 'price_subtotal': line.price_subtotal,
+ 'price_tax': line.price_tax,
+ 'price_total': line.price_total,
+ 'price_reduce': line.price_reduce,
+ 'price_reduce_taxinc': line.price_reduce_taxinc,
+ 'price_reduce_taxexcl': line.price_reduce_taxexcl,
+ 'discount': line.discount,
+ }
+ return data