|
@ -13,6 +13,12 @@ class SaleOrder(models.Model): |
|
|
lambda t: not t.pack_parent_line_id.exists(), |
|
|
lambda t: not t.pack_parent_line_id.exists(), |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
@api.multi |
|
|
|
|
|
def action_invoice_create(self, grouped=False, final=False): |
|
|
|
|
|
print("----- TEST ------") |
|
|
|
|
|
return super(SaleOrder, self).action_invoice_create( |
|
|
|
|
|
grouped, final) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SaleOrderLine(models.Model): |
|
|
class SaleOrderLine(models.Model): |
|
|
_inherit = "sale.order.line" |
|
|
_inherit = "sale.order.line" |
|
@ -22,13 +28,13 @@ class SaleOrderLine(models.Model): |
|
|
invoice_lines = self.env['account.invoice.line'] |
|
|
invoice_lines = self.env['account.invoice.line'] |
|
|
for line in self: |
|
|
for line in self: |
|
|
# Check if line has a pack_parent_line_id |
|
|
# Check if line has a pack_parent_line_id |
|
|
print("self.pack_parent_line_id.exists()", str(self.pack_parent_line_id.exists())) |
|
|
|
|
|
|
|
|
print("---- self.pack_parent_line_id.exists() -----", str(self.pack_parent_line_id.exists())) |
|
|
if self.pack_parent_line_id.exists(): |
|
|
if self.pack_parent_line_id.exists(): |
|
|
# Get the ref of parent pack |
|
|
# Get the ref of parent pack |
|
|
sale_id_ref = self.env['sale.order.line'].search([('id', '=', self.pack_parent_line_id.id)]) |
|
|
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)) |
|
|
|
|
|
|
|
|
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 |
|
|
# 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': |
|
|
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 |
|
|
return invoice_lines |
|
|