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

[UPD] recalculate bamboos as well and update category accessory data

parent b8ac06f7
Branches
Étiquettes
2 requêtes de fusion!214.0 double paillage,!114.0 accessory
......@@ -11,6 +11,7 @@
ref="ap_sale_project.product_category_plantation_supply"
/>
<field name="name">Paillage</field>
<field name="accessory_label">Agrafes</field>
</record>
<record id="product_category_stake" model="product.category">
<field
......@@ -25,6 +26,7 @@
ref="ap_sale_project.product_category_plantation_supply"
/>
<field name="name">Protections Hautes</field>
<field name="accessory_label">Piquets</field>
</record>
<record id="product_category_protection_low" model="product.category">
<field
......@@ -32,6 +34,7 @@
ref="ap_sale_project.product_category_plantation_supply"
/>
<field name="name">Protections Basses</field>
<field name="accessory_label">Bambous</field>
</record>
<record id="product_category_marker" model="product.category">
<field
......
......@@ -580,7 +580,12 @@ class SaleIntervention(models.Model):
@api.onchange("low_protection_qty")
def _onchange_low_protection_qty(self):
self.bamboo_qty = self.low_protection_qty * 2
if self.low_protection_id.nb_accesories:
stake_multiplier = self.low_protection_id.nb_accesories
else:
stake_multiplier = 2
self.bamboo_qty = stake_multiplier * self.low_protection_qty
@api.constrains("plant_interval")
def _check_plant_interval(self):
......@@ -608,7 +613,8 @@ class SaleIntervention(models.Model):
_(
"La quantité de plants renseignée '%d' est différente de"
" la quantité de plants calculée '%d'.\n "
"Les quantités doivent être identiques, vérifier votre compositon."
"Les quantités doivent être identiques,"
" vérifier votre compositon."
)
% (rec.plant_qty, rec.plants_qty)
)
......@@ -676,6 +682,7 @@ class SaleIntervention(models.Model):
):
# We retrieve pricelist from subvention where
# intervention_type_id = our type of intervention
# ruff: noqa: B023
pricelist = rec.project_subvention_id.product_pricelist_ids.filtered(
lambda i: i.intervention_type_id == forfait
)[0]
......@@ -701,6 +708,7 @@ class SaleIntervention(models.Model):
# of all interventions of the same type
# Get all interventions of same type in the same project
# ruff: noqa: B023
interventions = self.project_id.intervention_ids.filtered(
lambda r: r.intervention_type_id == rec.intervention_type_id
)
......
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