wxapp_confirm_wizard.py 739 B

123456789101112131415161718192021222324252627282930
  1. # coding=utf-8
  2. from odoo import models, fields, api
  3. class WxConfirm(models.TransientModel):
  4. _name = 'wxapp.confirm'
  5. _description = u'确认'
  6. info = fields.Text("信息")
  7. model = fields.Char('模型')
  8. method = fields.Char('方法')
  9. # api.multi
  10. def execute(self):
  11. self.ensure_one()
  12. active_ids = self._context.get('record_ids')
  13. rs = self.env[self.model].browse(active_ids)
  14. ret = getattr(rs, self.method)()
  15. return ret
  16. # api.multi
  17. def execute_with_info(self):
  18. self.ensure_one()
  19. active_ids = self._context.get('record_ids')
  20. rs = self.env[self.model].browse(active_ids)
  21. ret = getattr(rs, self.method)(self.info)
  22. return ret