diff --git a/models/res_partner.py b/models/res_partner.py index 55d7ac43870962f2716afb542cf67180443a7a6a..23f3de1105e51cfe70af00897951cecfaa9a7f05 100644 --- a/models/res_partner.py +++ b/models/res_partner.py @@ -48,11 +48,14 @@ class ResPartner(models.Model): # ------------------------------------------------------ def action_view_partner_projects(self): self.ensure_one() - action = self.env["ir.actions.actions"]._for_xml_id("ap_sale_project.action_sale_project") - action['domain'] = [ - ('partner_id', 'child_of', self.id), + action = self.env["ir.actions.actions"]._for_xml_id( + "ap_sale_project.action_sale_project" + ) + action["domain"] = [ + ("partner_id", "child_of", self.id), ] return action + # ------------------------------------------------------ # Business methods # ------------------------------------------------------ diff --git a/models/sale_order.py b/models/sale_order.py index 21484376292600ab5e96116eb34f64c92528fb2d..0b3ee2c60a8d26ea15e9dade2547c83d832d8287 100644 --- a/models/sale_order.py +++ b/models/sale_order.py @@ -30,9 +30,10 @@ class SaleOrder(models.Model): current_inter = list() for project in self.sale_project_ids: for inter in project.intervention_ids: - current_inter.append( - (project.id, inter.intervention_type_id.id)) + current_inter.append((project.id, inter.intervention_type_id.id)) for sol in self.order_line: - if sol.product_id and (sol.sale_project_id.id, sol.product_id.id)\ - not in current_inter: + if ( + sol.product_id + and (sol.sale_project_id.id, sol.product_id.id) not in current_inter + ): sol.unlink() diff --git a/models/sale_project.py b/models/sale_project.py index 42f21f47346f2d9e0a14f46186d6b1a4fd953489..d9b86b78853330ea87ee2d7ae57f9d801a479486 100644 --- a/models/sale_project.py +++ b/models/sale_project.py @@ -207,7 +207,7 @@ class SaleProject(models.Model): # ------------------------------------------------------ def update_order_lines(self): # group by intervention_type for current project - lines = self.env['sale.intervention'].read_group( + lines = self.env["sale.intervention"].read_group( (("project_id", "=", self.id),), ("price", "intervention_length", "plant_qty"), "intervention_type_id", @@ -239,10 +239,7 @@ class SaleProject(models.Model): data.update( { "order_id": self.sale_order_id.id, - "name": "Projet " - + self.name - + " - " - + product_tmpl.name, + "name": "Projet " + self.name + " - " + product_tmpl.name, "product_id": product_tmpl.product_variant_id.id, "sale_project_id": self.id, } diff --git a/views/res_partner_views.xml b/views/res_partner_views.xml index a1c90238dc162632f47f2337e9b1452ab9ef70b7..9e17f2c0f89c39b238d19ce24d9345f9655b6d69 100644 --- a/views/res_partner_views.xml +++ b/views/res_partner_views.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8" ?> <odoo> <data> @@ -8,8 +8,13 @@ <field name="inherit_id" ref="base.view_partner_form" /> <field name="arch" type="xml"> <div name="button_box" position="inside"> - <button type="object" class="oe_stat_button" icon="fa-pagelines" name="action_view_partner_projects" - context="{'default_partner_id': active_id}"> + <button + type="object" + class="oe_stat_button" + icon="fa-pagelines" + name="action_view_partner_projects" + context="{'default_partner_id': active_id}" + > <div class="o_form_field o_stat_info"> <span class="o_stat_value"> <field name="sale_project_count" /> @@ -25,13 +30,24 @@ <record model="ir.ui.view" id="partner_kanban_view_ap"> <field name="name">res.partner.kanban.ap.inherit</field> <field name="model">res.partner</field> - <field name="inherit_id" ref="base.res_partner_kanban_view"/> + <field name="inherit_id" ref="base.res_partner_kanban_view" /> <field name="arch" type="xml"> <field name="mobile" position="after"> - <field name="sale_project_count"/> + <field name="sale_project_count" /> </field> - <xpath expr="//span[hasclass('oe_kanban_partner_links')]" position="inside"> - <span t-if="record.sale_project_count.value>0" class="badge badge-pill"><i class="fa fa-pagelines" role="img" aria-label="Projets" title="Projets"/><t t-esc="record.sale_project_count.value"/></span> + <xpath + expr="//span[hasclass('oe_kanban_partner_links')]" + position="inside" + > + <span + t-if="record.sale_project_count.value>0" + class="badge badge-pill" + ><i + class="fa fa-pagelines" + role="img" + aria-label="Projets" + title="Projets" + /><t t-esc="record.sale_project_count.value" /></span> </xpath> </field> </record>