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.

21 lines
741 B

  1. # -*- coding: utf-8 -*-
  2. from openerp import models, fields, api
  3. class NewMemberCardWizard(models.TransientModel):
  4. """
  5. A transient model for the creation of a new card.
  6. The user can only define the raison why a new card is
  7. needed and the eater/worker that is concerned.
  8. """
  9. _name = 'membercard.new.wizard'
  10. def _get_default_partner(self):
  11. return self.env.context['active_id']
  12. new_comment = fields.Text('Reason', required=True)
  13. partner_id = fields.Many2one('res.partner', default=_get_default_partner)
  14. @api.one
  15. def create_new_card(self):
  16. client = self.partner_id.sudo()
  17. client._deactivate_active_cards()
  18. client._new_card(self.new_comment, self.env.uid)