diff options
Diffstat (limited to 'indoteknik_api/models')
| -rw-r--r-- | indoteknik_api/models/sale_order.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/indoteknik_api/models/sale_order.py b/indoteknik_api/models/sale_order.py index 398d1ef5..ca6baff0 100644 --- a/indoteknik_api/models/sale_order.py +++ b/indoteknik_api/models/sale_order.py @@ -63,3 +63,18 @@ class SaleOrder(models.Model): data_with_detail['invoices'].append(self.env['account.move'].api_v1_single_response(invoice)) data.update(data_with_detail) return data + + +class SaleOrderLine(models.Model): + _inherit = 'sale.order.line' + + def api_single_response(self, sale_order_line, context=False): + data = { + 'image': self.env['ir.attachment'].api_image('product.template', 'image_128', sale_order_line.product_id.product_tmpl_id.id), + 'item_code': sale_order_line.product_id.default_code, + 'product_name': sale_order_line.product_id.name, + 'price_before_discount': sale_order_line.price_unit * sale_order_line.product_uom_qty, + 'price_after_discount': sale_order_line.price_total, + 'tax': sale_order_line.price_tax + } + return data |
