本文整理汇总了Python中tools.misc.debug函数的典型用法代码示例。如果您正苦于以下问题:Python debug函数的具体用法?Python debug怎么用?Python debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _call_completed
def _call_completed(self, cr, uid, data, context):
if data['form']['user_id'] == uid and not data['form']['call_summary']:
raise except_orm('Incomplete','Please Provide Call Summary')
if data['form']['allocated_user_group_id'] and data['form']['allocated_user_id']:
raise except_orm('Call Error!', 'Both UserGroup And User Cannot Be Selected')
if data['form']['user_id'] != uid :
if data['form']['allocated_user_group_id'] :
raise except_orm('Warning','You Cannot Select the Group')
data['form']['allocated_user_id']=data['form']['user_id']
else:
if not data['form']['allocated_user_group_id'] and not data['form']['allocated_user_id']:
raise except_orm('Call Error!', 'Only one can be selected')
person = pooler.get_pool(cr.dbname).get('cmc.person').browse(cr, uid, int(data['ids'][0]))
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid)
debug(data)
if data['form']['user_id'] == uid and not data['form']['call_summary']:
raise except_orm('Incomplete','Please Provide Call Summary')
data['form']['call_date_time'] = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
data['form']['call_person_type'] = 'client'
data['form']['agent_id'] = None
data['form']['calling_about']='Self'
data['form']['state'] = 'closed'
call_id = pooler.get_pool(cr.dbname).get('cmc.call.history').create(cr, uid, data['form'],
{'wizard':True, 'person': person, 'user':user})
return {}
示例2: _create_equipment
def _create_equipment(self, cr, uid, data, context):
if context.get('from',False) == 'call history':
call_browse=pooler.get_pool(cr.dbname).get('cmc.call.history').browse(cr, uid, int(data['id']))
details=False
if call_browse.call_details:
details=call_browse.call_details
debug(details)
if call_browse.client_id:
person_id=call_browse.client_id.id
else:
raise except_orm('Warning','Following Record has no client')
else:
details=False
person_id=int(data['id'])
debug(person_id)
return {
'domain': "[]",
'name': 'Create New Equipment Enquiry',
'view_type': 'form',
'view_mode': 'form,tree',
'res_model': 'cmc.equipement.supply.process',
'view_id': False,
'type': 'ir.actions.act_window',
'context': {'person_id':person_id,
'details':details}
}
示例3: btn_booked
def btn_booked(self, cr, uid, ids, context={}):
debug(context)
vals = {'state':'booked',
}
debug(ids)
self.write(cr, uid, ids[0], vals, {'booked':'book'})
return
示例4: _call_completed
def _call_completed(self, cr, uid, data, context):
debug(data)
if data["form"]["user_id"] == uid and not data["form"]["call_summary"]:
raise except_orm("Incomplete", "Please Provide Call Summary")
if data["form"]["allocated_user_group_id"] and data["form"]["allocated_user_id"]:
raise except_orm("Call Error!", "Both UserGroup And User Cannot Be Selected")
if data["form"]["user_id"] != uid:
if data["form"]["allocated_user_group_id"]:
raise except_orm("Warning", "You Cannot Select the Group")
data["form"]["allocated_user_id"] = data["form"]["user_id"]
else:
if not data["form"]["allocated_user_group_id"] and not data["form"]["allocated_user_id"]:
raise except_orm("Call Error!", "Only one can be selected")
person = pooler.get_pool(cr.dbname).get("cmc.person").browse(cr, uid, int(data["ids"][0]))
user = pooler.get_pool(cr.dbname).get("res.users").browse(cr, uid, uid)
data["form"]["call_date_time"] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
data["form"]["call_person_type"] = "agent"
data["form"]["state"] = "closed"
if not data["form"]["client_id"]:
data["form"]["calling_about"] = "Self"
else:
cr.execute("select display_name from cmc_person where id=%d" % (data["form"]["client_id"]))
d = cr.fetchone()
data["form"]["calling_about"] = d[0]
call_id = (
pooler.get_pool(cr.dbname)
.get("cmc.call.history")
.create(cr, uid, data["form"], {"wizard": True, "person": person, "user": user})
)
return {}
示例5: _save
def _save(self, cr, uid, data, context):
id = int(data['id'])
if context.get('from',False) == 'call history':
call_browse=pooler.get_pool(cr.dbname).get('cmc.call.hisoty').browse(cr, uid, id)
person_id=call_browse.person_id.id
else:
person_id=id
if data['form']['user_id'] == uid and not data['form']['call_summary']:
raise except_orm('Incomplete','Please Provide Call Summary')
if data['form']['allocated_user_group_id'] and data['form']['allocated_user_id']:
raise except_orm('Call Error!', 'Both UserGroup And User Cannot Be Selected')
if data['form']['user_id'] != uid :
if data['form']['allocated_user_group_id'] :
raise except_orm('Warning','You Cannot Select the Group')
data['form']['allocated_user_id']=data['form']['user_id']
else:
if not data['form']['allocated_user_group_id'] and not data['form']['allocated_user_id']:
raise except_orm('Call Error!', 'Only one can be selected')
debug("At Time of saving")
debug(data)
if data['form']['allocated_user_group_id'] and data['form']['allocated_user_id']:
raise except_orm('Enquiry Error!', 'Both UserGroup And User Cannot Be Selected')
person = pooler.get_pool(cr.dbname).get('cmc.person').browse(cr, uid, person_id)
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid)
data['form']['call_date_time'] = datetime.datetime.now().strftime('%m/%d/%Y %H:%M:%S')
data['form']['call_person_type'] = 'client'
data['form']['state'] = 'allocated'
data['form']['agent_id'] = None
data['form']['calling_about']='Self'
call_id = pooler.get_pool(cr.dbname).get('cmc.call.history').create(cr, uid, data['form'],
{'wizard':True, 'person': person, 'user':user})
return {}
示例6: _details
def _details(self, cr, uid, data, context):
debug('==== DATA INFO PACK LETTER ====')
prev_record = pooler.get_pool(cr.dbname).get('cmc.assessment').browse(cr, uid, int(data['ids'][0]))
if prev_record.is_client:
if prev_record.client_person_id.first_name :
person_id = prev_record.client_person_id
else:
raise except_orm('Error','Following Assessment Has no Client')
address1 = person_id.address_line_1
address2 = person_id.address_line_2
add=False
if address1 :
add=address1
elif address2 :
add=address2
elif address1 and address2 :
add=address1+','+address2
postcode = person_id.postcode
telephone = person_id.telephone
email = person_id.email_address
data['form']['location']=False
data['form']['name']=person_id.display_name
data['form']['birth_date']=person_id.birth_date
data['form']['diagnosis']=prev_record.diagnosis if prev_record.diagnosis else False
data['form']['assessment_date']=prev_record.assessment_date
data['form']['owner']=prev_record.owner if prev_record.owner else False
return data['form']
示例7: onchange_asset
def onchange_asset(self, cr, uid, ids, parent_id, context={}):
values = {}
debug(parent_id)
values['value'] = {}
if parent_id:
values['value']['owner'] = parent_id
values['value']['current_user_id'] = parent_id
return values
示例8: onchange_review_date
def onchange_review_date(self, cr, uid, ids, time, context={}):
values = {}
values['value'] = {}
time = int(time)
debug(time)
values['value']['review_date'] = (datetime.datetime.now() + datetime.timedelta(time * 365 / 12)).strftime("%Y-%m-%d")
debug(values['value']['review_date'])
return values
示例9: _go_to_next_state
def _go_to_next_state(self, cr, uid, data, context):
debug(data)
debug(context)
return {
'name': 'Create New Assessment',
'type': 'ir.actions.wizard',
'wiz_name': 'next_state_assessment'
}
示例10: create
def create(self, cr, uid, vals, context):
debug(vals)
if 'workshop_id' in vals:
pooler.get_pool(cr.dbname).get('cmc.workshop.task.history').create(cr, uid, {
'date_task':datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
'title':'Part Order',
'description':'Part ' + str(vals['part_no'] if vals['part_no'] > 0 else "") + 'Has Been Ordered on ' + (vals['date_order'] if vals['date_order'] else ""),
'workshop_id':vals['workshop_id']
})
return super(cmc_workshop_part_ordered, self).create(cr, uid, vals, context)
示例11: _id_default
def _id_default(self, cr, uid, context={}):
debug(context)
query = "select id from cmc_person where display_name='East Anglia Drive Centre'"
cr.execute(query)
ids = cr.fetchone()
debug(ids)
if ids is not None :
return ids[0]
else:
return False
示例12: _go_to_menu
def _go_to_menu(self, cr, uid, data, context):
debug(uid)
return {
'name': 'Action Records',
'view_type': 'form',
'view_mode': 'tree',
'res_model': 'cmc.enquiry',
'view_id': False,
'type': 'ir.actions.act_window',
}
示例13: _order_details
def _order_details(self, cr, uid, data, context):
debug(context)
data['form']['workshop_id']=data['id']
pool = pooler.get_pool(cr.dbname)
picking_obj = pool.get('cmc.workshop.part.ordered')
ids=picking_obj.search(cr, uid, [('workshop_id', '=', data['id'])])
if len(ids)==0:
raise except_orm('Warning','This record has no part ordered')
debug(data)
return data['form']
示例14: _save
def _save(self, cr, uid, data, context):
debug(data)
debug(context)
data['form']['equipment_supply_process_id']=data['id']
data['form']['state']='Ordered'
data['form']['date_ordered']=datetime.datetime.now().strftime("%Y-%m-%d")
if not data['form']['owner_id']:
data['form']['owner']=context.get('client_id',False)
else:
data['form']['owner']=data['form']['owner_id']
enquiry_id = pooler.get_pool(cr.dbname).get('cmc.ordered.equipment.master').create(cr, uid, data['form'],context)
return data['form']
示例15: _save
def _save(self, cr, uid, data, context):
debug(self)
pooler.get_pool(cr.dbname).get('cmc.enquiry').write(cr, uid, int(data['id']), {'state':'closed'}, context=context)
seq_id = pooler.get_pool(cr.dbname).get('ir.sequence').search(cr, uid, [('name', '=', 'CMC Assessment')])[0]
new_id = pooler.get_pool(cr.dbname).get('ir.sequence').get_id(cr, uid, seq_id)
ref_id = str(new_id)
enquiries = pooler.get_pool(cr.dbname).get('cmc.enquiry').browse(cr, uid, int(data['id']))
enquiry=enquiries
enquiry_id = enquiry.id
driving = enquiry.enquiry_type
state_id=data['form']['state']
search_state=pooler.get_pool(cr.dbname).get('cmc.assessment.state').browse(cr,uid,state_id)
if enquiry.is_dvla:
referrer_type='dvla'
elif enquiry.is_client:
referrer_type='client_family'
data['form']['total_cost']=0;
price_id=pooler.get_pool(cr.dbname).get('cmc.assessment.price').search(cr, uid, [('type', '=',driving)])
if len(price_id) >0:
price_browse=pooler.get_pool(cr.dbname).get('cmc.assessment.price').browse(cr, uid, price_id[0])
data['form']['total_cost']=price_browse.price
id = pooler.get_pool(cr.dbname).get('cmc.assessment').create(cr, uid, {
'ref_id':ref_id,
'agent_person_id':enquiry.agent_id.id if enquiry.agent_id.id else None,
'client_person_id':enquiry.client_id.id if enquiry.client_id.id else None,
'person_id':enquiry.person_id.id,
'enquiry_id':enquiry.id,
'enquiry_details':enquiry.enquiry_details,
'paying':enquiry.paying,
'driving_assessment_type':driving,
'assessment_date': datetime.datetime.now(),
'state':state_id,
'is_agent':enquiry.is_agent,
'is_client':enquiry.is_client,
'is_dvla':enquiry.is_dvla,
'referrer_type':referrer_type,
'appointment_letters':'New appointment letter to Client post',
'total_cost':data['form']['total_cost']
})
person = False
person=enquiry.person_id
id = int(id)
debug(person.id)
pooler.get_pool(cr.dbname).get('cmc.assessment.communication').create(cr, uid, {
'comm_date':datetime.datetime.now(),
'assessment_id':id,
'type':self.drving_name(driving),
'client_name':enquiry.person_id.id,
'user_id':uid,
'subject':'Assessment Record Created with ' + ref_id,
'message':'State Changed to '+search_state.name
})
return {}