~eduardo-bayardo-bias/openobject-addons/bias_trunk_v8

« back to all changes in this revision

Viewing changes to crm_extra/crm.py

  • Committer: Eduardo Bayardo
  • Date: 2016-10-06 21:28:13 UTC
  • Revision ID: eduardo.bayardo@bias.com.mx-20161006212813-z4utlenj8qtt3dlg
update crm protocol module

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
 
57
57
    _columns = {
58
58
        'number': fields.char('Number', size=16),
 
59
        'number_view': fields.char('Number', size=16),
59
60
        'sequence': fields.char('Number', size=16),
60
61
        'date_ing': fields.date('Date'),
61
62
        'assigned_id': fields.many2one('res.users', 'Assigned To'),
163
164
    def on_change_user(self, cr, uid, ids, user_id, number=False, project_type='', context=None):
164
165
        res = super(crm_lead, self).on_change_user(cr, uid, ids, user_id, context=context)        
165
166
        if user_id and project_type:
166
 
            employee = "%02d"%self.pool.get('res.users').browse(cr, uid, user_id).id
 
167
            employee = (self.pool.get('res.users').browse(cr, uid, user_id).ref or '')[:2].rjust(2,'0')
167
168
            if number:
168
 
                return {'value': {'sequence': employee + number}}
 
169
                return {'value': {'sequence': employee + number, 'number_view': employee + number}}
169
170
            number = self.pool.get('ir.sequence').get(cr, uid, 'oportunity.sequence', context)
170
 
            res['value'].update({'number':number, 'sequence': employee + number})
 
171
            res['value'].update({'number':number, 'sequence': employee + number, 'number_view': employee + number})
171
172
        else:
172
 
            res['value'].update({'sequence':''})
 
173
            res['value'].update({'sequence':'', 'number_view':''})
173
174
        return res
174
175
 
175
176
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: