diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-02-22 15:52:47 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-02-22 15:52:47 +0700 |
| commit | 73f5869798fc5ec69d84306139de55acaca06489 (patch) | |
| tree | a3436043447db0619bba3fa854b95474f9a3f463 /indoteknik_api/models | |
| parent | 2a5d4886d2924ef9dae451c841dc3bae9478f9ab (diff) | |
| parent | b9eddb17ac8eeed2b8af734844bb1149ec4184eb (diff) | |
Merge branch 'staging' of bitbucket.org:altafixco/indoteknik-addons into staging
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 |
