class GolCustomer(osv.Model): _name = 'res.partner' _inherit = 'res.partner' comment=fields.Text("Descripción u Observación") tradename=fields.Char('Nombre Comercial', size=80) phone=fields.Char('Teléfono 1', size=15) phone2=fields.Char('Teléfono 2', size=15) phone3=fields.Char('Teléfono 3', size=15) riseUse=fields.Selection([('rise','Rise'), ('contributorSpecial','Contribuyente Especial')],'Seleccione', default ='rise', required=True) identificationType=fields.Many2one('gol.identification.type','Tipo de Identificación') identificationNumber=fields.Char('Número de Identificación',help='Ingrese el numero de identificación') typePerson=fields.Many2one('gol.type.person','Tipo de persona') bussinesName=fields.Char('Razón Social',help='Ingrese el razón social') forcedToTakeAccounting=fields.Boolean('Obligado a llevar contabilidad',default=False) #Datos del cliente shortName=fields.Char('Nombre Corto', size=80) customerType=fields.Many2one('gol.customer.type','Tipo de Cliente') #accountingAccount=fields.Many2one('account.account','Cuenta Contable') balance=fields.Float('Saldo') customerType=fields.Many2one('gol.customer.type','Tipo de Cliente') discount=fields.Many2one('gol.generic.discount','Descuento Cliente') rulesRetention=fields.One2many('gol.validator.retention','idRulesRetention','Reglas Retención') #Campos para el Credito maximunAmount=fields.Float('Monto Maximo',size=50,help='Monto maximo de crédito') warranty=fields.Text('Garantía',help='Que tiene de garantia por el crédito')
class born_activity_tpl(osv.osv): _name = 'born.activity.tpl' _description = u"模板" name = fields.Char(u'名称', size=255, help=u"活动名称", required=True) image = fields.Binary(string=u"活动海报", attachment=True, help=u"活动海报") image_url = fields.Char(u'海报地址', size=255, help=u"海报地址") file_name = fields.Char(u'海报名称', size=255, help=u"海报名称") note = fields.Text(u'活动简介', required=True, help=u'活动简介') description = fields.Text(u'活动描叙', required=True, help=u'活动详细描叙,活动参与流程') provision = fields.Text(u'活动条款', help=u'参与活动的条款') active = fields.Boolean(u'归档', default=True) price = fields.Float(u'报名费', help=u'参与活动的报名费用') company_id = fields.Many2one('res.company', u'公司', ondelete='cascade', required=True, help=u'活动所属公司') game_id = fields.Many2one('born.game', u'游戏', help=u'参与活动的游戏') app_id = fields.Many2one('tl.weixin.app', u'公众号', ondelete="cascade") activity_ids = fields.One2many('born.activity', 'active_tpl_id', string=u'活动', help=u'商户报名活动列表') company_ids = fields.Many2many('res.company', 'born_activity_company_rel', 'activity_id', 'company_id', u'允许发行的公司', help=u'限制该活动允许发行的公司,不设置表示所有的平台都可以看到该活动') default_gift_ids = fields.Many2many('born.game.gift', 'born_activity_default_gift_rel', 'activity_id', 'gift_id', u'默认奖品', help=u'该奖品为发行活动的公司提供,所有参与的公司都能够使用该奖品') @api.model def create(self, vals): if vals.get('image', False): s3 = s3client(self) image_url = s3.upload(self._cr, self._uid, vals.get('image'), vals.get('file_name', 'image.png')) vals['image_url'] = image_url return super(born_activity_tpl, self).create(vals) @api.multi def write(self, vals): if vals.get('image', False): s3 = s3client(self) image_url = s3.upload(self._cr, self._uid, vals.get('image'), vals.get('file_name', 'image.png')) vals['image_url'] = image_url return super(born_activity_tpl, self).write(vals)
class GolOrganizerAccount(osv.Model): _name = 'gol.organizer.account' _inherit = 'gol.basic.entity' _description = u'descripcion modulo' type = fields.Selection([('totalizer', 'Totalizadora'), ('movement', 'Movimiento')], 'Tipo Interno', default='movement', required=True) fatherAccount = fields.Many2one('gol.organizer.account', 'Cuenta Padre') classifier = fields.Many2one('gol.classifier', 'Clasificador de Cuenta') accountType = fields.Many2one('account.account.type', 'Tipo Cuenta') description = fields.Text('Descripción u Observación') organizerType = fields.Many2one('gol.organizer.type', 'Tipo Ordenador') _sql_constraints = [ ('ValidateAccountUnduplicated', 'unique(code)', 'El código de la Cuenta Tipo Ordenador a ser ingresado existe, ingrese una nueva' ), ] @api.model def create(self, vals): rec = super(GolOrganizerAccount, self).create(vals) if (rec.fatherAccount.code is not False): rec.code = str(rec.fatherAccount.code) + '.' + rec.code # ... return rec
class maintenance_panne(models.Model): _name = 'maintenance.panne' _order = "occurrence_panne" @api.one @api.depends('demande_intervention_ids') def _get_occurrence_panne(self): self.occurrence_panne = len(self.demande_intervention_ids) @api.one @api.depends('demande_intervention_ids') def _get_panne_courante(self): for p in self.env['maintenance.panne'].search([]): p.panne_courante = False for p in self.env['maintenance.panne'].search( [], limit=5, order='occurrence_panne desc'): p.panne_courante = True name = fields.Char('Panne', required=True) description = fields.Text('Description') occurrence_panne = fields.Integer(compute='_get_occurrence_panne', string="Nombre d\'occurrence", store=True) demande_intervention_ids = fields.One2many( 'maintenance.demande.intervention', 'panne_id', 'Demande intervention') panne_courante = fields.Boolean(compute='_get_panne_courante', string='Panne courante', store=True)
class tools_helpdesk_contexto_nivel1(models.Model): """Estructura de Dependencias Administrativas""" _name = 'tools.helpdesk.contexto_nivel1' _rec_name = 'nombre' codigo = fields.Char(string="Código", size=20, help='Código de la Aplicación') nombre = fields.Char(string="Nombre", size=60, help='Nombre de la Aplicación') descripcion = fields.Text(string="Descripción", help='Descripción de la Aplicación') res_partner_ids = fields.Many2many( 'res.partner', 'respartner_aplicacion_rel', 'contexto_nivel1_id', 'res_partner_id', string="Organización", help='Organización que implementa esta aplicación') contexto_nivel2_ids = fields.One2many( 'tools.helpdesk.contexto_nivel2', 'contexto_nivel1_id', string="Módulo", help='Módulos que pertenecen a esta Aplicación')
class GolCompany(osv.osv): _name = 'res.company' _inherit = 'res.company' #Para el eliminar el tex area en empresa overdue_msg = fields.Text('Descripción') tradename = fields.Char('Nombre Comercial', size=80) phone2 = fields.Char('Teléfono 2', size=15) phone3 = fields.Char('Teléfono 3', size=15) riseUse = fields.Selection( [('rise', 'Rise'), ('contributorSpecial', 'Contribuyente Especial')], 'Seleccione', default='rise', required=True) identificationType = fields.Many2one('gol.identification.type', 'Tipo de Identificación') identificationNumber = fields.Char( 'Número de Identificación', help='Ingrese el numero de identificación') typePerson = fields.Many2one('gol.type.person', 'Tipo de persona') bussinesName = fields.Char('Razón Social', help='Ingrese el razón social') forcedToTakeAccounting = fields.Boolean('Obligado a llevar contabilidad', default=False) accountant = fields.Many2one('gol.accountant', 'Contador') taxLiability = fields.One2many('gol.tax.liability', 'idCompany', 'Obligaciones Tributarias') legalRepresentative = fields.Many2one('gol.contact', 'Representante Legal') formatCorrelative = fields.Many2one('gol.format.correlative', 'Formatos Correlativos') child_contact_ids = fields.One2many('res.partner', 'parent_id', 'Contacts', domain=[('active', '=', True)]),
class GolCreditNote(osv.Model): _name = 'gol.credit.note' _description = u'descripcion modulo' #Decalaracion de campos documentType = fields.Many2one('gol.document.type', 'Tipo de Documento') correlative = fields.Char('Correlativo', required=False) date = fields.Date('Fecha', default=datetime.now().strftime('%Y-%m-%d')) #date=fields.Datetime('Fecha',default=datetime.now()) state = fields.Selection([('active', 'Activo'), ('annulled', 'Anulado')], 'Estado del Comprobante', default='active', required=True) invoice = fields.Many2one('account.invoice', 'Factura') authorizationNumber = fields.Char('Número de Autorización') typeCreditNote = fields.Many2one('gol.type.debit.note', 'Tipo') accountingVoucher = fields.One2many('account.move', 'idAccountMove', 'Comprobantes Contables') creditNoteAmount = fields.Float('Monto') taxAmount = fields.Float('Monto Impuesto') gloss = fields.Text('Glosa') #Campos Temporales Factura authorizationNumberInvoice = fields.Char( 'Número de Autorización de la Factura', Store=False) numberInvoice = fields.Char('Número de Factura', Store=False) estateInvoice = fields.Char('Estado', Store=False) amountInvoice = fields.Char('Monto Factura', Store=False) @api.onchange('invoice') def GetDatasInvoiceAndCustomer(self): self.authorizationNumberInvoice = self.invoice.authorizationNumber #self.numberInvoice=self.invoice.number self.estateInvoice = self.invoice.state
class res_partner(models.Model): _name = 'res.partner' _inherit = ['res.partner'] name = fields.Char('Name', required=True, select=True,track_visibility='onchange',) ref = fields.Char('Contact Reference', select=1,track_visibility='onchange',) bank_ids = fields.One2many('res.partner.bank', 'partner_id', string='Banks', track_visibility='onchange',) website = fields.Char('Website', track_visibility='onchange', help="Website of Partner or Company") comment = fields.Text('Notes', track_visibility='onchange',) active = fields.Boolean('Active', track_visibility='onchange',) function = fields.Char('Job Position',track_visibility='onchange',) type = fields.Selection([('default', 'Default'), ('invoice', 'Invoice'), ('delivery', 'Shipping'), ('contact', 'Contact'), ('other', 'Other')], 'Address Type',track_visibility='onchange', help="Used to select automatically the right address according to the context in sales and purchases documents.") street = fields.Char('Street',track_visibility='onchange',) street2 = fields.Char('Street2',track_visibility='onchange',) zip = fields.Char('Zip', size=24,track_visibility='onchange', change_default=True) city = fields.Char('City',track_visibility='onchange',) state_id = fields.Many2one("res.country.state", string='State', track_visibility='onchange',ondelete='restrict') country_id = fields.Many2one('res.country', string='Country',track_visibility='onchange', ondelete='restrict') email = fields.Char('Email',track_visibility='onchange',) phone = fields.Char('Phone',track_visibility='onchange',) fax = fields.Char('Fax',track_visibility='onchange',) mobile = fields.Char('Mobile',track_visibility='onchange',) # birthdate = fields.Char('Birthdate',track_visibility='onchange',) is_company = fields.Boolean('Is a Company', track_visibility='onchange',help="Check if the contact is a company, otherwise it is a person") use_parent_address = fields.Boolean('Use Company Address', track_visibility='onchange',help="Select this if you want to set company's address information for this contact") company_id = fields.Many2one('res.company', string='Company', track_visibility='onchange',select=1) user_ids = fields.One2many('res.users', 'partner_id', string='Users')
class Discussion(models.Model): _name = 'test_new_api.discussion' name = fields.Char( string='Title', required=True, help="General description of what this discussion is about.") moderator = fields.Many2one('res.users') categories = fields.Many2many('test_new_api.category', 'test_new_api_discussion_category', 'discussion', 'category') participants = fields.Many2many('res.users') messages = fields.One2many('test_new_api.message', 'discussion') message_concat = fields.Text(string='Message concatenate') important_messages = fields.One2many('test_new_api.message', 'discussion', domain=[('important', '=', True)]) @api.onchange('moderator') def _onchange_moderator(self): self.participants |= self.moderator @api.onchange('messages') def _onchange_messages(self): self.message_concat = "\n".join( ["%s:%s" % (m.name, m.body) for m in self.messages])
class GolInvoice(osv.Model): _name = 'account.invoice' _inherit = 'account.invoice' documentType = fields.Many2one('gol.document.type') amountPaid = fields.Float('Monto Abonado', compute='_GetAmountPaid', Store=True) purchaseOrder = fields.Char('Orden de Compra') contractName = fields.Char('Nombre del Contrato') authorizationNumber = fields.Char('Número de Autorización') description = fields.Text('Observación') amountDiscount = fields.Float('Descuentos') #Elementos Modificados date_invoice = fields.Date('Fecha', default=datetime.now().strftime('%Y-%m-%d')) #Metodos Modificados @api.one @api.constrains('invoice_line') @api.onchange('partner_id', 'invoice_line') def ValidateFields(self): if (self.partner_id == False): raise ValidationError('Usted debe seleccionar un cliente') @api.one def _GetAmountPaid(self): self.amountPaid = self.amount_total - self.residual
class born_shop_category(models.Model): _name = 'born.shop.category' @api.one @api.depends('image') def _make_local_url(self): for line in self: if self.image: domain = [('type', '=', 'binary'), ('res_field', '=', 'image'), ('res_model', '=', 'born.shop.category'), ('res_id', '=', self.id)] attachment = self.env['ir.attachment'].search(domain, limit=1) if attachment: server_url = openerp.tools.config['localhost_server_url'] image_url = '%s%s' % (server_url, attachment.local_url) line.image_url = image_url name = fields.Char(u'名称') image = fields.Binary(u'标志图片', attachment=True) image_url = fields.Char(string=u'图片地址', compute='_make_local_url', multi='_make_local_url', help=u"图片地址") type = fields.Selection([('url', u'链接'), ('product_ids', u'商品'), ('category_ids', u'分类'), ('content_ids', u'文章'), ('function_ids', u'功能')], default='url', string=u'类型', help=u'类型') sequence = fields.Integer(u'排序') description = fields.Text(u'说明')
class od_hr_job_line(models.Model): _name = 'od.hr.job.line' employee_id = fields.Many2one('hr.employee', string='Employee') date_from = fields.Date(String='Date From') date_to = fields.Date(String='Date To') job_id = fields.Many2one('hr.job', string='Job Title') name = fields.Text(string='Responsibility')
class Message(models.Model): _name = 'test_new_api.message' discussion = fields.Many2one('test_new_api.discussion', ondelete='cascade') body = fields.Text() author = fields.Many2one('res.users', default=lambda self: self.env.user) name = fields.Char(string='Title', compute='_compute_name', store=True) display_name = fields.Char(string='Abstract', compute='_compute_display_name') size = fields.Integer(compute='_compute_size', search='_search_size') double_size = fields.Integer(compute='_compute_double_size') discussion_name = fields.Char(related='discussion.name') @api.one @api.constrains('author', 'discussion') def _check_author(self): if self.discussion and self.author not in self.discussion.participants: raise ValueError( _("Author must be among the discussion participants.")) @api.one @api.depends('author.name', 'discussion.name') def _compute_name(self): self.name = "[%s] %s" % (self.discussion.name or '', self.author.name or '') @api.one @api.depends('author.name', 'discussion.name', 'body') def _compute_display_name(self): stuff = "[%s] %s: %s" % (self.author.name, self.discussion.name or '', self.body or '') self.display_name = stuff[:80] @api.one @api.depends('body') def _compute_size(self): self.size = len(self.body or '') def _search_size(self, operator, value): if operator not in ('=', '!=', '<', '<=', '>', '>=', 'in', 'not in'): return [] # retrieve all the messages that match with a specific SQL query query = """SELECT id FROM "%s" WHERE char_length("body") %s %%s""" % \ (self._table, operator) self.env.cr.execute(query, (value, )) ids = [t[0] for t in self.env.cr.fetchall()] return [('id', 'in', ids)] @api.one @api.depends('size') def _compute_double_size(self): # This illustrates a subtle situation: self.double_size depends on # self.size. When size is computed, self.size is assigned, which should # normally invalidate self.double_size. However, this may not happen # while self.double_size is being computed: the last statement below # would fail, because self.double_size would be undefined. self.double_size = 0 size = self.size self.double_size = self.double_size + size
class born_lottery(osv.osv): _name = 'born.lottery' name = fields.Char(u'名称', size=255, help=u"名称") path = fields.Char(u'文件夹名称', size=255, help=u"文件夹名称") image = fields.Binary(u"预览") level = fields.Integer(u'中奖等级', digits=(2, 0)) description = fields.Text(u'说明', )
class dym_pettycash_in_full_refund_reason(models.Model): _name = "dym.pettycash.in.full.refund.reason" _description = "Petty cash in full refund reasons" _order = "sequence" name = fields.Char('Reason') notes = fields.Text('Description') sequence = fields.Integer( string='Sequence', default=0, help="Gives the sequence of this line when displaying the invoice.")
class info_search(models.Model): _name = 'info.search' student_name = fields.Char('Students Name : ') student_rollno = fields.Integer('Students Roll No : ') student_details = fields.Text('Student Details : ') # @api.multi # def search_function(self): # s_name = self.student_name # s_rollno = self.student_rollno # result = "Student Name : %s \n Roll No: %d " %(s_name,s_rollno) # + str(each.pincode) + str(each.telephone) + each.birthdate + each.joindate + str(each.fees_amt) + each.active + each.stand # +str(each.roll_no)+"\nStudent Address : "+each.address+"\nStudent Pincode : "+str(each.pincode)+"\nStudent Telephone"+str(each.telephone)+"\nStudent Birthdate :"+each.birthdate+"\nStudent Joined Date: "+each.joindate+"\nStudent Fees Amount"+str(each.fees_amt)+"\nStudent Standard : "+each.stand # self.student_details = result @api.multi def search_records(self): r_name = self.student_name r_rollno = self.student_rollno # r_address = self.student_address data = self.env['student'].search(['|',('name','=',r_name),('roll_no','=',r_rollno)]) #print "======data====",data loc_var ="" for each in data: loc_var += "Student Name: "+each.name+"\nStudent Roll No: "+str(each.roll_no)+"\nStudent Address : "+each.address+"\nStudent Pincode : "+str(each.pincode)+"\nStudent Telephone"+str(each.telephone)+"\nStudent Birthdate :"+each.birthdate+"\nStudent Joined Date: "+each.joindate+"\nStudent Fees Amount : "+str(each.fees_amt)+"\nStudent Standard : "+each.stand+"\n"+"\n =====Next Record :=====\n" self.student_details = loc_var @api.multi def browse_records(self): r_name = self.student_name r_rollno = self.student_rollno # r_address = self.student_address data = self.env['student'].search(['|',('name','=',r_name),('roll_no','=',r_rollno)]) #print "======data====",data loc_var ="" for each in data: each = self.env['student'].browse(each.id) loc_var += "Student Name: "+each.name+"\nStudent Roll No: "+str(each.roll_no)+"\nStudent Address : "+each.address+"\nStudent Pincode : "+str(each.pincode)+"\nStudent Telephone"+str(each.telephone)+"\nStudent Birthdate :"+each.birthdate+"\nStudent Joined Date: "+each.joindate+"\nStudent Fees Amount : "+str(each.fees_amt)+"\nStudent Standard : "+each.stand+"\n"+"\n =====Next Record :=====\n" self.student_details = loc_var
class pricelist_se_import(models.Model): _name = 'product.pricelist.import' _description = 'Import PriceList file' file_data = fields.Binary('Import PriceList File', required=True) file_fname = fields.Char('Import PriceList Filename', size=128, required=True) note = fields.Text('Log') _defaults = { 'file_fname': lambda *a: '', }
class sale_billing_plan(models.Model): _name = "sale.billing.plan" _description = "Billing Plan" _order = "order_id,sequence,id" order_id = fields.Many2one('sale.order', string='Order Reference', readonly=True, index=True, ondelete='cascade') order_line_id = fields.Many2one('sale.order.line', string='Order Line Reference', readonly=True, index=True, ondelete='cascade') sequence = fields.Integer( string='Sequence', default=10, help="Gives the sequence of this line when displaying the billing plan." ) installment = fields.Integer( string='Installment', help="Group of installment. Each group will be an invoice") date_invoice = fields.Date(string='Invoice Date', index=True) product_id = fields.Many2one( 'product.product', string='Product', related='order_line_id.product_id', store=True, readonly=True, ) name = fields.Text( string='Description', related='order_line_id.name', store=True, readonly=True, ) bill_percent = fields.Float(string='Percent', digits=(12, 6)) bill_amount = fields.Float(string='Amount', digits=dp.get_precision('Account')) @api.one @api.onchange('bill_percent') def _onchange_bill_percent(self): subtotal = self.order_line_id.price_subtotal self.bill_amount = subtotal and self.bill_percent / 100 * subtotal or 0.0 @api.one @api.onchange('bill_amount') def _onchange_bill_amount(self): subtotal = self.order_line_id.price_subtotal self.bill_percent = subtotal and (self.bill_amount / subtotal) * 100 or 0.0
class GolDocumentHeader(osv.Model): _name = 'gol.document.header' _description = u'descripcion modulo' #Decalaracion de campos documentType=fields.Many2one('gol.document.type','Tipo de Documento') correlative=fields.Char('Correlativo',required=False) date=fields.Datetime('Fecha',default=datetime.now()) state = fields.Selection([('active','Activo'), ('annulled','Anulado')],'Estado del Comprobante', default ='active', required=True) gloss=fields.Text('Glosa')
class od_employee_document_type(osv.osv): _name = 'od.employee.document.type' _description = "od.employee.document.type" name = fields.Char(string='Name', required=True, size=64) code = fields.Char(string='Code', size=32) description = fields.Text(string='Description') custodian = fields.Selection([ ('employee', 'Employee'), ('company', 'Company'), ], string='Custodian', required="1", default='company')
class born_game(osv.osv): _name = 'born.game' _description = u"游戏" name = fields.Char( u'名称', size=255, help=u"游戏名称", required=True, ) note = fields.Text(u'简介', size=255, required=True, help=u"简介") path = fields.Char(u'文件夹名称', size=255, required=True, help=u"文件夹名称") image_url = fields.Char(u'海报地址', size=255, help=u"海报地址") file_name = fields.Char(u'海报名称', size=255, help=u"海报名称") image = fields.Binary(string=u"游戏海报", required=True, attachment=True, help=u"游戏海报") description = fields.Text(u'玩法说明', required=True, help=u"游戏玩法和说明") @api.model def create(self, vals): if vals.get('image', False): s3 = s3client(self) image_url = s3.upload(self._cr, self._uid, vals.get('image'), vals.get('file_name', 'image.png')) vals['image_url'] = image_url return super(born_game, self).create(vals) @api.multi def write(self, vals): if vals.get('image', False): s3 = s3client(self) image_url = s3.upload(self._cr, self._uid, vals.get('image'), vals.get('file_name', 'image.png')) vals['image_url'] = image_url return super(born_game, self).write(vals)
class student(models.Model): _name = 'teacher' name = fields.Char('Name', required=1) address = fields.Text('Address') pincode = fields.Char('Pincode') telephone = fields.Char('Telephone') birthdate = fields.Date('Birthdate') joindate = fields.Datetime('Join Date') active = fields.Boolean('Active', default=1) def active_action(self): print self
class tools_helpdesk_observacion(models.Model): _name = 'tools.helpdesk.observacion' observacion = fields.Text(string="Observación") state = fields.Selection( [('registrado', 'Registrado'), ('recibido', 'Recibido'), ('asignado', 'Asignado'), ('proceso', 'En Proceso'), ('atendido', 'Atendido'), ('resuelto', 'Resuelto')], string="Status", help='Status que tiene la incidencia al momento de hacer la observación' ) incidencia_id = fields.Many2one('tools.helpdesk.incidencia', help='Relación Inversa del One2many')
class student(models.Model): _name = 'student' name = fields.Char('Name', required=1) address = fields.Text('Address') pincode = fields.Char('Pincode') telephone = fields.Char('Telephone') birthdate = fields.Date('Birthdate') joindate = fields.Datetime('Join Date') roll_no = fields.Integer('Roll Number') fees_amt = fields.Float('Fees') active = fields.Boolean('Active', default=1) stand = fields.Selection([('one', 'One'), ('two', 'Two'), ('three', 'Three'), ('four', 'Four')], 'Stand.')
class achievements(models.Model): _name = 'achievements' _rec_name = 'achieve' achieve = fields.Text('Achievements : ') choose_student = fields.Many2one('student', 'Choose Student :') s_date = fields.Datetime('Start Date:') e_date = fields.Datetime('End Date:') time = fields.Char('Time Difference:') state = fields.Selection([('start', 'Start'), ('resume', 'Resume'), ('stop', 'Stop')]) #achieve = fields.Many2many('subject','subject_teacher_rel','subject_id','teacher_id') @api.multi def start_state(self): st = datetime.now() self.write({ 'state': 'start', 's_date': st, }) @api.multi def resume_state(self): self.write({ 'state': 'resume', }) @api.one def stop_state(self): st = datetime.strptime(str(self.s_date), "%Y-%m-%d %H:%M:%S") print "dt=================", st # dt1 = str(dt) # print "dt1=================",dt1 et = datetime.now() print "et_et ==========================", et # et = datetime.strptime(str(et_et),"%Y-%m-%d %H:%M:%S") diff = et - st print "diff===================", diff self.write({ 'state': 'stop', 'e_date': et, 'time': diff, })
class HrEmployeeLine(models.Model): _name = 'hr.employee.line' name = fields.Char('Name', size=256) trainee = fields.Many2one('hr.employee', string='Trainees') trainer = fields.Many2one('res.partner', string='Trainer') dateorder = fields.Date(string='Date') department = fields.Many2one('hr.department', string='Department') course_tit = fields.Many2one('employee.training', string='Course Title') course_duhr = fields.Float(string='Course Duration in Hrs', digits=(12, 1)) course_fees = fields.Float(string='Course Fees') train_type = fields.Selection(selection=[('Internal', 'Internal'), ('External', 'External')], string='Type of Training') remark = fields.Text('Remarks') emp_id = fields.Many2one('hr.employee', 'Employee')
class born_spread(osv.osv): _name = 'born.spread' name = fields.Char(u'名称', size=255, help=u"名称") lottery_id = fields.Many2one("born.lottery", u'抽奖方式') description = fields.Text(u'说明', ) image = fields.Binary(u"展示图片") start_date = fields.Date(u'开始日期') end_date = fields.Date(u'结束日期') start_order_amount = fields.Float( u'最小订单金额', digits_compute=dp.get_precision('Account'), help=u"参加抽奖需要订单金额达到金额") product_ids = fields.One2many('born.spread.product', 'spread_id', u'奖品列表') product_limit_ids = fields.One2many('born.spread.limit.product', 'spread_id', u'必须购买以下产品后才能参与抽奖')
class tools_helpdesk_contexto_nivel3(models.Model): _name = 'tools.helpdesk.contexto_nivel3' _rec_name = 'nombre' codigo = fields.Char(string="Código", size=20, help='Código de la Operación') nombre = fields.Char(string="Nombre", size=60, help='Nombre de la Operación') descripcion = fields.Text(string="Descripción", help='Descripción de la Operación') contexto_nivel2_id = fields.Many2one( 'tools.helpdesk.contexto_nivel2', string="Módulo", help='Módulo que implementa esta operación')
class tools_helpdesk_adjuntos(models.Model): _name = 'tools.helpdesk.adjuntos' #_rec_name = 'nombre' adjunto = fields.Binary( string="Adjuntos", attachment=True, help= 'Se suben los archivos adicionales que guardan relacion con el documento', filters= "*.png,*.svg,*.jpg,*jpeg,*.pdf,*.ods,*.xls,*.xlsx,*.odt,*.doc,*.docx,*.ppt,*.pptx,*.odp" ) observacion = fields.Text( string="Descripción", size=50, help='Breve nota sobre el archivo que se adjunta') incidencia_id = fields.Many2one('tools.helpdesk.incidencia', 'incidencia')
class tools_helpdesk_contexto_nivel2(models.Model): _name = 'tools.helpdesk.contexto_nivel2' _rec_name = 'nombre' codigo = fields.Char(string="Código", size=20, help='Código del Módulo') nombre = fields.Char(string="Nombre", size=60, help='Nombre del Módulo') descripcion = fields.Text(string="Descripción", help='Descripción del Módulo') contexto_nivel1_id = fields.Many2one( 'tools.helpdesk.contexto_nivel1', string="Aplicación", help='Aplicación que implementa este módulo') contexto_nivel3_ids = fields.One2many( 'tools.helpdesk.contexto_nivel3', 'contexto_nivel2_id', string="Operaciones", help='Operaciones disponibles en este Módulo')