|
@ -37,7 +37,8 @@ class actions_server(orm.Model): |
|
|
_('Export data by email'))) |
|
|
_('Export data by email'))) |
|
|
return |
|
|
return |
|
|
|
|
|
|
|
|
_columns = {'model': fields.related('model_id', 'model', |
|
|
|
|
|
|
|
|
_columns = { |
|
|
|
|
|
'model': fields.related('model_id', 'model', |
|
|
type="char", size=256, string='Model'), |
|
|
type="char", size=256, string='Model'), |
|
|
'filter_id': fields.many2one( |
|
|
'filter_id': fields.many2one( |
|
|
'ir.filters', string='Filter', ondelete='restrict'), |
|
|
'ir.filters', string='Filter', ondelete='restrict'), |
|
@ -54,7 +55,7 @@ class actions_server(orm.Model): |
|
|
'Export Formats'), |
|
|
'Export Formats'), |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
def get_email_template(self, cr, uid, context=None): |
|
|
|
|
|
|
|
|
def _get_email_template(self, cr, uid, context=None): |
|
|
email_template_id = 0 |
|
|
email_template_id = 0 |
|
|
try: |
|
|
try: |
|
|
model_data_obj = self.pool['ir.model.data'] |
|
|
model_data_obj = self.pool['ir.model.data'] |
|
@ -64,10 +65,11 @@ class actions_server(orm.Model): |
|
|
pass |
|
|
pass |
|
|
return email_template_id |
|
|
return email_template_id |
|
|
|
|
|
|
|
|
_defaults = {'fields_to_export': '[]', |
|
|
|
|
|
|
|
|
_defaults = { |
|
|
|
|
|
'fields_to_export': '[]', |
|
|
'export_format': 'csv', |
|
|
'export_format': 'csv', |
|
|
'email_template_id': lambda self, cr, uid, c: |
|
|
'email_template_id': lambda self, cr, uid, c: |
|
|
self.get_email_template(cr, uid, context=c), |
|
|
|
|
|
|
|
|
self._get_email_template(cr, uid, context=c), |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
def onchange_model_id(self, cr, uid, ids, model_id, context=None): |
|
|
def onchange_model_id(self, cr, uid, ids, model_id, context=None): |
|
@ -148,7 +150,6 @@ class actions_server(orm.Model): |
|
|
""" |
|
|
""" |
|
|
for action in self.browse(cr, uid, ids, context): |
|
|
for action in self.browse(cr, uid, ids, context): |
|
|
if action.state == 'export_email': |
|
|
if action.state == 'export_email': |
|
|
ids.remove(action.id) |
|
|
|
|
|
# search data to export |
|
|
# search data to export |
|
|
obj_ids = self._search_data(cr, uid, action, context=context) |
|
|
obj_ids = self._search_data(cr, uid, action, context=context) |
|
|
# export data |
|
|
# export data |
|
|