Skip to content
Extraits de code Groupes Projets
Valider 0b17ef6b rédigé par jordan's avatar jordan
Parcourir les fichiers

[update] remove useless line_section in sale_order

parent 8fd7c203
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -2,3 +2,4 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
from . import sale_project
from . import sale_order
# Copyright 2021 Le Filament (https://le-filament.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
from odoo import models
class SaleOrder(models.Model):
_inherit = "sale.order"
# ------------------------------------------------------
# Business method
# ------------------------------------------------------
def clean_sale_order(self):
super(SaleOrder, self).clean_sale_order()
sol_line_section = self.order_line.filtered(
lambda s: s.display_type == 'line_section' and s.sale_project_id is not None
)
for sol_section in sol_line_section:
next_sol = False
for sol in self.order_line.sorted(key=lambda r: (r.sequence, r.id)):
if sol.sequence > sol_section.sequence \
or (sol.sequence == sol_section.sequence
and sol.id > sol_section.id):
next_sol = sol
break
if not next_sol or\
next_sol.sale_project_id != sol_section.sale_project_id \
or not next_sol.product_id:
sol_section.unlink()
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