diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2024-05-29 14:56:48 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2024-05-29 14:56:48 +0700 |
| commit | f6bb7e8c0236c4a3b3c89101d13ca593d7170283 (patch) | |
| tree | 2a50f25903873a91a6a6ca76cc30800e69969db1 /fixco_api/models/sale.py | |
| parent | 0f700ade1d878e3b7031c8abc5f7d1bdb6ccaaf7 (diff) | |
add api get sale order
Diffstat (limited to 'fixco_api/models/sale.py')
| -rw-r--r-- | fixco_api/models/sale.py | 25 |
1 files changed, 25 insertions, 0 deletions
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 |
