You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
852 B

  1. # -*- encoding: utf-8 -*-
  2. ##############################################################################
  3. # For copyright and license notices, see __openerp__.py file in root directory
  4. ##############################################################################
  5. from openerp import api, fields, models
  6. class IrActionsReportDuplicate(models.TransientModel):
  7. _name = 'ir.actions.report.xml.duplicate'
  8. suffix = fields.Char(
  9. string='Suffix', help='This suffix will be added to the report')
  10. @api.one
  11. def duplicate_report(self):
  12. active_id = self.env.context.get('active_id')
  13. model = self.env.context.get('active_model')
  14. if model:
  15. object = self.env[model].browse(active_id)
  16. object.with_context(
  17. suffix=self.suffix, enable_duplication=True).copy()
  18. return {}