diff --git a/models/sale_intervention.py b/models/sale_intervention.py index f67e1d661ff7558b4b398691533cb5abb9178c34..393fbaed58f06a85ef359b7097ebf14db4c75cc0 100644 --- a/models/sale_intervention.py +++ b/models/sale_intervention.py @@ -154,7 +154,6 @@ class SaleIntervention(models.Model): related="mulch2_id.uom_id", readonly=True, string="Unité de mesure paillage 2", - states={"draft": [("readonly", False)], "sent": [("readonly", False)]}, ) mulch2_has_staples = fields.Boolean( string="Paillage 2 avec agrafes", @@ -194,7 +193,7 @@ class SaleIntervention(models.Model): readonly=True, states={"draft": [("readonly", False)], "sent": [("readonly", False)]}, ) - stake_qty = fields.Float( + stake_qty = fields.Integer( string="Qté Piquets", readonly=True, states={"draft": [("readonly", False)], "sent": [("readonly", False)]}, @@ -522,7 +521,7 @@ class SaleIntervention(models.Model): self.collarette_qty = ( math.ceil(self.intervention_length / self.plant_interval) + 1 ) - elif self.intervention_uom_name == "Unité": + elif self.intervention_uom_name == "Unité(s)": self.collarette_qty = self.plant_qty else: self.collarette_qty = 0 @@ -961,7 +960,10 @@ class SaleIntervention(models.Model): data.update( { "order_id": self.sale_order_id.id, - "name": self.project_id.name + " - " + product_tmpl.name, + "name": "Projet " + + self.project_id.name + + " - " + + product_tmpl.name, "product_id": product_tmpl.product_variant_id.id, "sale_project_id": self.project_id.id, } @@ -1004,7 +1006,6 @@ class SaleInterventionStock(models.Model): price_unit = fields.Float( "Prix Unitaire", required=True, digits="Product Price", default=0.0 ) - taxes_id = fields.Many2many(related="product_template_id.taxes_id") price_total = fields.Float( compute="_compute_amount", string="Total", diff --git a/models/sale_project.py b/models/sale_project.py index 322b38084e770616bc8a50b90b2bd07948093604..8e19983758c56c15971f08014e665853898a10b8 100644 --- a/models/sale_project.py +++ b/models/sale_project.py @@ -159,11 +159,7 @@ class SaleProject(models.Model): rec.geo_sector_id = rec.sale_order_id.partner_id.geo_sector_id.id seq = str(rec.sale_order_id.partner_id.sale_project_count).zfill(3) rec.name = ( - rec.sale_order_id.partner_id.ref - + "-" - + datetime.now().strftime("%y") - + "-" - + seq + rec.sale_order_id.partner_id.ref + "-" + rec.saison_id.name + "-" + seq ) def unlink(self): @@ -216,7 +212,7 @@ class SaleFinancialHelp(models.Model): _name = "sale.financial.help" _description = "Aide financière" - name = fields.Char("Aide financière") + name = fields.Char("Aide financière", required=True) class SaleProjectSuivi(models.Model): diff --git a/models/sale_project_subvention.py b/models/sale_project_subvention.py index c45493ee40f8f5235716f6de3439e337efcfcfc2..0b60d78383fdf7d68d6f020fcea048c89236f855 100644 --- a/models/sale_project_subvention.py +++ b/models/sale_project_subvention.py @@ -11,9 +11,11 @@ class ProjectSubvention(models.Model): # ------------------------------------------------------ # Fields declaration # ------------------------------------------------------ - name = fields.Char("Nom de la subvention") + name = fields.Char("Nom de la subvention", required=True) type = fields.Selection( - [("forfait", "Tarif unique"), ("grid", "Grille")], "Type de subvention" + [("forfait", "Tarif unique"), ("grid", "Grille")], + "Type de subvention", + required=True, ) product_pricelist_ids = fields.One2many( comodel_name="product.pricelist", diff --git a/views/sale_intervention_view.xml b/views/sale_intervention_view.xml index b13deb6d4fcf92cc544aace4819487eb6605d919..5c03bbb2967a3e9f6f89648afc4409e53c85f158 100644 --- a/views/sale_intervention_view.xml +++ b/views/sale_intervention_view.xml @@ -291,7 +291,7 @@ <field name="model">sale.intervention</field> <field name="arch" type="xml"> <tree string="Interventions" expand="True"> - <field name="name" 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" /> @@ -378,7 +378,9 @@ <field name="res_model">sale.intervention</field> <field name="view_mode">tree,form,pivot,graph</field> <field name="search_view_id" ref="sale_intervention_search" /> - <field name="context">{'search_default_group_by_order': True}</field> + <field + name="context" + >{"search_default_group_by_order": True, "create": False}</field> <field name="help" type="html"> <p class="o_view_nocontent_empty_folder"> Aucune intervention trouvée. Créez un nouveau projet depuis un devis diff --git a/views/sale_order_view.xml b/views/sale_order_view.xml index a653118f3d6eaee7f2c0d874cb010840874651f1..10ebe980163578e6c2e7a8704c6030bba8c67fa3 100644 --- a/views/sale_order_view.xml +++ b/views/sale_order_view.xml @@ -24,7 +24,7 @@ string="Projets" > <tree editable="bottom"> - <field name="name" optional="show" /> + <field name="name" optional="show" readonly="True" /> <field name="state" invisible="1" /> <field name="project_subvention_id" optional="show" /> <field name="user_id" optional="show" /> @@ -55,7 +55,12 @@ expr="//field[@name='order_line']/tree/field[@name='product_id']" position="before" > - <field name="sale_project_id" optional="show" string="Projet" /> + <field + name="sale_project_id" + optional="show" + string="Projet" + readonly="True" + /> </xpath> <page name="order_lines" position="after"> diff --git a/views/sale_project_view.xml b/views/sale_project_view.xml index 22bd41b016dd76fe4fc3e08084932ddeec97ce47..957b2758050b533b65d474dcfb90da4aa6e8ff34 100644 --- a/views/sale_project_view.xml +++ b/views/sale_project_view.xml @@ -67,7 +67,11 @@ context="{'search_default_group_by_intervention_type': True}" > <tree default_order="intervention_type_id,name"> - <field name="name" optional="show" /> + <field + name="name" + optional="show" + readonly="True" + /> <field name="state" invisible="1" /> <field name="intervention_type_id" @@ -102,7 +106,7 @@ <field name="model">sale.project</field> <field name="arch" type="xml"> <tree string="Projet de Création" create="false"> - <field name="name" optional="show" /> + <field name="name" optional="show" readonly="True" /> <field name="sale_order_id" optional="show" /> <field name="state" invisible="1" /> <field name="project_subvention_id" optional="show" />