本文整理汇总了Python中openerp.models.Model方法的典型用法代码示例。如果您正苦于以下问题:Python models.Model方法的具体用法?Python models.Model怎么用?Python models.Model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openerp.models
的用法示例。
在下文中一共展示了models.Model方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _compute_other_name
# 需要导入模块: from openerp import models [as 别名]
# 或者: from openerp.models import Model [as 别名]
def _compute_other_name(self):
for hc_patient_link in self:
if hc_patient_link.other_type == 'patient':
hc_patient_link.other_name = hc_patient_link.other_patient_id.name
elif hc_patient_link.other_type == 'related_person':
hc_patient_link.other_name = hc_patient_link.other_related_person_id.name
# class PatientContactTelecom(models.Model):
# _name = "hc.patient.contact.telecom"
# _description = "Patient Contact Telecom"
# _inherit = ["hc.contact.point.use"]
# _inherits = {"hc.contact.point": "telecom_id"}
# telecom_id = fields.Many2one(
# comodel_name="hc.contact.point",
# string="Telecom",
# ondelete="restrict",
# required="True",
# help="Telecom associated with this Patient Contact Telecom.")
# contact_id = fields.Many2one(
# comodel_name="hc.patient.contact",
# string="Contact",
# help="Contact associated with this Patient Contact Telecom.")
示例2: open_order_line
# 需要导入模块: from openerp import models [as 别名]
# 或者: from openerp.models import Model [as 别名]
def open_order_line(self, ids):
Model = self.env['ir.model.data']
POLine = self.env['purchase.order.line']
view_id = Model.get_object_reference(
'purchase',
'view_purchase_line_invoice'
)
wa = self.browse(ids)
lines = POLine.search([('order_id', '=', wa.order_id.id)])
return {
'name': "Create Invoices",
'view_mode': 'form',
'view_id': view_id[1],
'view_type': 'form',
'res_model': 'purchase.order.line_invoice',
'type': 'ir.actions.act_window',
'target': 'new',
'context': {
'active_ids': lines.ids,
}
}
示例3: _compute_location_name
# 需要导入模块: from openerp import models [as 别名]
# 或者: from openerp.models import Model [as 别名]
def _compute_location_name(self):
for hc_claim_accident in self:
if hc_claim_accident.location_type == 'address':
hc_claim_accident.location_name = hc_claim_accident.location_address_id.text
elif hc_claim_accident.location_type == 'location':
hc_claim_accident.location_name = hc_claim_accident.location_id.name
# class ClaimMissingTeeth(models.Model):
# _name = "hc.claim.missing.teeth"
# _description = "Claim Missing Teeth"
# claim_id = fields.Many2one(
# comodel_name="hc.res.claim",
# string="Claim",
# help="Claim associated with this Claim Missing Teeth.")
# tooth_id = fields.Many2one(
# comodel_name="hc.vs.teeth",
# string="Tooth",
# required="True",
# help="Tooth Code.")
# reason_id = fields.Many2one(
# comodel_name="hc.vs.missing.tooth.reason",
# string="Reason",
# help="Reason for missing.")
# extraction_date = fields.Date(
# string="Extraction Date",
# help="Date of Extraction.")
示例4: unlink
# 需要导入模块: from openerp import models [as 别名]
# 或者: from openerp.models import Model [as 别名]
def unlink(self):
print '**$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$123'
# rec = super(IssuedBooks, self).unlink(vals)
# returndate = fields.Date(string='Return Date', default=fields.Date.today)
print '$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$xyss'
return models.Model.unlink(self)
# @api.model
# def create(self,values):
# rec = super(IssuedBooks, self).unlink(vals)
# return rec
示例5: _compute_calculo_dias
# 需要导入模块: from openerp import models [as 别名]
# 或者: from openerp.models import Model [as 别名]
def _compute_calculo_dias(self):
carga = datetime.strptime(self.fecha_actual,'%Y-%m-%d')
dias = datetime.today() - carga
self.retraso = dias.days
return True
#FIN CALCULOS DE DIAS TRANSCURRIDOS
#class tools_helpdesk_solicitante(models.Model):
# """Debería ser una Extensión de la clase hr.employee. Esta clase debe ir en tools.base"""
# _name = 'tools.helpdesk.solicitante'
# _rec_name = 'cedula'
# _columns = {
# 'cedula': fields.integer(string="Cédula", help='Cedula de Identidad del Solicitante'),
# 'nombres': fields.char(string="Nombres", size=60, help='Nombres del Solicitante'),
# 'apellidos': fields.char(string="Apellidos", size=60, help='Apellidos del Solicitante'),
# 'estado_id': fields.Many2one('estado', string="Estados", help='Estado donde trabaja el solicitante'),
# 'regional': fields.boolean("Inces Regional"),
# 'rector': fields.boolean("Inces Rector"),
# 'cargo': fields.many2one('tools.base.hr_cargo', string="Cargo", help='Cargo del Solicitante'),
# 'dependencia_direccion_id': fields.many2one('tools.base.dependencia_direccion', string="Dirección"),
# 'dependencia_gerencia_id': fields.many2one('tools.base.dependencia_gerencia', string="Gerencia", help='Gerencia General o Regional a la que pertenece el solicitante'),
# 'dependencia_gerencia_linea_id': fields.many2one('tools.base.dependencia_gerencia_linea', string="Gerencia de Línea", help='Gerencia de Línea a la que pertenece el solicitante (En caso de Gerencia General)'),
# 'dependencia_cfs_id': fields.many2one('tools.base.dependencia_cfs', string="C.F.S.", help='C.F.S al que pertenece el solicitante (En caso de Gerencia Regional)'),
# 'dependencia_division_id': fields.many2one('tools.base.dependencia_division', string="División", help='División a la que pertenece el solicitante'),
# 'dependencia_coordinacion_id': fields.many2one('tools.base.dependencia_coordinacion', string="Coordinación", help='Coordinación a la que pertenece el solicitante'),
# 'email': fields.char(string="Correo Institucional", size=100, help='Correo Electrónico Institucional del solicitante'),
# 'ext_telefono1': fields.char(string="Extensión 1", size=5, help='Extensión Telefónica del Solicitante: Ej: 2066'),
# 'ext_telefono2': fields.char(string="Extensión 2", size=5, help='Extensión Telefónica del Solicitante: Ej: 2066'),
# 'telefono_personal': fields.char(string="Teléfono Personal", size=11, help='Telefóno Personal del Solicitante. Ej: 04261231234'),
# 'incidencia_ids': fields.one2many('tools.helpdesk.incidencia', 'solicitante_id', 'Incidencias Asociadas'),
# }
#
# _sql_constraints = [('cedula_solicitante_uniq', 'unique(cedula)', 'Este solicitante ya ha sido registrado en el sistema (cedula repetida)')]
#
#
#
# @api.constrains('ext_telefono1','telefono_personal')
# def validar_numerico(self):
# if not self.ext_telefono1.isdigit():
# raise osv.except_osv(('Error'),('La extensión debe contender solo numeros'))
#
# if not self.telefono_personal.isdigit():
# raise osv.except_osv(('Error'),('El teléfono debe contender solo numeros'))
#
# def name_get(self, cr, uid, ids, context=None):
# res = []
# solicitantes = self.browse(cr, uid, ids, context)
# for solicitante in solicitantes:
# res.append((solicitante.id, str(solicitante.cedula) + ' - ' + solicitante.nombres + ' ' + solicitante.apellidos))
# return res
#
# def create(self, cr, uid, vals, context=None): #esta campo actualiza el registro
# vals['cedula'] = uid
# vals['nombres'] = uid
# vals['apellidos'] = uid
# result = super(tools.helpdesk.solicitante, self).create(cr, uid, vals, context=context)
# return result
#tools_helpdesk_solicitante()