當前位置: 首頁>>代碼示例>>Python>>正文


Python models.Model方法代碼示例

本文整理匯總了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.") 
開發者ID:luigisison,項目名稱:odoo-fhir,代碼行數:25,代碼來源:hc_res_patient.py

示例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,
            }
        } 
開發者ID:pabi2,項目名稱:NOTUSE_pb2_pabi,代碼行數:23,代碼來源:purchase_work_acceptance.py

示例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.") 
開發者ID:luigisison,項目名稱:odoo-fhir,代碼行數:29,代碼來源:hc_res_claim.py

示例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 
開發者ID:mpasha96,項目名稱:Odoo-9-Library-Management-Module,代碼行數:13,代碼來源:models.py

示例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() 
開發者ID:BachacoVE,項目名稱:tools_helpdesk,代碼行數:63,代碼來源:tools_helpdesk.py


注:本文中的openerp.models.Model方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。