From b4d093ac67f10891643fd580a0e673f00ef60162 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=81lvaro=20Garc=C3=ADa?= <alvarogruiz8@gmail.com>
Date: Wed, 19 Feb 2025 11:33:10 +0100
Subject: [PATCH] =?UTF-8?q?[IMP]=20=E2=9C=A8=20Change=20in=20a=20literal,?=
 =?UTF-8?q?=20hiding=20of=20a=20field=20and=20change=20in=20the=20from=20o?=
 =?UTF-8?q?f=20the=20selfconsumption=20mailing=20templates?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: Alvaro Garcia <alvaro.garcia@somit.coop>
---
 energy_selfconsumption/data/mail_template.xml             | 8 ++++----
 energy_selfconsumption/models/supply_point.py             | 2 +-
 energy_selfconsumption/views/distribution_table_views.xml | 1 +
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/energy_selfconsumption/data/mail_template.xml b/energy_selfconsumption/data/mail_template.xml
index c74f4cfdc..ed0e77167 100644
--- a/energy_selfconsumption/data/mail_template.xml
+++ b/energy_selfconsumption/data/mail_template.xml
@@ -4,7 +4,7 @@
         <record id="selfconsumption_energy_delivered_invoicing_reminder" model="mail.template">
             <field name="name">Selfconsumption Energy Delivered Invoicing Reminder</field>
             <field name="description">Email reminder for self-consumption billing of supplied energy</field>
-            <field name="email_from">info@somcomunitats.coop</field>
+            <field name="email_from">{{ (object.company_id.coop_email_contact or object.company_id.email_formatted) }}</field>
             <field name="subject">Selfconsumption - Energy Delivered Invoicing Reminder</field>
             <field name="model_id" ref="energy_selfconsumption.model_energy_selfconsumption_selfconsumption"/>
             <field name="body_html" type="html">
@@ -36,7 +36,7 @@
         <record id="selfconsumption_energy_delivered_custom_invoicing_reminder" model="mail.template">
             <field name="name">Selfconsumption Energy Delivered Custom Invoicing Reminder</field>
             <field name="description">E-mail reminder of personalized billing of self-consumption of energy supplied</field>
-            <field name="email_from">info@somcomunitats.coop</field>
+            <field name="email_from">{{ (object.company_id.coop_email_contact or object.company_id.email_formatted) }}</field>
             <field name="subject">Self-consumption billing reminder {{object.name}}</field>
             <field name="model_id" ref="energy_selfconsumption.model_energy_selfconsumption_selfconsumption"/>
             <field name="body_html" type="html">
@@ -78,7 +78,7 @@
         <record id="selfconsumption_power_acquired_invoicing_reminder" model="mail.template">
             <field name="name">Selfconsumption Power Acquired Invoicing Reminder</field>
             <field name="description">E-mail billing reminder of self-consumption of energy purchased</field>
-            <field name="email_from">info@somcomunitats.coop</field>
+            <field name="email_from">{{ (object.company_id.coop_email_contact or object.company_id.email_formatted) }}</field>
             <field name="subject">Selfconsumption - Power Acquired Invoicing Reminder</field>
             <field name="model_id" ref="energy_selfconsumption.model_energy_selfconsumption_selfconsumption"/>
             <field name="body_html" type="html">
@@ -104,7 +104,7 @@
         <record id="selfconsumption_insciption_form" model="mail.template">
             <field name="name">Registration in self-consumption project of the Energy Community</field>
             <field name="description">E-mail of inscription in the self-consumption project of the Energy Community</field>
-            <field name="email_from">info@somcomunitats.coop</field>
+            <field name="email_from">{{ (object.company_id.coop_email_contact or object.company_id.email_formatted) }}</field>
             <field name="subject">Registration in {{ object.name }}</field>
             <field name="model_id" ref="energy_selfconsumption.model_energy_selfconsumption_selfconsumption"/>
             <field name="body_html" type="html">
diff --git a/energy_selfconsumption/models/supply_point.py b/energy_selfconsumption/models/supply_point.py
index e690a7322..8c8a45f1c 100644
--- a/energy_selfconsumption/models/supply_point.py
+++ b/energy_selfconsumption/models/supply_point.py
@@ -96,7 +96,7 @@ class SupplyPoint(models.Model):
     def _compute_supply_point_name(self):
         for record in self:
             if record.partner_id and record.street:
-                record.name = f"{record.partner_id.name} - {record.street}"
+                record.name = f"{record.street}"
             else:
                 record.name = _("New Supply Point")
 
diff --git a/energy_selfconsumption/views/distribution_table_views.xml b/energy_selfconsumption/views/distribution_table_views.xml
index 0a00934b4..053ad6ce9 100644
--- a/energy_selfconsumption/views/distribution_table_views.xml
+++ b/energy_selfconsumption/views/distribution_table_views.xml
@@ -50,6 +50,7 @@
                   name="selfconsumption_project_id"
                   attrs="{'readonly': [('state', 'not in', ['draft'])]}"
                   options="{'no_create': True}"
+                  invisible="1"
                 />
                             </group>
                             <group>
-- 
GitLab