Merge lp:~jfb-tempo-consulting/unifield-server/US-7941 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 5975
Proposed branch: lp:~jfb-tempo-consulting/unifield-server/US-7941
Merge into: lp:unifield-server
Diff against target: 545 lines (+193/-29)
12 files modified
bin/addons/msf_doc_import/purchase_order.py (+24/-8)
bin/addons/msf_profile/data/patches.xml (+5/-0)
bin/addons/msf_profile/msf_profile.py (+23/-0)
bin/addons/msf_tools/automated_export.py (+22/-6)
bin/addons/msf_tools/automated_export_data.xml (+1/-0)
bin/addons/msf_tools/automated_export_function.py (+2/-0)
bin/addons/msf_tools/automated_import.py (+75/-8)
bin/addons/msf_tools/automated_import_data.xml (+5/-1)
bin/addons/msf_tools/automated_import_function.py (+2/-0)
bin/addons/msf_tools/views/automated_export_view.xml (+16/-2)
bin/addons/msf_tools/views/automated_import_view.xml (+15/-3)
bin/osv/orm.py (+3/-1)
To merge this branch: bzr merge lp:~jfb-tempo-consulting/unifield-server/US-7941
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+401180@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/addons/msf_doc_import/purchase_order.py'
--- bin/addons/msf_doc_import/purchase_order.py 2020-12-14 16:49:10 +0000
+++ bin/addons/msf_doc_import/purchase_order.py 2021-04-15 08:08:32 +0000
@@ -65,12 +65,12 @@
65 return result65 return result
6666
67 def export_po(self, cr, uid, ids, context=None):67 def export_po(self, cr, uid, ids, context=None):
68 auto_job_ids = self.pool.get('automated.export').search(cr, uid, [('function_id.method_to_call', '=', 'auto_export_validated_purchase_order'), ('active', '=', True)], context=context)68 wiz = self.browse(cr, uid, ids[0], context)
69 auto_job_ids = self.pool.get('automated.export').search(cr, uid, [('function_id.method_to_call', '=', 'auto_export_validated_purchase_order'), ('active', '=', True), ('partner_id', '=', wiz.purchase_id.partner_id.id)], context=context)
69 if not auto_job_ids:70 if not auto_job_ids:
70 raise osv.except_osv(_('Warning'), _('The job to export PO is not active.'))71 raise osv.except_osv(_('Warning'), _('The job to export PO is not active.'))
7172
72 auto_job = self.pool.get('automated.export').browse(cr, uid, auto_job_ids[0], context=context)73 auto_job = self.pool.get('automated.export').browse(cr, uid, auto_job_ids[0], context=context)
73 wiz = self.browse(cr, uid, ids[0], context)
7474
7575
76 processed, rejected, trash = self.pool.get('purchase.order').auto_export_validated_purchase_order(cr, uid, auto_job, [wiz.purchase_id.id], context=context)76 processed, rejected, trash = self.pool.get('purchase.order').auto_export_validated_purchase_order(cr, uid, auto_job, [wiz.purchase_id.id], context=context)
@@ -126,11 +126,26 @@
126 for id in ids:126 for id in ids:
127 ret[id] = False127 ret[id] = False
128128
129 if not self.pool.get('automated.export').search_exist(cr, uid, [('function_id.method_to_call', '=', 'auto_export_validated_purchase_order'), ('active', '=', True)], context=context):129 if not ids:
130 return ret130 return {}
131131
132 for x in self.search(cr, uid, [('id', 'in', ids), ('partner_type', '=', 'esc'), ('state', 'in', ['validated', 'validated_p'])], context=context):132 cr.execute('''
133 ret[x] = True133 select o.id
134 from
135 purchase_order o, automated_export exp, automated_export_function fnct
136 where
137 o.id in %s and
138 o.partner_type = 'esc' and
139 o.state in ('validated', 'validated_p') and
140 o.partner_id = exp.partner_id and
141 exp.active = 't' and
142 exp.function_id = fnct.id and
143 fnct.method_to_call = 'auto_export_validated_purchase_order'
144 ''', (tuple(ids), ))
145
146 for x in cr.fetchall():
147 ret[x[0]] = True
148
134 return ret149 return ret
135150
136 _columns = {151 _columns = {
@@ -390,7 +405,8 @@
390 ('partner_type', '=', 'esc'),405 ('partner_type', '=', 'esc'),
391 ('state', 'in', ['validated', 'validated_p']),406 ('state', 'in', ['validated', 'validated_p']),
392 ('auto_exported_ok', '=', False),407 ('auto_exported_ok', '=', False),
393 ], context= context)408 ('partner_id', '=', export_wiz.partner_id.id),
409 ], context=context)
394410
395 if not po_ids:411 if not po_ids:
396 msg = _('No PO to export !')412 msg = _('No PO to export !')
397413
=== modified file 'bin/addons/msf_profile/data/patches.xml'
--- bin/addons/msf_profile/data/patches.xml 2021-02-04 16:31:58 +0000
+++ bin/addons/msf_profile/data/patches.xml 2021-04-15 08:08:32 +0000
@@ -647,5 +647,10 @@
647 <field name="method">us_6796_hide_prod_status_inconsistencies</field>647 <field name="method">us_6796_hide_prod_status_inconsistencies</field>
648 </record>648 </record>
649649
650 <!-- UF21.0 -->
651 <record id="us_7941_auto_vi_set_partner" model="patch.scripts">
652 <field name="method">us_7941_auto_vi_set_partner</field>
653 </record>
654
650 </data>655 </data>
651</openerp>656</openerp>
652657
=== modified file 'bin/addons/msf_profile/msf_profile.py'
--- bin/addons/msf_profile/msf_profile.py 2021-02-04 16:31:58 +0000
+++ bin/addons/msf_profile/msf_profile.py 2021-04-15 08:08:32 +0000
@@ -51,6 +51,29 @@
51 _defaults = {51 _defaults = {
52 'model': lambda *a: 'patch.scripts',52 'model': lambda *a: 'patch.scripts',
53 }53 }
54 # UF21.0
55 def us_7941_auto_vi_set_partner(self, cr, uid, *a, **b):
56 cr.execute('''
57 update automated_import imp set partner_id = (select id from res_partner where ref='APU' and partner_type='esc' LIMIT 1)
58 from automated_import_function function
59 where
60 function.id = imp.function_id and
61 imp.partner_id is null and
62 function.multiple='t'
63 ''')
64 self._logger.warn('APU set on %s VI import.' % (cr.rowcount,))
65
66 cr.execute('''
67 update automated_export exp set partner_id = (select id from res_partner where ref='APU' and partner_type='esc' LIMIT 1)
68 from automated_export_function function
69 where
70 function.id = exp.function_id and
71 exp.partner_id is null and
72 function.multiple='t'
73 ''')
74 self._logger.warn('APU set on %s VI export.' % (cr.rowcount,))
75
76 return True
5477
55 # UF20.078 # UF20.0
56 def us_7866_fill_in_target_cc_code(self, cr, uid, *a, **b):79 def us_7866_fill_in_target_cc_code(self, cr, uid, *a, **b):
5780
=== modified file 'bin/addons/msf_tools/automated_export.py'
--- bin/addons/msf_tools/automated_export.py 2020-09-18 13:38:52 +0000
+++ bin/addons/msf_tools/automated_export.py 2021-04-15 08:08:32 +0000
@@ -33,6 +33,16 @@
3333
34class automated_export(osv.osv):34class automated_export(osv.osv):
35 _name = 'automated.export'35 _name = 'automated.export'
36 _order = 'name, id'
37
38 def _auto_init(self, cr, context=None):
39 res = super(automated_export, self)._auto_init(cr, context)
40 # migration delete old constraint
41 cr.drop_constraint_if_exists('automated_export', 'automated_export_export_function_id_uniq')
42 cr.execute("SELECT indexname FROM pg_indexes WHERE indexname = 'automated_export_function_id_partner_id_uniq'")
43 if not cr.fetchone():
44 cr.execute("CREATE UNIQUE INDEX automated_export_function_id_partner_id_uniq ON automated_export (function_id, coalesce(partner_id, 0))")
45 return res
3646
37 _columns = {47 _columns = {
38 'name': fields.char(48 'name': fields.char(
@@ -77,6 +87,7 @@
77 required=True,87 required=True,
78 ),88 ),
79 'disable_cron': fields.related('function_id', 'disable_cron', string='Cron disabled', type='boolean', write_relate=False),89 'disable_cron': fields.related('function_id', 'disable_cron', string='Cron disabled', type='boolean', write_relate=False),
90 'multiple': fields.related('function_id', 'multiple', string='Multiple', type='boolean', write_relate=False),
80 'export_format': fields.selection(91 'export_format': fields.selection(
81 selection=[92 selection=[
82 ('excel', 'Excel'),93 ('excel', 'Excel'),
@@ -109,6 +120,7 @@
109 'ftp_dest_ok': fields.boolean(string='on FTP server', help='Is given path is located on FTP server ?'),120 'ftp_dest_ok': fields.boolean(string='on FTP server', help='Is given path is located on FTP server ?'),
110 'ftp_dest_fail_ok': fields.boolean(string='on FTP server', help='Is given path is located on FTP server ?'),121 'ftp_dest_fail_ok': fields.boolean(string='on FTP server', help='Is given path is located on FTP server ?'),
111 'ftp_report_ok': fields.boolean(string='on FTP server', help='Is given path is located on FTP server ?'),122 'ftp_report_ok': fields.boolean(string='on FTP server', help='Is given path is located on FTP server ?'),
123 'partner_id': fields.many2one('res.partner', 'Partner', domain=[('supplier', '=', True), ('partner_type', '=', 'esc')]),
112124
113 }125 }
114126
@@ -127,10 +139,11 @@
127 _('Another Automated export with same name already exists (maybe inactive). Automated export name must be unique. Please select an other name.'),139 _('Another Automated export with same name already exists (maybe inactive). Automated export name must be unique. Please select an other name.'),
128 ),140 ),
129 (141 (
130 'export_function_id_uniq',142 # declared in _auto_init
131 'unique(function_id)',143 'function_id_partner_id_uniq',
132 _('Another Automated export with same functionality already exists (maybe inactive). Only one automated export must be created for a '\144 '',
133 'same functionality. Please select an other functionality.'),145 _('Another Automated export with same functionality and same partner already exists (maybe inactive). Only one automated export must be created for a '\
146 'same functionality and partner.'),
134 ),147 ),
135 (148 (
136 'export_positive_interval',149 'export_positive_interval',
@@ -141,9 +154,12 @@
141154
142 def change_function_id(self, cr, uid, ids, function_id, context=None):155 def change_function_id(self, cr, uid, ids, function_id, context=None):
143 disable_cron = False156 disable_cron = False
157 multiple = False
144 if function_id:158 if function_id:
145 disable_cron = self.pool.get('automated.export.function').browse(cr, uid, function_id, context=context).disable_cron159 fct_data = self.pool.get('automated.export.function').browse(cr, uid, function_id, context=context)
146 return {'value': {'disable_cron': disable_cron}}160 disable_cron = fct_data.disable_cron
161 multiple = fct_data.multiple
162 return {'value': {'disable_cron': disable_cron, 'multiple': multiple}}
147163
148 def onchange_ftp_ok(self, cr, uid, ids, ftp_ok, context=None):164 def onchange_ftp_ok(self, cr, uid, ids, ftp_ok, context=None):
149 if context is None:165 if context is None:
150166
=== modified file 'bin/addons/msf_tools/automated_export_data.xml'
--- bin/addons/msf_tools/automated_export_data.xml 2020-09-18 10:39:31 +0000
+++ bin/addons/msf_tools/automated_export_data.xml 2021-04-15 08:08:32 +0000
@@ -5,6 +5,7 @@
5 <field name="name">Export validated Purchase Order</field>5 <field name="name">Export validated Purchase Order</field>
6 <field name="model_id" model="ir.model" search="[('model', '=', 'purchase.order')]" />6 <field name="model_id" model="ir.model" search="[('model', '=', 'purchase.order')]" />
7 <field name="method_to_call">auto_export_validated_purchase_order</field>7 <field name="method_to_call">auto_export_validated_purchase_order</field>
8 <field name="multiple" eval="True" />
8 </record>9 </record>
9 <record id="auto_export_fnct_oca_finance_vi" model="automated.export.function">10 <record id="auto_export_fnct_oca_finance_vi" model="automated.export.function">
10 <field name="name">Export to HQ system (OCA) - Not yet exported</field>11 <field name="name">Export to HQ system (OCA) - Not yet exported</field>
1112
=== modified file 'bin/addons/msf_tools/automated_export_function.py'
--- bin/addons/msf_tools/automated_export_function.py 2020-09-18 10:39:31 +0000
+++ bin/addons/msf_tools/automated_export_function.py 2021-04-15 08:08:32 +0000
@@ -45,11 +45,13 @@
45 required=True,45 required=True,
46 ),46 ),
47 'disable_cron': fields.boolean('No cron'),47 'disable_cron': fields.boolean('No cron'),
48 'multiple': fields.boolean('Allow multiple jobs'),
48 }49 }
4950
50 _defaults = {51 _defaults = {
51 'method_to_call': lambda *a: 'export_data_from_csv',52 'method_to_call': lambda *a: 'export_data_from_csv',
52 'disable_cron': False,53 'disable_cron': False,
54 'multiple': False,
53 }55 }
5456
55 _order = 'name'57 _order = 'name'
5658
=== modified file 'bin/addons/msf_tools/automated_import.py'
--- bin/addons/msf_tools/automated_import.py 2020-10-20 12:50:50 +0000
+++ bin/addons/msf_tools/automated_import.py 2021-04-15 08:08:32 +0000
@@ -33,6 +33,16 @@
3333
34class automated_import(osv.osv):34class automated_import(osv.osv):
35 _name = 'automated.import'35 _name = 'automated.import'
36 _order = 'name, id'
37
38 def _auto_init(self, cr, context=None):
39 res = super(automated_import, self)._auto_init(cr, context)
40 # migration delete old constraint
41 cr.drop_constraint_if_exists('automated_import', 'automated_import_import_function_id_uniq')
42 cr.execute("SELECT indexname FROM pg_indexes WHERE indexname = 'automated_import_function_id_partner_id_uniq'")
43 if not cr.fetchone():
44 cr.execute("CREATE UNIQUE INDEX automated_import_function_id_partner_id_uniq ON automated_import (function_id, coalesce(partner_id, 0))")
45 return res
3646
37 def _check_paths(self, cr, uid, ids, context=None):47 def _check_paths(self, cr, uid, ids, context=None):
38 """48 """
@@ -73,6 +83,44 @@
7383
74 return True84 return True
7585
86 def _check_unicity(self, cr, uid, ids, context=None):
87 '''
88 if the function_id allows multiple then the server / src_path must be unique
89 if not multiple: then function_id must be unique
90 '''
91
92 error = []
93 cr.execute('''
94 select function.name
95 from automated_import import, automated_import_function function
96 where
97 function.id = import.function_id and
98 coalesce(function.multiple, 'f') = 'f'
99 group by function.name
100 having(count(*) > 1)
101 ''')
102 for x in cr.fetchall():
103 error.append(_('Another Automated import with same functionality "%s" already exists (maybe inactive). Only one automated import must be created for a '\
104 'same functionality. Please select an other functionality.') % x[0])
105
106 cr.execute('''
107 select function.name
108 from automated_import import, automated_import_function function
109 where
110 function.id = import.function_id and
111 coalesce(function.multiple, 'f') = 't' and
112 coalesce(src_path, '') != ''
113 group by function.name, src_path, ftp_url
114 having(count(*) > 1)
115 ''')
116 for x in cr.fetchall():
117 error.append(_('Another Automated import with same functionality "%s", same server and same source already exists (maybe inactive).') % x[0])
118
119 if error:
120 raise osv.except_osv(_('Warning'), "\n".join(error))
121
122 return True
123
76 def _get_isadmin(self, cr, uid, ids, *a, **b):124 def _get_isadmin(self, cr, uid, ids, *a, **b):
77 ret = {}125 ret = {}
78 for _id in ids:126 for _id in ids:
@@ -123,6 +171,7 @@
123 string='Functionality',171 string='Functionality',
124 required=True,172 required=True,
125 ),173 ),
174 'multiple': fields.related('function_id', 'multiple', string='Multiple', type='boolean', write_relate=False),
126 'active': fields.boolean(175 'active': fields.boolean(
127 string='Active',176 string='Active',
128 readonly=True,177 readonly=True,
@@ -149,6 +198,7 @@
149 'ftp_dest_fail_ok': fields.boolean(string='on FTP server', help='Is given path is located on FTP server ?'),198 'ftp_dest_fail_ok': fields.boolean(string='on FTP server', help='Is given path is located on FTP server ?'),
150 'ftp_report_ok': fields.boolean(string='on FTP server', help='Is given path is located on FTP server ?'),199 'ftp_report_ok': fields.boolean(string='on FTP server', help='Is given path is located on FTP server ?'),
151 'is_admin': fields.function(_get_isadmin, method=True, type='boolean', string='Is Admin'),200 'is_admin': fields.function(_get_isadmin, method=True, type='boolean', string='Is Admin'),
201 'partner_id': fields.many2one('res.partner', 'Partner', domain=[('partner_type', '=', 'esc')]),
152 }202 }
153203
154 _defaults = {204 _defaults = {
@@ -167,10 +217,9 @@
167 _('Another Automated import with same name already exists (maybe inactive). Automated import name must be unique. Please select an other name.'),217 _('Another Automated import with same name already exists (maybe inactive). Automated import name must be unique. Please select an other name.'),
168 ),218 ),
169 (219 (
170 'import_function_id_uniq',220 'function_id_partner_id_uniq',
171 'unique(function_id)',221 '',
172 _('Another Automated import with same functionality already exists (maybe inactive). Only one automated import must be created for a '\222 _('Another Automated import with same function / same partner already exists (maybe inactive).'),
173 'same functionality. Please select an other functionality.'),
174 ),223 ),
175 (224 (
176 'import_positive_interval',225 'import_positive_interval',
@@ -181,8 +230,20 @@
181230
182 _constraints = [231 _constraints = [
183 (_check_paths, _('There is a problem with paths'), ['active', 'src_path', 'dest_path', 'report_path', 'dest_path_failure']),232 (_check_paths, _('There is a problem with paths'), ['active', 'src_path', 'dest_path', 'report_path', 'dest_path_failure']),
233 (_check_unicity, _('There is a problem with paths'), []),
184 ]234 ]
185235
236 def change_function_id(self, cr, uid, ids, function_id, context=None):
237 multiple = False
238 value = {}
239 if function_id:
240 fct_data = self.pool.get('automated.import.function').browse(cr, uid, function_id, context=context)
241 multiple = fct_data.multiple
242 if not multiple:
243 value['partner_id'] = False
244 value['multiple'] = multiple
245 return {'value': value}
246
186 def onchange_ftp_ok(self, cr, uid, ids, ftp_ok, context=None):247 def onchange_ftp_ok(self, cr, uid, ids, ftp_ok, context=None):
187 if context is None:248 if context is None:
188 context = {}249 context = {}
@@ -290,14 +351,20 @@
290351
291 main_path = os.path.join(config.get('root_path'), 'vi_auto_import')352 main_path = os.path.join(config.get('root_path'), 'vi_auto_import')
292 write_me = {'ftp_source_ok': False, 'ftp_dest_ok': False, 'ftp_dest_fail_ok': False, 'ftp_report_ok': False, 'ftp_ok': False, 'active': True, 'interval_unit': 'months', 'interval': 12}353 write_me = {'ftp_source_ok': False, 'ftp_dest_ok': False, 'ftp_dest_fail_ok': False, 'ftp_report_ok': False, 'ftp_ok': False, 'active': True, 'interval_unit': 'months', 'interval': 12}
354
355 prefix = ''
356 for job in self.browse(cr, uid, ids, fields_to_fetch=['name', 'function_id'], context=context):
357 if job.function_id.multiple:
358 num = self.search(cr, uid, [('function_id', '=', job.function_id.id), ('active', 'in', ['t', 'f'])], count=True, context=context)
359 if num > 1:
360 prefix = num
361 self.log(cr, uid, job.id, 'Auto configuration done on job %s' % job.name)
362
293 for directory in ['src_path', 'dest_path', 'dest_path_failure', 'report_path']:363 for directory in ['src_path', 'dest_path', 'dest_path_failure', 'report_path']:
294 target = os.path.join(main_path, directory)364 target = os.path.join(main_path, '%s%s' % (directory, prefix))
295 write_me[directory] = target365 write_me[directory] = target
296 if not os.path.exists(target):366 if not os.path.exists(target):
297 os.makedirs(target)367 os.makedirs(target)
298
299 for job in self.read(cr, uid, ids, ['name'], context=context):
300 self.log(cr, uid, job['id'], 'Auto configuration done on job %s' % job['name'])
301 self.write(cr, uid, ids, write_me, context=context)368 self.write(cr, uid, ids, write_me, context=context)
302 return True369 return True
303370
304371
=== modified file 'bin/addons/msf_tools/automated_import_data.xml'
--- bin/addons/msf_tools/automated_import_data.xml 2018-03-29 07:34:43 +0000
+++ bin/addons/msf_tools/automated_import_data.xml 2021-04-15 08:08:32 +0000
@@ -61,6 +61,7 @@
61 <field name="model_id" model="ir.model" search="[('model', '=', 'supplier.catalogue')]" />61 <field name="model_id" model="ir.model" search="[('model', '=', 'supplier.catalogue')]" />
62 <field name="method_to_call">auto_import</field>62 <field name="method_to_call">auto_import</field>
63 <field name="startswith">SCL_</field>63 <field name="startswith">SCL_</field>
64 <field name="multiple" eval="True" />
64 </record>65 </record>
6566
66 <record id="auto_import_fnct_product_list" model="automated.import.function">67 <record id="auto_import_fnct_product_list" model="automated.import.function">
@@ -75,6 +76,7 @@
75 <field name="model_id" model="ir.model" search="[('model', '=', 'stock.picking')]" />76 <field name="model_id" model="ir.model" search="[('model', '=', 'stock.picking')]" />
76 <field name="method_to_call">auto_import_incoming_shipment</field>77 <field name="method_to_call">auto_import_incoming_shipment</field>
77 <field name="startswith">SHPM_</field>78 <field name="startswith">SHPM_</field>
79 <field name="multiple" eval="True" />
78 </record>80 </record>
7981
80 <record id="auto_import_fnct_purchase_order" model="automated.import.function">82 <record id="auto_import_fnct_purchase_order" model="automated.import.function">
@@ -82,13 +84,15 @@
82 <field name="model_id" model="ir.model" search="[('model', '=', 'purchase.order')]" />84 <field name="model_id" model="ir.model" search="[('model', '=', 'purchase.order')]" />
83 <field name="method_to_call">auto_import_purchase_order</field>85 <field name="method_to_call">auto_import_purchase_order</field>
84 <field name="startswith">POV_</field>86 <field name="startswith">POV_</field>
87 <field name="multiple" eval="True" />
85 </record>88 </record>
86 89
87 <record id="auto_import_fnct_confirmed_purchase_order" model="automated.import.function">90 <record id="auto_import_fnct_confirmed_purchase_order" model="automated.import.function">
88 <field name="name">Import Purchase Order and confirm</field>91 <field name="name">Import Purchase Order and confirm</field>
89 <field name="model_id" model="ir.model" search="[('model', '=', 'purchase.order')]" />92 <field name="model_id" model="ir.model" search="[('model', '=', 'purchase.order')]" />
90 <field name="method_to_call">auto_import_confirmed_purchase_order</field>93 <field name="method_to_call">auto_import_confirmed_purchase_order</field>
91 <field name="startswith">POV_</field>94 <field name="startswith">POV_</field>
95 <field name="multiple" eval="True" />
92 </record>96 </record>
9397
94 <record id="auto_import_fnct_product_categories" model="automated.import.function">98 <record id="auto_import_fnct_product_categories" model="automated.import.function">
9599
=== modified file 'bin/addons/msf_tools/automated_import_function.py'
--- bin/addons/msf_tools/automated_import_function.py 2018-03-29 07:34:43 +0000
+++ bin/addons/msf_tools/automated_import_function.py 2021-04-15 08:08:32 +0000
@@ -45,10 +45,12 @@
45 required=True,45 required=True,
46 ),46 ),
47 'startswith': fields.char('Starts with', size=56),47 'startswith': fields.char('Starts with', size=56),
48 'multiple': fields.boolean('Allow multiple jobs'),
48 }49 }
4950
50 _defaults = {51 _defaults = {
51 'method_to_call': lambda *a: 'import_data_from_csv',52 'method_to_call': lambda *a: 'import_data_from_csv',
53 'multiple': False,
52 }54 }
5355
54 _order = 'name'56 _order = 'name'
5557
=== modified file 'bin/addons/msf_tools/views/automated_export_view.xml'
--- bin/addons/msf_tools/views/automated_export_view.xml 2020-09-18 10:39:31 +0000
+++ bin/addons/msf_tools/views/automated_export_view.xml 2021-04-15 08:08:32 +0000
@@ -8,9 +8,16 @@
8 <field name="type">search</field>8 <field name="type">search</field>
9 <field name="arch" type="xml">9 <field name="arch" type="xml">
10 <search string="Automated exports">10 <search string="Automated exports">
11 <filter name="inactive" domain="[('active', '=', False)]" string="Inactive" icon="gtk-undo" />11 <filter icon="terp-check" name="filteractive" string="Active" domain="[('active', '=', True)]" />
12 <filter icon="gtk-dialog-error" name="filterinactive" string="Inactive" domain="[('active', '=', False)]" />
12 <field name="name" />13 <field name="name" />
13 <field name="function_id" />14 <field name="function_id" />
15 <field name="partner_id" />
16 <newline />
17 <group expand="1" string="Group By..." colspan="4" col="4">
18 <filter string="Partner" name="groupby_partner_id" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
19 <filter string="Function" name="groupby_function_id" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'function_id'}"/>
20 </group>
14 </search>21 </search>
15 </field>22 </field>
16 </record>23 </record>
@@ -20,12 +27,14 @@
20 <field name="model">automated.export</field>27 <field name="model">automated.export</field>
21 <field name="type">tree</field>28 <field name="type">tree</field>
22 <field name="arch" type="xml">29 <field name="arch" type="xml">
23 <tree string="Automated exports">30 <tree string="Automated exports" colors="red: not active">
24 <field name="name" />31 <field name="name" />
25 <field name="function_id" />32 <field name="function_id" />
33 <field name="partner_id" />
26 <field name="start_time" />34 <field name="start_time" />
27 <field name="interval" />35 <field name="interval" />
28 <field name="interval_unit" />36 <field name="interval_unit" />
37 <field name="active" />
29 </tree>38 </tree>
30 </field>39 </field>
31 </record>40 </record>
@@ -41,10 +50,14 @@
41 <field name="function_id" widget="selection" on_change="change_function_id(function_id)"/>50 <field name="function_id" widget="selection" on_change="change_function_id(function_id)"/>
42 <field name="active" />51 <field name="active" />
43 <field name="export_format" attrs="{'invisible': [('disable_cron', '=', True)]}"/>52 <field name="export_format" attrs="{'invisible': [('disable_cron', '=', True)]}"/>
53 <label colspan="2" />
54 <field name="partner_id" attrs="{'invisible': [('multiple', '=', False)], 'required': [('multiple', '=', True)]}"/>
55 <newline />
44 <button name="run_job_manually" string="Run job manually" colspan="2" type="object" icon="gtk-execute" />56 <button name="run_job_manually" string="Run job manually" colspan="2" type="object" icon="gtk-execute" />
45 <button name="sent_to_remote" string="Manually send to FTP" colspan="2" type="object" icon="cloud.png" attrs="{'invisible': ['|', ('disable_cron', '=', False), ('ftp_ok', '=', False)]}" />57 <button name="sent_to_remote" string="Manually send to FTP" colspan="2" type="object" icon="cloud.png" attrs="{'invisible': ['|', ('disable_cron', '=', False), ('ftp_ok', '=', False)]}" />
4658
47 <field name="disable_cron" invisible="1" />59 <field name="disable_cron" invisible="1" />
60 <field name="multiple" invisible="1" />
4861
49 <separator colspan="4" string="FTP server" />62 <separator colspan="4" string="FTP server" />
50 <group col="4" colspan="4">63 <group col="4" colspan="4">
@@ -87,6 +100,7 @@
87 <field name="res_model">automated.export</field>100 <field name="res_model">automated.export</field>
88 <field name="view_type">form</field>101 <field name="view_type">form</field>
89 <field name="view_mode">tree,form</field>102 <field name="view_mode">tree,form</field>
103 <field name="context">{'search_default_filteractive' : 1}</field>
90 </record>104 </record>
91 <menuitem105 <menuitem
92 id="automated_export_menu"106 id="automated_export_menu"
93107
=== modified file 'bin/addons/msf_tools/views/automated_import_view.xml'
--- bin/addons/msf_tools/views/automated_import_view.xml 2020-10-20 15:14:32 +0000
+++ bin/addons/msf_tools/views/automated_import_view.xml 2021-04-15 08:08:32 +0000
@@ -8,9 +8,16 @@
8 <field name="type">search</field>8 <field name="type">search</field>
9 <field name="arch" type="xml">9 <field name="arch" type="xml">
10 <search string="Automated imports">10 <search string="Automated imports">
11 <filter name="inactive" domain="[('active', '=', False)]" string="Inactive" icon="gtk-undo" />11 <filter icon="terp-check" name="filteractive" string="Active" domain="[('active', '=', True)]" />
12 <filter icon="gtk-dialog-error" name="filterinactive" string="Inactive" domain="[('active', '=', False)]" />
12 <field name="name" />13 <field name="name" />
13 <field name="function_id" />14 <field name="function_id" />
15 <field name="partner_id" />
16 <newline />
17 <group expand="1" string="Group By..." colspan="4" col="4">
18 <filter string="Partner" name="groupby_partner_id" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
19 <filter string="Function" name="groupby_function_id" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'function_id'}"/>
20 </group>
14 </search>21 </search>
15 </field>22 </field>
16 </record>23 </record>
@@ -20,12 +27,14 @@
20 <field name="model">automated.import</field>27 <field name="model">automated.import</field>
21 <field name="type">tree</field>28 <field name="type">tree</field>
22 <field name="arch" type="xml">29 <field name="arch" type="xml">
23 <tree string="Automated imports">30 <tree string="Automated imports" colors="red: not active">
24 <field name="name" />31 <field name="name" />
25 <field name="function_id" />32 <field name="function_id" />
33 <field name="partner_id" />
26 <field name="start_time" />34 <field name="start_time" />
27 <field name="interval" />35 <field name="interval" />
28 <field name="interval_unit" />36 <field name="interval_unit" />
37 <field name="active" />
29 </tree>38 </tree>
30 </field>39 </field>
31 </record>40 </record>
@@ -58,9 +67,11 @@
58 });67 });
59 </script>68 </script>
60 </html>69 </html>
70 <field name="multiple" invisible="1" />
61 <field name="name" />71 <field name="name" />
62 <field name="function_id" widget="selection" />72 <field name="function_id" widget="selection" on_change="change_function_id(function_id)" />
63 <field name="active" />73 <field name="active" />
74 <field name="partner_id" attrs="{'invisible': [('multiple', '=', False)], 'required': [('multiple', '=', True)]}"/>
64 <field name="is_admin" invisible="1"/>75 <field name="is_admin" invisible="1"/>
65 <button name="run_job_manually" string="Run job manually" colspan="2" type="object" icon="gtk-execute" />76 <button name="run_job_manually" string="Run job manually" colspan="2" type="object" icon="gtk-execute" />
66 <button name="local_autoconfig" string="Local Auto Configuration" colspan="2" type="object" icon="terp-dialog-close" confirm="This action should only be executed on a Sandbox, it will override the current configuration. Do you confirm ?" attrs="{'invisible': [('is_admin', '=', False)]}"/>77 <button name="local_autoconfig" string="Local Auto Configuration" colspan="2" type="object" icon="terp-dialog-close" confirm="This action should only be executed on a Sandbox, it will override the current configuration. Do you confirm ?" attrs="{'invisible': [('is_admin', '=', False)]}"/>
@@ -108,6 +119,7 @@
108 <field name="res_model">automated.import</field>119 <field name="res_model">automated.import</field>
109 <field name="view_type">form</field>120 <field name="view_type">form</field>
110 <field name="view_mode">tree,form</field>121 <field name="view_mode">tree,form</field>
122 <field name="context">{'search_default_filteractive' : 1}</field>
111 </record>123 </record>
112 <menuitem124 <menuitem
113 id="automated_import_menu"125 id="automated_import_menu"
114126
=== modified file 'bin/osv/orm.py'
--- bin/osv/orm.py 2021-02-02 10:20:51 +0000
+++ bin/osv/orm.py 2021-04-15 08:08:32 +0000
@@ -3425,6 +3425,8 @@
3425 cr.commit() # start a new transaction3425 cr.commit() # start a new transaction
34263426
3427 for (key, con, null) in self._sql_constraints:3427 for (key, con, null) in self._sql_constraints:
3428 if not con:
3429 continue
3428 conname = '%s_%s' % (self._table, key)3430 conname = '%s_%s' % (self._table, key)
34293431
3430 cr.execute("SELECT conname, pg_catalog.pg_get_constraintdef(oid, true) as condef FROM pg_constraint where conname=%s", (conname,))3432 cr.execute("SELECT conname, pg_catalog.pg_get_constraintdef(oid, true) as condef FROM pg_constraint where conname=%s", (conname,))
@@ -4007,7 +4009,7 @@
4007 [('res_id','in',list(sub_ids)),('model','=',self._name)],4009 [('res_id','in',list(sub_ids)),('model','=',self._name)],
4008 order='NO_ORDER', context=context)4010 order='NO_ORDER', context=context)
40094011
4010 if self._name in xmlid_no_delete.prevent_deletion:4012 if referenced_ids and self._name in xmlid_no_delete.prevent_deletion:
4011 cr.execute('''select module, name from ir_model_data4013 cr.execute('''select module, name from ir_model_data
4012 where4014 where
4013 (module, name) in %s and4015 (module, name) in %s and

Subscribers

People subscribed via source and target branches