diff --git a/models/acc_counter.py b/models/acc_counter.py index b1cfd2008c750299feddbea7ffe633c505fa3888..e8389fd09b127a30b4f65d81e0fa972373ac39bf 100644 --- a/models/acc_counter.py +++ b/models/acc_counter.py @@ -41,6 +41,11 @@ class AccCounter(models.Model): # compute='_compute_prod_annual') power_instal = fields.Float("Puissance de l'installation (en kW)") + buyer_id = fields.Many2one( + comodel_name='res.partner', + string="Acheteur de surplus", + domain="[('is_buyer_surplus', '=', True)]" + ) # ------------------------------------------------------ # SQL Constraints # ------------------------------------------------------ diff --git a/models/acc_operation.py b/models/acc_operation.py index 15a979284228ca6c16fadd98af3e3570e65e2b76..9f49e6225aa05b9d09b45fcd186f60d3ed7761c7 100644 --- a/models/acc_operation.py +++ b/models/acc_operation.py @@ -30,11 +30,6 @@ class AccOperation(models.Model): domain="[('is_pmo', '=', True)]", required=True ) - buyer_id = fields.Many2one( - comodel_name='res.partner', - string="Acheteur de surplus", - domain="[('is_buyer_surplus', '=', True)]" - ) acc_injection_ids = fields.One2many( comodel_name='acc.counter', inverse_name='acc_operation_id', diff --git a/views/acc_counter_views.xml b/views/acc_counter_views.xml index 9f813ee49e56cf43338bc56f61a538fafefc9f14..c43b524d324cf4eaa3124af326e96bbf4209b686 100644 --- a/views/acc_counter_views.xml +++ b/views/acc_counter_views.xml @@ -51,6 +51,7 @@ <field name="acc_operation_id" /> <field name="date_start_contract" /> <field name="date_end_contract" /> + <field name="buyer_id"/> </group> <group> <field name="partner_id" required="True"/> @@ -74,6 +75,7 @@ <field name="partner_id"/> <field name="city"/> <field name="zip"/> + <field name="buyer_id"/> </tree> </field> </record> diff --git a/views/acc_operation_views.xml b/views/acc_operation_views.xml index 3b671e950b08793127d60eab21be7cd88874c87a..bda01897b3051583d8b25fef172584621da8ab35 100644 --- a/views/acc_operation_views.xml +++ b/views/acc_operation_views.xml @@ -51,9 +51,6 @@ </group> <notebook> <page string="Points d'injection" name="injection"> - <group> - <field name="buyer_id"/> - </group> <field name="acc_injection_ids" widget="one2many" @@ -64,6 +61,7 @@ <field name="is_injection" invisible="1"/> <field name="name"/> <field name="partner_id" context="{'default_is_producer': True}"/> + <field name="buyer_id" context="{'default_is_buyer_surplus': True}"/> </tree> </field> </page>