From 7fedb124da4252d284f3665e2401f5b27680c04b Mon Sep 17 00:00:00 2001
From: Benjamin <benjamin@le-filament.com>
Date: Tue, 13 Apr 2021 16:59:47 +0200
Subject: [PATCH] [update] payment lines view

---
 models/account_payment_order.py | 20 +++++++++++++++++---
 views/account_payment_line.xml  |  6 +++---
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/models/account_payment_order.py b/models/account_payment_order.py
index dd14b13..d696758 100644
--- a/models/account_payment_order.py
+++ b/models/account_payment_order.py
@@ -4,11 +4,11 @@
 from odoo import fields, models, api
 
 
-class ModelName(models.Model):
+class AccountPaymentOrder(models.Model):
     _inherit = 'account.payment.order'
 
     payment_line_amount = fields.Float(
-        string='Total Transactions',
+        string='Total Opérations',
         compute='_compute_payment_line_amount'
     )
     bank_line_amount = fields.Float(
@@ -56,9 +56,23 @@ class ModelName(models.Model):
             'cgscop_cotisation.scop_account_payment_line_search').id
         return {
             'type': 'ir.actions.act_window',
-            'name': 'Lignes dde transaction',
+            'name': "Lignes d'opérations",
             'res_model': 'account.payment.line',
             'views': [[tree_id, 'tree']],
             'search_view_id': [search_id, 'search'],
             'domain': [['order_id', '=', self.id]],
+        }
+
+    def view_account_move(self):
+        tree_id = self.env.ref(
+            'cgscop_cotisation.scop_account_move_tree').id
+        search_id = self.env.ref(
+            'cgscop_cotisation.scop_account_move_search').id
+        return {
+            'type': 'ir.actions.act_window',
+            'name': "Pièces comptables de l'ordre de prélèvement",
+            'res_model': 'account.move',
+            'views': [[tree_id, 'tree'], [False, 'form']],
+            'search_view_id': [search_id, 'search'],
+            'domain': [['payment_order_id', '=', self.id]],
         }
\ No newline at end of file
diff --git a/views/account_payment_line.xml b/views/account_payment_line.xml
index 814d467..e176b5b 100644
--- a/views/account_payment_line.xml
+++ b/views/account_payment_line.xml
@@ -11,11 +11,11 @@
                 <tree string="Payment Lines" editable="top" create="0">
                     <field name="partner_id"/>
                     <field name="communication"/>
-                    <field name="partner_bank_id"/>
-                    <field name="mandate_id"/>
+                    <field name="partner_bank_id" domain="[('partner_id', '=', partner_id)]" options="{'no_create': 1}"/>
+                    <field name="mandate_id" domain="[('partner_id', '=', partner_id)]" options="{'no_create': 1}"/>
                     <field name="move_line_id" invisible="1"/>
                     <field name="ml_maturity_date"/>
-                    <field name="date"/>
+                    <field name="date" readonly="1"/>
                     <field name="amount_currency" string="Montant"/>
                     <field name="name"/>
                     <field name="amount_company_currency" sum="Total in Company Currency" invisible="1"/>
-- 
GitLab