2
from osv import osv, fields
4
AVAILABLE_PRIORITIES = [
12
class dentista_schedule_categ(osv.osv):
13
_name = "dentista.schedule.categ"
14
_description = "Category of case"
16
'name': fields.char('Nome categoria', size=64, required=True),
18
dentista_schedule_categ()
20
class dentista_schedule(osv.osv):
21
# _inherit = 'dental.crm.case'
22
_name = "dentista.schedule"
23
_description = "Dental schedule"
25
'id': fields.integer('ID', readonly=True),
26
'name': fields.char('Titolo',size=64,required=True),
27
'priority': fields.selection(AVAILABLE_PRIORITIES, 'Priorita\''),
28
'description': fields.text('Descrizione'),
29
'categ_id': fields.many2one('dentista.schedule.categ', 'Categoria'),
30
'partner_id': fields.many2one('res.partner', 'Paziente'),
31
'date': fields.datetime('Scadenza'),
32
'create_date': fields.datetime('Created' ,readonly=True),
33
'date_closed': fields.datetime('Closed', readonly=True),
34
'user_id': fields.many2one('res.users', 'Responsabile'),
35
'log_ids': fields.one2many('crm.case.log', 'case_id', 'Logs History', readonly=1),
37
def _get_default_partner(self, cr, uid, context):
38
if not context.get('portal',False):
40
user = self.pool.get('res.users').browse(cr, uid, uid, context)
41
if not user.address_id:
43
return user.address_id.partner_id.id
44
def _get_default_user(self, cr, uid, context):
45
if context.get('portal', False):
49
'user_id': _get_default_user,
50
'partner_id': _get_default_partner,
51
'priority': lambda *a: AVAILABLE_PRIORITIES[2][0],
52
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
54
_order = 'priority, date desc,id desc'