|
|
@ -27,7 +27,6 @@ class ProductTemplate(models.Model): |
|
|
|
for pack_line in template.pack_line_ids: |
|
|
|
pack_price_ref += pack_line.product_id.list_price |
|
|
|
template.list_price_ref_pack = pack_price_ref |
|
|
|
# template.list_price_ref_pack = template.pack_line_ids[0].product_id.list_price |
|
|
|
|
|
|
|
def _compute_price_ref_pack_compute(self): |
|
|
|
for template in self: |
|
|
@ -38,3 +37,25 @@ class ProductTemplate(models.Model): |
|
|
|
pack_price += pack_line.product_id.list_price * pack_line.quantity |
|
|
|
template.price_ref_pack_compute = pack_price |
|
|
|
|
|
|
|
@api.multi |
|
|
|
def website_publish_button(self): |
|
|
|
self.ensure_one() |
|
|
|
res = super(ProductTemplate, self).website_publish_button() |
|
|
|
# Dépublie les packs enfants si il en existe |
|
|
|
if self.used_in_pack_line_ids: |
|
|
|
for pack in self.used_in_pack_line_ids: |
|
|
|
pack.parent_product_id.write({'website_published': not self.website_published}) |
|
|
|
return res |
|
|
|
|
|
|
|
@api.multi |
|
|
|
def get_info_parent_pack(self): |
|
|
|
for pack in self: |
|
|
|
if pack.pack_line_ids: |
|
|
|
if pack.pack_ok and ( |
|
|
|
pack.pack_type == 'detailed' and pack.pack_component_price == 'totalized'): |
|
|
|
product_parent_id = pack.pack_line_ids[0].product_id |
|
|
|
pack.description_sale = product_parent_id.description_sale |
|
|
|
if product_parent_id.product_image_ids: |
|
|
|
pack.write({ |
|
|
|
'product_image_ids': [(6, 0, product_parent_id.product_image_ids.ids)] |
|
|
|
}) |