ir_demo_failure.py 1001 B

1234567891011121314151617181920212223242526272829303132
  1. from odoo import api, fields, models
  2. class DemoFailure(models.TransientModel):
  3. """ Stores modules for which we could not install demo data
  4. """
  5. _name = 'ir.demo_failure'
  6. _description = 'Demo failure'
  7. module_id = fields.Many2one('ir.module.module', required=True, string="Module")
  8. error = fields.Char(string="Error")
  9. wizard_id = fields.Many2one('ir.demo_failure.wizard')
  10. class DemoFailureWizard(models.TransientModel):
  11. _name = 'ir.demo_failure.wizard'
  12. _description = 'Demo Failure wizard'
  13. failure_ids = fields.One2many(
  14. 'ir.demo_failure', 'wizard_id', readonly=True,
  15. string="Demo Installation Failures"
  16. )
  17. failures_count = fields.Integer(compute='_compute_failures_count')
  18. @api.depends('failure_ids')
  19. def _compute_failures_count(self):
  20. for r in self:
  21. r.failures_count = len(r.failure_ids)
  22. def done(self):
  23. # pylint: disable=next-method-called
  24. return self.env['ir.module.module'].next()