Skip to content
Snippets Groups Projects

[FIX] Energy_selfconsumption: Added street field to view and added web_m2x_options module to modify "many2one" fields giving new control options.

Merged emanuel buzey requested to merge bugfix/add_supply_point_address into dev
Files
6
from odoo import _, fields, models
from odoo import _, api, fields, models
class SupplyPoint(models.Model):
@@ -14,7 +14,7 @@ class SupplyPoint(models.Model):
)
}
name = fields.Char(required=True)
name = fields.Char(compute="_compute_supply_point_name", store=True)
code = fields.Char(string="CUPS", required=True)
owner_id = fields.Many2one(
"res.partner",
@@ -53,3 +53,11 @@ class SupplyPoint(models.Model):
"supply_point_id",
readonly=True,
)
@api.depends("owner_id", "street")
def _compute_supply_point_name(self):
for record in self:
if record.owner_id and record.street:
record.name = f"{record.owner_id.name} - {record.street}"
else:
record.name = _("New Supply Point")
Loading