Skip to Content
Menu
This question has been flagged
1573 Views

I have field remain points have value i want when press button send and convert workflow to state send  the value in field remain points value decreases by one
class sms_status(models.Model):

    _name = 'sms.status'
    _description = 'SMS Status'

    title = fields.Char('Title')
    ms_body = fields.Text('Message Body')
    ms_length = fields.Integer(String='Message Length')
    date = fields.Datetime('DateTime')
    rem_points = fields.Integer('Remain Pouints')
    user_id = fields.Many2one('res.users', 'User')
    state = fields.Selection([('draft', 'New'), ('request', 'Send')], 'Status', default="draft")
    line_ids = fields.One2many( 'sms.status.line', 'contact_line', 'refernce contact')

   
    @api.v7
     # wkf Send Message

     def wkf_send(self, cr, uid, ids, context=None):
             total = 0.0
              for rec in self.browse(cr, uid, ids, context=context):
                       total = rec.rem_points-1
           return self.write(cr, uid, ids, {'state': 'request'}, context=context

Avatar
Discard