class alumni(models.Model): _name = 'alumni' _inherits = {'student': 'choose_teachers'} choose_teachers = fields.Many2one('student', 'Choose Students: ') passout_year = fields.Selection([('1990', 1990), ('1991', 1991), ('1992', 1992)], 'PassOut :') second_name = fields.Char('Your Last Name Please:')
class attendance_information(models.Model): _name = 'attendance.information' total_no_of_working_day = fields.Integer('Total No Of Working Days:') actual_working_days = fields.Integer('Actual Working Days:') absent_days = fields.Integer('Absent Days:') date = fields.Date('Date :') status = fields.Selection([('check-in', 'Check-In'), ('check-out', 'Check-Out')], 'Status :')
class HrEmployee(models.Model): _inherit = 'hr.employee' training_records = fields.One2many('hr.employee.line', 'trainee', string='Employee') empt_type = fields.Selection(selection=[('Employee', 'Employee'), ('Training', 'Training Record')], string='Type of Employees')
class born_shop_template(models.Model): _name = 'born.shop.template' name = fields.Char(u'模版名') poistion_ids = fields.Many2many('born.shop.position', string=u'位置') color = fields.Selection([('blue', u'蓝色'), ('red', u'红色'), ('black', u'黑色'), ('green', u'绿色')], default='blue', string=u'颜色主题', help=u'颜色主题')
class AccountMoveLine(models.Model): _name = "account.move.line" _description = "Journal Item" _inherit = "account.move.line" state = fields.Selection([('draft', 'Unposted'), ('posted', 'Posted')], related='move_id.state', string='Line State', store=True, copy=False)
class AccountAnalyticLine(models.Model): _name = 'account.analytic.line' _description = 'Analytic Line' _inherit = "account.analytic.line" state = fields.Selection([('draft', 'Unposted'), ('posted', 'Posted')], related='move_id.state', string='Analytic State', store=True, copy=False)
class res_partner(models.Model): _inherit = 'res.partner' sales_goal = fields.Float('Sales Goal') federal_id = fields.Char('Federal ID Number') federal_type = fields.Selection([('federal', 'Federal Tax ID'), ('social', 'Social Security Number')], 'Federal ID Type') categ_code_id = fields.Many2one('category.code', string='1099 Category Code')
class PagosAutomaticosFacturas(models.Model): _name="pagos.automaticos.facturas" cabecera_id =fields.Many2one('pagos.automaticos.detalle',string="Relacion") estado = fields.Selection(related='cabecera_id.estado',string="Estado") estudiante_id = fields.Many2one('res.partner',string="Estudiante") factura_id = fields.Many2one('account.invoice',string="Factura",domain="[('state','=','open'),('alumno_id','=',estudiante_id),('residual','!=',0.0)]") fecha_factura = fields.Date(related='factura_id.date_invoice',string="Fecha") saldos = fields.Float(related='factura_id.residual',string="Saldo") total = fields.Float(related='factura_id.amount_total',string="Total")
class employee(models.Model): _inherit = 'hr.employee' state = fields.Selection([('new', 'NEW'), ('probation', 'PROBATION'), ('confirmed', 'CONFIRMED'), ('terminated', 'TERMINATED'), ('resigned', 'RESIGNED')], 'Status:') # ([('one', 'One'), ('two', 'Two'), ('three', 'Three'), ('four', 'Four')], 'Stand.') @api.model def create(self, vals): list = ['@', '.'] if vals.get('work_email', False): email = vals.get('work_email', False) print "EMAIL=========================", vals print "EMAIL email=========================", email for each in list: if email.count('@') > 1: raise except_orm(_("Use Only one @")) if email.count('.') > 4: raise except_orm(_('Don\'t use . unnecessarily')) a = email.find('@') print "a===================", a b = email.find('.') print "b===================", b @api.multi def write(self, vals): list = ['@', '.'] if vals.get('work_email', False): email = vals.get('work_email', False) print "EMAIL=========================", vals print "EMAIL email=========================", email length_email = len(email) print "LENGTH OF EMAIL============", length_email at_the_rate = email.find('@') print "Finding @ ===================", at_the_rate full_stop = email.find('.') print "FINDING first point======================", full_stop r_full_stop = email.rfind('.') print "reverse point=================", r_full_stop for my in range(at_the_rate, r_full_stop): print "my=======================", my for each in list: if email.count('@') > 1: raise except_orm(_("Use Only one @")) # if email.count('.') > 3: # raise except_orm(_('Don\'t use . unnecessarily')) for my in range(at_the_rate + 1, r_full_stop): print "my=======================", email[my] if email[my].isalpha(): pass else: raise except_orm(_("Waring....")) return super(employee, self).write(vals)
class born_shop_model(models.Model): _name = 'born.shop.model' name = fields.Char(u'模块名') type = fields.Selection([('url', u'幻灯片'), ('product_ids', u'文章'), ('category_ids', u'产品'), ('content_ids', u'分类'), ('function_ids', u'功能')], default='url', string=u'类型', help=u'类型') category_ids = fields.Many2many('born.shop.category', string=u'内容')
class GolBankAccountCompany(osv.Model): _name = 'res.partner.bank' _inherit = 'res.partner.bank' state = fields.Selection([('iban', 'IBAN'), ('bank', 'Cuenta Bancaria')], 'Tipo de Cuenta Bancaria', default='bank', required=True) checkFormat = fields.Char( 'Formato de Cheque', help='Dirección en la que se Encuentra el formato de Cheque')
class sale_order(models.Model): _inherit = 'sale.order' discount_method = fields.Selection([('fix', 'Fixed'), ('per', 'Percentage')], 'Discount Method') discount_amount = fields.Float('Discount Amount') discount_amt = fields.Monetary(compute='_amount_all', string='- Discount', digits_compute=dp.get_precision('Account'), store=True, readonly=True) @api.depends('discount_amount') @api.multi def _calculate_discount(self): res = 0.0 discount = 0.0 for self_obj in self: if self_obj.discount_method == 'fix': discount = self_obj.discount_amount res = discount elif self_obj.discount_method == 'per': discount = self_obj.amount_untaxed * ( self_obj.discount_amount / 100) res = discount else: res = discount return res @api.depends('order_line.price_total', 'discount_amount') def _amount_all(self): """ Compute the total amounts of the SO. """ cur_obj = self.env['res.currency'] for order in self: amount_untaxed = amount_tax = 0.0 for line in order.order_line: amount_untaxed += line.price_subtotal amount_tax += line.price_tax order.update({ 'amount_untaxed': order.pricelist_id.currency_id.round(amount_untaxed), 'amount_tax': order.pricelist_id.currency_id.round(amount_tax), 'amount_total': amount_untaxed + amount_tax, }) res = self._calculate_discount() order.update({ 'discount_amt': res, 'amount_total': amount_untaxed + amount_tax - res })
class QualityCheckingHistoryLine(models.Model): _name = 'quality.checking.line.history.line' _description = "store history of every record in rejection from MO Scrap" history_id = fields.Many2one("quality.checking.line.history",readonly=True) product_id = fields.Many2one("product.product",readonly=True) unit_id = fields.Many2one("product.uom",readonly=True) quantity = fields.Float(string="Quantity Available", default=1.0,readonly=True) status = fields.Selection([('move_scrap', 'Move To scrap'),('move_quality', 'Move To Quality')], string='Status', readonly=True) main_batches=fields.Many2one('mrp.order.batch.number', string='Batch No.') quality_batch_id = fields.Many2one('quality.scrap.batches', string='History Batch No.') quantity = fields.Float(string="Quantity Available", default=1.0,readonly=True)
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 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 QualityScrapbatches(models.Model): """This table is used to select approved and reject batches in Manufacturing Scrap.""" _name = 'quality.scrap.batches' history_id = fields.Many2one('quality.checking.line.history',string='Scrap') line_id = fields.Many2one('quality.checking.line',string='Scrap') quality_id=fields.Many2one('quality.checking', string='Quality No.') inspection_id=fields.Many2one('quality.inspection','Inspection No') state = fields.Selection([('draft', 'Draft'),('done', 'Done')], string='State',default='draft', readonly=True) history_line=fields.One2many('quality.checking.line.history.line','quality_batch_id','History Line') lot_id=fields.Many2one('stock.production.lot', string='Transfer No.') main_batches=fields.Many2one('mrp.order.batch.number', string='Batch No.') quantity=fields.Float('Quanitity') avail_quantity=fields.Float('Quantity') uom_id=fields.Many2one('product.uom', string='Unit') approve_quantity =fields.Float('Send to Quality') reject_quantity =fields.Float('Send TO Scrap') ntype = fields.Selection([('reject','Reject'),('approve','Approved')],string='Type') reject_resion=fields.Many2many('quality.reject.reason','quality_batch_reject_resion_rel','quality_id', 'resion_id',string='Reject Reason',help="Rejected resign from quality checking.")
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 purchase_requisition_committee(models.Model): _name = "purchase.requisition.committee" _description = "Purchase Requisition Committee" requisition_id = fields.Many2one('purchase.requisition', 'Purchase Requisition', ondelete='cascade', readonly=True, invisible=False) member_id = fields.Many2one('hr.employee', 'Member Name', track_visibility='onchange') member_description = fields.Selection(selection=_DESCRIPTION)
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 account_move(osv.osv): _name = 'account.move' _inherit = 'account.move' alumno_id = fields.Many2one('res.partner', 'Alumno') def _calculo_anios(self): ahora = datetime.now() lista_anios = [] lista_ordenada = [] actual = int(ahora.year) + 1 for anio in range(1945, actual): lista_anios.append(anio) lista_anios = sorted(lista_anios, reverse=True) for orden in lista_anios: lista_ordenada.append((str(orden), str(orden))) return lista_ordenada jornada_id = fields.Many2one('jornada', 'Jornada', copy=False, index=True) seccion_id = fields.Many2one('seccion', 'Sección', copy=False, index=True) curso_id = fields.Many2one('curso', 'Curso', copy=False, index=True) paralelo_id = fields.Many2one('paralelo', 'Paralelo', copy=False, index=True) mes = fields.Selection( (('1', 'Enero'), ('2', 'Febrero'), ('3', 'Marzo'), ('4', 'Abril'), ('5', 'Mayo'), ('6', 'Junio'), ('7', 'Julio'), ('8', 'Agosto'), ('9', 'Septiembre'), ('10', 'Octubre'), ('11', 'Noviembre'), ('12', 'Diciembre')), 'Mes', required=False) anio = fields.Selection((_calculo_anios), 'Año', required=False, store=True)
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 maintenance_evaluation_operateur(models.Model): _name = 'maintenance.evaluation.operateur' production_operateur_id = fields.Many2one('production.operateur', 'Operateur', ondelete='cascade') qualite_service = fields.Selection([ ('0', '0/20'), ('1', '5/20'), ('2', '10/20'), ('3', '15/20'), ('4', '20/20'), ], string="Efficacité (/20)", default='0') date_evaluation = fields.Date('Date évaluation')
class born_account_line(osv.osv): _name = 'born.account.line' _description = u"账户履历" _rec_name = "account_id" account_id = fields.Many2one('born.account', string=u'账户', ondelete='cascade', required=True, help=u'报名参加活动的用户') amount = fields.Float(string=u'金额', help=u'金额') point = fields.Float(string=u'积分', help=u'积分') type = fields.Selection([('recharge', u'充值'), ('withdraw', u'提现'), ('consume', u'消费'), ('transfer', u'转账 ')], string=u'方式', help=u"账户金额变动方式", required=True)
class priority_table(models.Model): _name = 'priority.table' name = fields.Text('Priority Name:') set_priority = fields.Selection([('true', 'True'), ('false', 'False')], string='Set Priority:') select_name = fields.Many2one('res.partner', 'Please Select Your Name:') @api.model def create(self, vals): print "Inside Create===================", self._context new_id = vals['select_name'] print "NEW ID==================================", new_id # new_id = self._context.get('params')['id'] # print "NEW ID================================",new_id b = self.env['priority.table'].search( ['&', ('select_name', '=', new_id), ('set_priority', '=', 'true')]) for each in b: print "====================B IS PRINTING=================", each.id print "=====================values======================", each.set_priority if vals['set_priority'] == 'true': print "Inside=================Create ONLY===============================" each.set_priority = 'false' return super(priority_table, self).create(vals) @api.multi def write(self, vals): print "Inside WRITE===================", self._context # new_id = self._context.get('params')['id'] # print "NEW ID=WRITE===============================",new_id print "PARTNER ID===============================", self.select_name new_id = self.select_name.id b = self.env['priority.table'].search( ['&', ('select_name', '=', new_id), ('set_priority', '=', 'true')]) for each in b: print "====================B IS PRINTING(WRITE)=================", each.id print "=====================values(WRITE)======================", each.set_priority if vals['set_priority'] == 'true': print "Inside=================WRITE ONLY===============================" each.set_priority = 'false' return super(priority_table, self).write(vals)
class born_activity_gift(osv.osv): _name = 'born.activity.gift' _description = u"活动奖品情况" @api.one @api.depends('line_ids') def _compute_num(self): for line in self: use_num = 0 for item in line.line_ids: use_num += 1 line.remain_qty = line.qty - use_num name = fields.Char(u'名称', size=255, required=True, help=u"名称") activity_id = fields.Many2one('born.activity', required=True, string=u'活动', ondelete='cascade', help=u'活动') gift_id = fields.Many2one('born.game.gift', required=True, string=u'奖品', ondelete='cascade', help=u'奖品') level = fields.Selection([(1, u'一等奖'), (2, u'二等奖'), (3, u'三等奖'), (4, u'四等奖 '), (5, u'五等奖 '), (6, u'六等奖 ')], string=u'几等奖', default=3, help=u"标记为几等奖", required=True) qty = fields.Integer(u'数量', help=u"奖项的数量") probability = fields.Float(u'概率', help=u"概率") note = fields.Char(u'说明', size=255, help=u"说明") line_ids = fields.One2many('born.activity.result', 'activity_gift_id', string=u'中奖情况', help=u'中奖情况') remain_qty = fields.Integer(string=u'剩余数量', compute='_compute_num', multi='_compute_num', help=u"该奖项的剩余中奖次数") _sql_constraints = [ ('unique_activity_gift', 'unique (activity_id,level)', u'奖项不能重复!'), ]
class CalendarEvent(models.Model): _inherit = 'calendar.event' type = fields.Selection(selection=[('leave', 'Leave'), ('pub_ho', 'Public Holiday'), ('class', 'Class'), ('lead', 'Lead')], string='Type') type_id = fields.Many2one('calendar.type', string='Calendar Type') def update_type(self, cr, uid, vals, context=None): ct_obj = self.pool.get('calendar.type') cur_ids = self.search(cr, uid, []) for vals in self.browse(cr, uid, cur_ids): if vals.type: ct_id = ct_obj.search(cr, uid, [('code', '=', vals.type)]) ct_id = ct_id and ct_id[0] or 0 if ct_id: self.write(cr, uid, [vals.id], {'type_id': ct_id}) return 1 def update_calendar(self, cr, uid, vals, context=None): class_obj = self.pool.get('school.session') calendar_obj = self.pool.get('calendar.event') class_ids = class_obj.search(cr, uid, []) for vals in class_obj.browse(cr, uid, class_ids): if vals.module_id: tmp_name = vals.module_id.name if vals.class_id: tmp_name = '%s, %s' % (tmp_name, vals.class_id.name) if vals.classroom_id: tmp_name = '%s, %s' % (tmp_name, vals.classroom_id.name) if vals.teacher_id: tmp_name = '%s, %s' % (tmp_name, vals.teacher_id.name) calendar_obj.create( cr, uid, { 'name': tmp_name, 'start': vals.date_start, 'stop': vals.date_end, 'start_date': vals.date_start, 'stop_date': vals.date_end, 'type': 'class' }) return 1
class born_sale_order(models.Model): _inherit = 'sale.order' sale_category = fields.Selection([ ('weixin', u'微信商城'), ('online', u'在线销售'), ('normal', u'普通销售'), ], default='normal', string=u'状态', help=u'销售类型') is_weixin_unlick = fields.Boolean(u'微信删除订单', help=u"微信删除订单", default=False) openid = fields.Char('OPENID', size=255, help="OPENID") weixin_user_id = fields.Many2one('born.weixin.users', u'关注者', help=u"关注者") out_trade_no = fields.Char(u'微信对应订单号', size=255, help=u"微信对应订单号") transaction_id = fields.Char(u'微信支付流水号', size=255, help=u"微信支付流水号") is_lottery = fields.Boolean(u'是否已经抽奖', help=u'是否已经抽奖', default=False) spread_id = fields.Many2one('born.spread', u'活动编号') payment_date = fields.Datetime(u'付款日期')
class account_invoice_retention(models.Model): _name = "account.invoice.retention" _description = "Retenciones a cuenta por garantia de obra" name = fields.Char(string="Retencion") porcentaje = fields.Float(string="Porcentaje Retencion", required=True, digits=dp.get_precision('Account'), help="Introducir en %") account_id = fields.Many2one( 'account.account', string='Account', required=True, help="Cuenta contable de retencion por garantia") type = fields.Selection([('A', "After Tax"), ('B', "Before Tax")]) taxes_id = fields.Many2one('account.tax', string='Taxes Retention', domain=[('parent_id', '=', False), ('type_tax_use', 'in', ['sale', 'all'])])
class dym_reimbursed_bank_line(models.Model): _name = "dym.reimbursed.bank.line" _description = "Reimbursed Bank Line" reimbursed_id = fields.Many2one('dym.reimbursed.bank') state = fields.Selection(related='reimbursed_id.state', readonly=True) date = fields.Date('Date') voucher_id = fields.Many2one( 'account.voucher', string='Bank', domain= "[('bank_reimburse_ids','=',False),('journal_id','=',parent.journal_id),('branch_id','=',parent.branch_id),('state','=','posted')]" ) name = fields.Char(string="Description", required=True) account_id = fields.Many2one('account.account', string="Account", domain="[('type','!=','view')]") debit = fields.Float(string="Debit") credit = fields.Float(string="Credit") amount = fields.Float(string="Credit")