From eae7d9566f36bda730c85d62b5b82d8e540e4621 Mon Sep 17 00:00:00 2001
From: Remi <remi@le-filament.com>
Date: Wed, 9 Oct 2019 12:17:10 +0200
Subject: [PATCH] Ajout types banque et incubateur

---
 datas/res.partner.organization.type.csv | 2 ++
 models/res_partner.py                   | 9 ++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/datas/res.partner.organization.type.csv b/datas/res.partner.organization.type.csv
index 3471281..3c804a4 100644
--- a/datas/res.partner.organization.type.csv
+++ b/datas/res.partner.organization.type.csv
@@ -39,6 +39,7 @@
 511,5,16552,"Mouvement entreprises sociales"
 512,5,14423,"Mutuelle"
 513,5,14427,"UDES"
+514,5,,"Incubateur"
 6,,14962,"Autre personne morale"
 601,6,14964,"Association"
 602,6,14963,"Entreprise"
@@ -74,3 +75,4 @@
 916,9,14823,"Pôle emploi"
 917,9,11758,"Profession Juridique"
 918,9,14412,"Syndicat de Salariés"
+919,9,,"Banque"
diff --git a/models/res_partner.py b/models/res_partner.py
index d87a510..5e0047a 100644
--- a/models/res_partner.py
+++ b/models/res_partner.py
@@ -150,7 +150,8 @@ class ScopPartner(models.Model):
     incubator_id = fields.Many2one(
         'res.partner',
         string='Incubateur',
-        domain=[('is_company', '=', True)],
+        domain=[('is_company', '=', True),
+                ('organization_subtype_id.name', '=', 'Incubateur')],
         on_delete='restrict')
     prescriber_canal_id = fields.Many2one(
         'res.partner.prescriber.canal',
@@ -174,12 +175,14 @@ class ScopPartner(models.Model):
     bank_id = fields.Many2one(
         'res.partner',
         string='Banque principale',
-        domain=[('is_company', '=', True)],
+        domain=[('is_company', '=', True),
+                ('organization_subtype_id.name', '=', 'Banque')],
         on_delete='restrict')
     bank2_id = fields.Many2one(
         'res.partner',
         string='Banque secondaire',
-        domain=[('is_company', '=', True)],
+        domain=[('is_company', '=', True),
+                ('organization_subtype_id.name', '=', 'Banque')],
         on_delete='restrict')
     accountant_id = fields.Many2one(
         'res.partner',
-- 
GitLab