Skip to content
Snippets Groups Projects
Commit 6467f996 authored by Rémi - Le Filament's avatar Rémi - Le Filament
Browse files

[FIX] do not remove lines not from interventions

parent 4bedb39f
Branches
Tags
No related merge requests found
...@@ -27,16 +27,17 @@ class SaleOrder(models.Model): ...@@ -27,16 +27,17 @@ class SaleOrder(models.Model):
# Business method # Business method
# ------------------------------------------------------ # ------------------------------------------------------
def clean_sale_order(self): def clean_sale_order(self):
current_inter = list() inter_list = list()
for project in self.sale_project_ids: for project in self.sale_project_ids:
for inter in project.intervention_ids: for inter in project.intervention_ids:
current_inter.append( inter_list.append(
(project.id, inter.intervention_type_id.product_variant_id.id) (project.id, inter.intervention_type_id.product_variant_id.id)
) )
for sol in self.order_line: for sol in self.order_line:
if ( if (
sol.product_id sol.sale_project_id
and (sol.sale_project_id.id, sol.product_id.id) not in current_inter and sol.product_id
and (sol.sale_project_id.id, sol.product_id.id) not in inter_list
): ):
sol.unlink() sol.unlink()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment