Skip to content
Extraits de code Groupes Projets
Valider 8f6586d4 rédigé par Rémi - Le Filament's avatar Rémi - Le Filament
Parcourir les fichiers

[IMP] Pre-Commit

parent 0b17ef6b
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -13,17 +13,19 @@ class SaleOrder(models.Model): ...@@ -13,17 +13,19 @@ class SaleOrder(models.Model):
def clean_sale_order(self): def clean_sale_order(self):
super(SaleOrder, self).clean_sale_order() super(SaleOrder, self).clean_sale_order()
sol_line_section = self.order_line.filtered( sol_line_section = self.order_line.filtered(
lambda s: s.display_type == 'line_section' and s.sale_project_id is not None lambda s: s.display_type == "line_section" and s.sale_project_id is not None
) )
for sol_section in sol_line_section: for sol_section in sol_line_section:
next_sol = False next_sol = False
for sol in self.order_line.sorted(key=lambda r: (r.sequence, r.id)): for sol in self.order_line.sorted(key=lambda r: (r.sequence, r.id)):
if sol.sequence > sol_section.sequence \ if sol.sequence > sol_section.sequence or (
or (sol.sequence == sol_section.sequence sol.sequence == sol_section.sequence and sol.id > sol_section.id
and sol.id > sol_section.id): ):
next_sol = sol next_sol = sol
break break
if not next_sol or\ if (
next_sol.sale_project_id != sol_section.sale_project_id \ not next_sol
or not next_sol.product_id: or next_sol.sale_project_id != sol_section.sale_project_id
or not next_sol.product_id
):
sol_section.unlink() sol_section.unlink()
...@@ -21,7 +21,7 @@ class SaleProject(models.Model): ...@@ -21,7 +21,7 @@ class SaleProject(models.Model):
vat_furniture_categ = ( vat_furniture_categ = (
self.env["product.category"].browse(furniture_categ_id.id).taxes_id self.env["product.category"].browse(furniture_categ_id.id).taxes_id
) )
lines = self.env['sale.intervention'].read_group( lines = self.env["sale.intervention"].read_group(
(("project_id", "=", self.id),), (("project_id", "=", self.id),),
("price", "intervention_length", "plant_qty"), ("price", "intervention_length", "plant_qty"),
"intervention_type_id", "intervention_type_id",
...@@ -89,9 +89,7 @@ class SaleProject(models.Model): ...@@ -89,9 +89,7 @@ class SaleProject(models.Model):
"product_uom_qty": quantity, "product_uom_qty": quantity,
"sale_project_id": self.id, "sale_project_id": self.id,
} }
sol_name = ( sol_name = "Projet " + self.name + " - " + product_tmpl.name
"Projet " + self.name + " - " + product_tmpl.name
)
sols.append( sols.append(
{ {
**data_sol_section, **data_sol_section,
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter