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

[ADD] rename interventions

parent aad1d93d
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -3,7 +3,7 @@
"summary": "Gestion de projet de création",
"author": "Le Filament",
"website": "https://le-filament.com",
"version": "14.0.2.0.0",
"version": "14.0.3.0.0",
"license": "AGPL-3",
"depends": ["product", "stock", "sale_management", "ap_partner"],
"data": [
......
# Copyright 2022 Le Filament (<http://www.le-filament.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import SUPERUSER_ID, api
def _init_sale_project_intervention_sequence(env):
for project in (
env["sale.project"]
.with_context(active_test=False)
.search([("intervention_ids", "!=", False)])
):
project.intervention_sequence = project.intervention_counter
def _rename_sale_intervention(env):
for inter in env["sale.intervention"].with_context(active_test=False).search([]):
substr = inter.project_id.name + "-"
updstr = inter.name.replace(substr, "Séquence ")
inter.name = updstr.replace("0", "")
def migrate(cr, version):
env = api.Environment(cr, SUPERUSER_ID, {})
_init_sale_project_intervention_sequence(env)
_rename_sale_intervention(env)
......@@ -956,8 +956,8 @@ class SaleIntervention(models.Model):
def create(self, vals_list):
res = super().create(vals_list)
for rec in res:
seq = str(rec.project_id.intervention_counter).zfill(3)
rec.name = rec.project_id.name + "-" + seq
rec.project_id.intervention_sequence += 1
rec.name = "Séquence " + str(rec.project_id.intervention_sequence)
return res
def write(self, values):
......
......@@ -146,6 +146,9 @@ class SaleProject(models.Model):
string="Nombre d'interventions",
compute_sudo="True",
)
intervention_sequence = fields.Integer(
string="Séquence d'interventions", default="0"
)
intervention_total_length = fields.Float(
compute="_compute_intervention_values",
string="Longeur interventions",
......
......@@ -10,11 +10,17 @@
<field name="arch" type="xml">
<form string="Intervention">
<sheet>
<div class="oe_title">
<h1>
<field name="name" readonly="1" />
<br />
Client : <field name="partner_id" readonly="1" />
</h1>
</div>
<group>
<field name="state" invisible="1" />
<field name="project_id" invisible="True" />
<field name="project_id" readonly="1" />
<field name="sale_order_id" invisible="True" />
<field name="partner_id" />
<field
name="intervention_type_id"
options="{'no_open': True, 'no_create': True}"
......@@ -288,10 +294,10 @@
<field name="model">sale.intervention</field>
<field name="arch" type="xml">
<tree string="Interventions" expand="True">
<field name="project_id" optional="show" />
<field name="name" optional="show" readonly="True" />
<field name="state" invisible="1" />
<field name="sale_order_id" optional="hide" />
<field name="project_id" optional="hide" />
<field name="partner_id" optional="show" />
<field name="intervention_type_id" optional="show" />
<field name="intervention_length" sum="Total" optional="show" />
......
......@@ -25,6 +25,13 @@
icon="fa-pagelines"
/>
</div>
<div class="oe_title">
<h1>
<field name="name" readonly="1" />
<br />
Client : <field name="partner_id" readonly="1" />
</h1>
</div>
<field name="sale_order_id" invisible="True" />
<group name="required_infos" string="Projet">
......
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