From 16c7165c62689fee3de98535d060eaeda44ab278 Mon Sep 17 00:00:00 2001
From: jordan <jordan@le-filament.com>
Date: Thu, 16 Dec 2021 12:48:49 +0100
Subject: [PATCH] [add] button to show ongoing invoice idf for partner
---
models/scop_cotisation_idf.py | 17 +++++++++++++++++
models/scop_invoice_idf.py | 17 +++++++++++++++++
views/scop_cotisation_idf.xml | 1 +
views/scop_invoice_idf.xml | 1 +
4 files changed, 36 insertions(+)
diff --git a/models/scop_cotisation_idf.py b/models/scop_cotisation_idf.py
index 0ab6eeb..4b544cd 100644
--- a/models/scop_cotisation_idf.py
+++ b/models/scop_cotisation_idf.py
@@ -212,3 +212,20 @@ class ScopCotisationsIDF(models.Model):
'target': 'current',
'res_id': self.invoice_id.id
}
+
+ def action_show_partner_invoice_idf(self):
+ form_view = self.env.ref(
+ 'cgscop_invoice_idf.view_scop_invoice_idf_form').id
+ tree_view = self.env.ref(
+ 'cgscop_invoice_idf.view_scop_invoice_idf_tree').id
+ return {
+ 'type': 'ir.actions.act_window',
+ 'name': 'Factures IDF - ' + self.partner_id.name,
+ 'views': [
+ [tree_view, "tree"], [form_view, "form"]
+ ],
+ 'view_mode': 'form',
+ 'res_model': 'scop.invoice.idf',
+ 'target': 'current',
+ 'domain': [('partner_id', '=', self.partner_id.id)]
+ }
diff --git a/models/scop_invoice_idf.py b/models/scop_invoice_idf.py
index f739515..deb5313 100644
--- a/models/scop_invoice_idf.py
+++ b/models/scop_invoice_idf.py
@@ -195,3 +195,20 @@ class ScopInvoiceIDF(models.Model):
'target': 'current',
'res_id': self.invoice_id.id
}
+
+ def action_show_partner_invoice_idf(self):
+ form_view = self.env.ref(
+ 'cgscop_invoice_idf.view_scop_invoice_idf_form').id
+ tree_view = self.env.ref(
+ 'cgscop_invoice_idf.view_scop_invoice_idf_tree').id
+ return {
+ 'type': 'ir.actions.act_window',
+ 'name': 'Factures IDF - ' + self.partner_id.name,
+ 'views': [
+ [tree_view, "tree"], [form_view, "form"]
+ ],
+ 'view_mode': 'form',
+ 'res_model': 'scop.invoice.idf',
+ 'target': 'current',
+ 'domain': [('partner_id', '=', self.partner_id.id)]
+ }
diff --git a/views/scop_cotisation_idf.xml b/views/scop_cotisation_idf.xml
index 0ee62ff..2a8578f 100644
--- a/views/scop_cotisation_idf.xml
+++ b/views/scop_cotisation_idf.xml
@@ -52,6 +52,7 @@
<form string="Cotisations IDF">
<sheet>
<div class="oe_button_box" name="button_box">
+ <button name="action_show_partner_invoice_idf" type="object" class="oe_stat_button" icon="fa-puzzle-piece">En cours</button>
<button name="action_show_payments" type="object" class="oe_stat_button" icon="fa-eur"
attrs="{'invisible': ['|', ('type', '!=', 'inv'), ('payments_ids', '=', False)]}">Paiments</button>
<button name="action_show_invoice" type="object" class="oe_stat_button" icon="fa-calculator"
diff --git a/views/scop_invoice_idf.xml b/views/scop_invoice_idf.xml
index 5d626a8..8bac0cd 100644
--- a/views/scop_invoice_idf.xml
+++ b/views/scop_invoice_idf.xml
@@ -50,6 +50,7 @@
<form string="Paiements IDF">
<sheet>
<div class="oe_button_box" name="button_box">
+ <button name="action_show_partner_invoice_idf" type="object" class="oe_stat_button" icon="fa-puzzle-piece">En cours</button>
<button name="action_show_payments" type="object" class="oe_stat_button" icon="fa-eur"
attrs="{'invisible': ['|', ('type', '!=', 'inv'), ('payments_ids', '=', False)]}">Paiments</button>
<button name="action_show_invoice" type="object" class="oe_stat_button" icon="fa-calculator"
--
GitLab