summaryrefslogtreecommitdiff
path: root/fixco_api/models/sale.py
blob: 4c81fad567fc88a4bc4000351dc049ed0c5e0cf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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