From 65d4d0b08dc05776eb7b9df26e2eb2222b4cfc76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Tue, 26 Apr 2016 15:49:24 +0200 Subject: [PATCH] [IMP] mis_builder: copy semantics for mis.report.instance --- mis_builder/models/mis_builder.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mis_builder/models/mis_builder.py b/mis_builder/models/mis_builder.py index caf7a159..eee3b052 100644 --- a/mis_builder/models/mis_builder.py +++ b/mis_builder/models/mis_builder.py @@ -596,7 +596,8 @@ class MisReportInstance(models.Model): period_ids = fields.One2many('mis.report.instance.period', 'report_instance_id', required=True, - string='Periods') + string='Periods', + copy=True) target_move = fields.Selection([('posted', 'All Posted Entries'), ('all', 'All Entries')], string='Target Moves', @@ -606,6 +607,12 @@ class MisReportInstance(models.Model): string='Company') landscape_pdf = fields.Boolean(string='Landscape PDF') + @api.one + def copy(self, default=None): + default = dict(default or {}) + default['name'] = _('%s (copy)') % self.name + return super(MisReportInstance, self).copy(default) + def _format_date(self, lang_id, date): # format date following user language date_format = self.env['res.lang'].browse(lang_id).date_format