diff --git a/__init__.py b/__init__.py
index 5685574..5d9341a 100755
--- a/__init__.py
+++ b/__init__.py
@@ -7,5 +7,7 @@ from .csv_profile import *
def register():
Pool.register(
+ CSVProfile,
+ CSVProfileParty,
CSVImport,
module='csv_import_getmail', type_='model')
diff --git a/csv_profile.py b/csv_profile.py
index 94f6cb9..c08e94a 100644
--- a/csv_profile.py
+++ b/csv_profile.py
@@ -3,12 +3,29 @@
# the full copyright notices and license terms.
from datetime import datetime
from trytond.pool import Pool, PoolMeta
+from trytond.model import ModelSQL, ModelView, fields
import logging
-__all__ = ['CSVImport']
+__all__ = ['CSVProfile', 'CSVProfileParty', 'CSVImport']
__metaclass__ = PoolMeta
+class CSVProfile(ModelSQL, ModelView):
+ __name__ = 'csv.profile'
+ parties = fields.Many2Many('csv.profile-party.party',
+ 'profile', 'party', 'Parties')
+
+
+class CSVProfileParty(ModelSQL):
+ 'Profile - Party'
+ __name__ = 'csv.profile-party.party'
+ _table = 'csv_profile_party_rel'
+ profile = fields.Many2One('csv.profile', 'CSV Profile', ondelete='CASCADE',
+ required=True, select=True)
+ party = fields.Many2One('party.party', 'Party',
+ ondelete='CASCADE', required=True, select=True)
+
+
class CSVImport:
__name__ = 'csv.import'
@@ -27,7 +44,7 @@ class CSVImport:
party, _ = GetMail.get_party_from_email(sender)
if not party:
continue
- csv_profiles = CSVProfile.search([('party', '=', party)])
+ csv_profiles = CSVProfile.search([('parties', 'in', [party])])
if not csv_profiles:
continue
csv_profile = csv_profiles[0]
diff --git a/csv_profile.xml b/csv_profile.xml
index 42504fd..28250cf 100644
--- a/csv_profile.xml
+++ b/csv_profile.xml
@@ -3,6 +3,12 @@
The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. -->
+
+ csv.profile
+
+ csv_profile_form
+
+
@@ -19,6 +25,7 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig
+
@@ -36,4 +43,4 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig
-
\ No newline at end of file
+
diff --git a/view/csv_profile_form.xml b/view/csv_profile_form.xml
new file mode 100644
index 0000000..35e76aa
--- /dev/null
+++ b/view/csv_profile_form.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+