From 8caa4219ca959361df972ccca1c525328fdd183d Mon Sep 17 00:00:00 2001 From: Juliana Date: Tue, 17 Dec 2019 13:47:22 +0100 Subject: [PATCH] test 3 --- models/sale_order.py | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/models/sale_order.py b/models/sale_order.py index 408e2fd..c921e17 100644 --- a/models/sale_order.py +++ b/models/sale_order.py @@ -15,29 +15,34 @@ class SaleOrder(models.Model): @api.multi def action_invoice_create(self, grouped=False, final=False): - print("----- TEST ------") - return super(SaleOrder, self).action_invoice_create( + res = super(SaleOrder, self).action_invoice_create( grouped, final) - + print("----- TEST ------", str(res)) + return res + class SaleOrderLine(models.Model): _inherit = "sale.order.line" @api.multi def invoice_line_create(self, invoice_id, qty): - invoice_lines = self.env['account.invoice.line'] - for line in self: - # Check if line has a pack_parent_line_id - print("---- self.pack_parent_line_id.exists() -----", str(self.pack_parent_line_id.exists())) - if self.pack_parent_line_id.exists(): - # Get the ref of parent pack - sale_id_ref = self.env['sale.order.line'].search([('id', '=', self.pack_parent_line_id.id)]) - print("--- sale_id_ref ---", str(sale_id_ref)) - print("--- sale_id_ref.product_id.product_tmpl_id.pack_type ---", str(sale_id_ref.product_id.product_tmpl_id.pack_type)) - print("--- sale_id_ref.product_id.product_tmpl_id.pack_component_price ---", str(sale_id_ref.product_id.product_tmpl_id.pack_component_price)) - # Check if product is Pack detailed and option Totalized - if sale_id_ref.product_id.product_tmpl_id.pack_type == 'detailed' and sale_id_ref.product_id.product_tmpl_id.pack_component_price == 'totalized': - return invoice_lines invoice_lines = super(SaleOrderLine, self).invoice_line_create( invoice_id, qty) - return invoice_lines \ No newline at end of file + print("---- invoice_lines ----", str(invoice_lines)) + return invoice_lines + # invoice_lines = self.env['account.invoice.line'] + # for line in self: + # # Check if line has a pack_parent_line_id + # print("---- self.pack_parent_line_id.exists() -----", str(self.pack_parent_line_id.exists())) + # if self.pack_parent_line_id.exists(): + # # Get the ref of parent pack + # sale_id_ref = self.env['sale.order.line'].search([('id', '=', self.pack_parent_line_id.id)]) + # print("--- sale_id_ref ---", str(sale_id_ref)) + # print("--- sale_id_ref.product_id.product_tmpl_id.pack_type ---", str(sale_id_ref.product_id.product_tmpl_id.pack_type)) + # print("--- sale_id_ref.product_id.product_tmpl_id.pack_component_price ---", str(sale_id_ref.product_id.product_tmpl_id.pack_component_price)) + # # Check if product is Pack detailed and option Totalized + # if sale_id_ref.product_id.product_tmpl_id.pack_type == 'detailed' and sale_id_ref.product_id.product_tmpl_id.pack_component_price == 'totalized': + # return invoice_lines + # invoice_lines = super(SaleOrderLine, self).invoice_line_create( + # invoice_id, qty) + # return invoice_lines \ No newline at end of file