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

[FIX] group intervention_type on sol

parent 2327a9ed
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -939,13 +939,25 @@ class SaleIntervention(models.Model):
# Business methods
# ------------------------------------------------------
def _update_order_lines(self):
product_tmpl = self.intervention_type_id
# group by intervention_type for current project
lines = self.read_group(
(("project_id", "=", self.project_id.id),),
("price", "intervention_length", "plant_qty"),
"intervention_type_id",
lazy=False,
)
for line in lines:
product_tmpl_id = line["intervention_type_id"][0]
product_tmpl = self.env["product.template"].browse(product_tmpl_id)
quantity = (
self.intervention_length if product_tmpl.uom_name == "m" else self.plant_qty
line["intervention_length"]
if product_tmpl.uom_name == "m"
else line["plant_qty"]
)
data = {}
if quantity != 0:
data = {
"price_unit": self.price / quantity,
"price_unit": line["price"] / quantity,
"product_uom_qty": quantity,
}
existing_lines = self.sale_order_id.order_line.filtered(
......
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