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

[ENH] Pre-Commit

parent 1b6a7d8f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -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
# ------------------------------------------------------
......@@ -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()
......@@ -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,
}
......
......@@ -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" />
......@@ -30,8 +35,19 @@
<field name="mobile" position="after">
<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>
......
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