class ResPartnerIDtype(models.Model): _name = 'res.partner.idtype' _description = 'Identificacion Tipo de Documento' _order = 'sequence' name = fields.Char(required=True) code = fields.Char(required=True) sequence = fields.Integer() active = fields.Boolean(default=True) note = fields.Text() on_company = fields.Boolean( string=u'On Company?', default=True, help="Id type for use on Company" ) on_contact = fields.Boolean( string=u'On Contact?', default=True, help="Id type for use on Contacts" ) on_merchant = fields.Boolean( string=u'On Merchants?', default=True, help="Id type for use on Merchants" )
class RegistrationEditorLine(models.TransientModel): """Event Registration""" _name = "registration.editor.line" editor_id = fields.Many2one('registration.editor') sale_order_line_id = fields.Many2one('sale.order.line', string='Sale Order Line') event_id = fields.Many2one('event.event', string='Event', required=True) registration_id = fields.Many2one('event.registration', 'Original Registration') event_ticket_id = fields.Many2one('event.event.ticket', string='Event Ticket') email = fields.Char(string='Email') phone = fields.Char(string='Phone') name = fields.Char(string='Name', select=True) @api.one def get_registration_data(self): return { 'event_id': self.event_id.id, 'event_ticket_id': self.event_ticket_id.id, 'partner_id': self.editor_id.sale_order_id.partner_id.id, 'name': self.name or self.editor_id.sale_order_id.partner_id.name, 'phone': self.phone or self.editor_id.sale_order_id.partner_id.phone, 'email': self.email or self.editor_id.sale_order_id.partner_id.email, 'origin': self.editor_id.sale_order_id.name, 'sale_order_id': self.editor_id.sale_order_id.id, 'sale_order_line_id': self.sale_order_line_id.id, }
class OpPassStatus(models.Model): _name = 'op.pass.status' _description = 'Pass Status' name = fields.Char('Name', size=256) number = fields.Float('Minimum Percentage') result = fields.Char('Result to Display')
class SaasPortalConfigWizard(models.TransientModel): _inherit = 'saas_server.config.settings' saas_s3_aws_accessid = fields.Char('AWS Access ID') saas_s3_aws_accesskey = fields.Char('AWS Secret Key') saas_s3_aws_bucket = fields.Char('S3 Bucket') def get_default_saas_s3_aws_accessid(self, cr, uid, ids, context=None): saas_s3_aws_accessid = self.pool.get("ir.config_parameter").get_param( cr, uid, "saas_s3.saas_s3_aws_accessid", default=None, context=context) return {'saas_s3_aws_accessid': saas_s3_aws_accessid or False} def set_saas_s3_aws_accessid(self, cr, uid, ids, context=None): config_parameters = self.pool.get("ir.config_parameter") for record in self.browse(cr, uid, ids, context=context): config_parameters.set_param(cr, uid, "saas_s3.saas_s3_aws_accessid", record.saas_s3_aws_accessid or '', context=context) def get_default_saas_s3_aws_accesskey(self, cr, uid, ids, context=None): saas_s3_aws_accesskey = self.pool.get("ir.config_parameter").get_param( cr, uid, "saas_s3.saas_s3_aws_accesskey", default=None, context=context) return {'saas_s3_aws_accesskey': saas_s3_aws_accesskey or False} def set_saas_s3_aws_accesskey(self, cr, uid, ids, context=None): config_parameters = self.pool.get("ir.config_parameter") for record in self.browse(cr, uid, ids, context=context): config_parameters.set_param(cr, uid, "saas_s3.saas_s3_aws_accesskey", record.saas_s3_aws_accesskey or '', context=context) def get_default_saas_s3_aws_bucket(self, cr, uid, ids, context=None): saas_s3_aws_bucket = self.pool.get("ir.config_parameter").get_param( cr, uid, "saas_s3.saas_s3_aws_bucket", default=None, context=context) return {'saas_s3_aws_bucket': saas_s3_aws_bucket or False} def set_saas_s3_aws_bucket(self, cr, uid, ids, context=None): config_parameters = self.pool.get("ir.config_parameter") for record in self.browse(cr, uid, ids, context=context): config_parameters.set_param(cr, uid, "saas_s3.saas_s3_aws_bucket", record.saas_s3_aws_bucket or '', context=context)
class PostReason(models.Model): _name = "forum.post.reason" _description = "Post Closing Reason" _order = 'name' name = fields.Char(string='Closing Reason', required=True, translate=True) reason_type = fields.Char(string='Reason Type')
class Expense(models.Model): _inherit = 'hr.expense8.expense' name = fields.Char('Name', required=True, select=True, copy=False, default=lambda obj: '/') description = fields.Char('Description', readonly=True, states={ 'draft': [('readonly', False)], 'confirm': [('readonly', False)] }) _sql_constraints = [('name_uniq', 'unique(name, company_id)', 'Order Reference must be unique per Company!')] _order = "name desc" @api.model def create(self, vals): if vals.get('name', '/') == '/': vals['name'] = self.env['ir.sequence'].get( 'hr.expense8.expense') or '/' _defaults = { 'name': '/', } return super(Expense, self).create(vals)
class OpBatch(models.Model): _name = 'op.batch' code = fields.Char('Code', size=8, required=True) name = fields.Char('Name', size=32, required=True) start_date = fields.Date('Start Date', required=True, default=fields.Date.today()) end_date = fields.Date('End Date', required=True) course_id = fields.Many2one('op.course', 'Course', required=True) @api.one @api.constrains('start_date', 'end_date') def check_dates(self): start_date = fields.Date.from_string(self.start_date) end_date = fields.Date.from_string(self.end_date) if start_date > end_date: raise ValidationError("End Date cannot be set before Start Date.") @api.model def name_search(self, name, args=None, operator='ilike', limit=100): if self.env.context.get('get_parent_batch', False): lst = [] lst.append(self.env.context.get('course_id')) courses = self.env['op.course'].browse(lst) while courses.parent_id: lst.append(courses.parent_id.id) courses = courses.parent_id batches = self.env['op.batch'].search([('course_id', 'in', lst)]) return batches.name_get() return super(OpBatch, self).name_search(name, args, operator=operator, limit=limit)
class OpBookPurchase(models.Model): _name = 'op.book.purchase' _inherit = 'mail.thread' _description = 'Book Purchase Request' name = fields.Char('Title', size=128, required=True) author = fields.Char( 'Author(s)', size=256, required=True, track_visibility='onchange') edition = fields.Char('Edition') publisher = fields.Char('Publisher(s)', size=256) course_ids = fields.Many2one( 'op.course', 'Course', required=True, track_visibility='onchange') subject_ids = fields.Many2one( 'op.subject', 'Subject', required=True, track_visibility='onchange') requested_id = fields.Many2one( 'res.partner', 'Requested By', default=lambda self: self.env['res.partner'].search( [('user_id', '=', self.env.uid)])) state = fields.Selection( [('draft', 'Draft'), ('request', 'Requested'), ('reject', 'Rejected'), ('accept', 'Accepted')], 'State', select=True, readonly=True, default='draft', track_visibility='onchange') @api.one def act_requested(self): self.state = 'request' @api.one def act_accept(self): self.state = 'accept' @api.one def act_reject(self): self.state = 'reject'
class OpPlacementOffer(models.Model): _name = 'op.placement.offer' _inherit = 'mail.thread' _description = 'Placement Offer' name = fields.Char('Company Name', required=True) student_id = fields.Many2one('op.student', 'Student Name', required=True) join_date = fields.Date('Join Date', default=fields.Date.today()) offer_package = fields.Char('Offered Package', size=256) training_period = fields.Char('Training Period', size=256) state = fields.Selection( [('draft', 'Draft'), ('offer', 'Offer'), ('join', 'Join'), ('reject', 'Rejected'), ('cancel', 'Cancel')], 'State', default='draft', track_visibility='onchange') @api.one def placement_offer(self): self.state = 'offer' @api.one def placement_join(self): self.state = 'join' @api.one def confirm_rejected(self): self.state = 'reject' @api.one def confirm_to_draft(self): self.state = 'draft' @api.one def confirm_cancel(self): self.state = 'cancel'
class OpBook(models.Model): _name = 'op.book' name = fields.Char('Title', size=128, required=True) isbn = fields.Char('ISBN Code', size=64) tags = fields.Many2many('op.tag', string='Tag(s)') author_ids = fields.Many2many( 'op.author', string='Author(s)', required=True) edition = fields.Char('Edition') description = fields.Text('Description') publisher_ids = fields.Many2many( 'op.publisher', string='Publisher(s)', required=True) course_ids = fields.Many2many('op.course', string='Course', required=True) movement_line = fields.One2many('op.book.movement', 'book_id', 'Movements') subject_ids = fields.Many2many( 'op.subject', string='Subjects', required=True) internal_code = fields.Char('Internal Code', size=64) queue_ids = fields.One2many('op.book.queue', 'book_id', 'Book Queue') unit_ids = fields.One2many('op.book.unit', 'book_id', 'Units') _sql_constraints = [ ('unique_name_isbn', 'unique(isbn)', 'ISBN code must be unique per book!'), ('unique_name_internal_code', 'unique(internal_code)', 'Internal Code must be unique per book!'), ]
class OpAdmission(models.Model): _inherit = 'op.admission' _description = "Admission" religion_id = fields.Many2one('op.religion', 'Religion', states={'done': [('readonly', True)]}) category_id = fields.Many2one('op.category', 'Category', states={'done': [('readonly', True)]}) is_old_student = fields.Boolean('Old Student?') gr_no_old = fields.Char('GR Number old', size=10) gr_no = fields.Char('GR Number new', size=10) @api.multi def get_student_vals(self): vals = super(OpAdmission, self).get_student_vals() gr = self.gr_no if self.is_old_student: gr = self.gr_no_old vals.update({ 'gr_no': gr, 'category': self.category_id and self.category_id.id or False, 'religion': self.religion_id and self.religion_id.id or False }) return vals
class wx_location_message_record(models.Model): _inherit = 'wx.message_record' _name = 'wx.location_message_record' message_type = fields.Many2one( 'wx.messagetype', string='消息类型', readonly=True, default=lambda self: _messagetype_get(self, self.env.cr, self.env.user. id, 'location')) message_locationX = fields.Float(string="地理位置维度") message_locationY = fields.Float(string="地理位置经度") message_scale = fields.Float(string="地图缩放大小") message_label = fields.Char(string="地理位置信息") message_msgid = fields.Char("消息ID") #toUserName = fields.Many2one('wx.membership',string="接收方/发送方") model_id = fields.Many2one( 'ir.model', '应用模型', ondelete='cascade', copy=False, help="Base model on which the server action runs.") message_template = fields.Many2one('wx.location_message_template', string="位置消息模板") association_order = fields.Char('关联实体编码或单号') qy_toUserName = fields.Many2one('hr.employee', string="企业应用接收方/发送方")
class wx_voice_message_record(models.Model): _inherit = 'wx.message_record' _name = 'wx.voice_message_record' message_type = fields.Many2one( 'wx.messagetype', string='消息类型', readonly=True, default=lambda self: _messagetype_get(self, self.env.cr, self.env.user. id, 'voice')) message_format = fields.Char("语音格式") message_mediaId = fields.Char("语音消息媒体id") message_voicedata = fields.Binary(string="语音数据") message_recognition = fields.Char("语音识别结果") message_msgid = fields.Char("消息ID") #toUserName = fields.Many2one('wx.membership',string="接收方/发送方") qy_toUserName = fields.Many2one('hr.employee', string="企业应用接收方/发送方") model_id = fields.Many2one( 'ir.model', '应用模型', ondelete='cascade', copy=False, help="Base model on which the server action runs.") message_template = fields.Many2one('wx.voice_message_template', string="语音消息模板") association_order = fields.Char('关联实体编码或单号')
class wx_productcategory(models.Model): ''' 实体:微信商品分类 ''' _name = 'wx.productcategory' _rec_name = "wx_productcategory_name" wx_productcategory_id = fields.Char("分类ID") wx_productcategory_name = fields.Char("分类名称")
class wx_qyh_extend(models.Model): _inherit = "wx.qyh" operator_name = fields.Char(string="运营者姓名") register_mobile = fields.Char(string="手机号") register_email = fields.Char(string="邮箱") auth_time = fields.Date(string="认证时间") wx_number = fields.Char(string="微信号") cus_phone = fields.Char(string="客服电话")
class sale_order_line_function(models.Model): ''' 功能:报表报价部分 ''' _name = 'sale.order.line.function' order_line_id = fields.Many2one('sale.order.line', string='报价单行') name = fields.Char(string='名称') description = fields.Char(string='描述')
class wx_qyh(models.Model): _name = 'wx.qyh' _rec_name = 'wx_qyh_name' wx_qyh_id = fields.Char(string="企业号ID") wx_qyh_name = fields.Char(string="企业号名称") wx_qyh_mch_id = fields.Char(string="商户号") wx_company = fields.Many2one("res.company", string='公司') wx_qyh_desc = fields.Char(string="备注")
class OpAlumni(models.Model): _inherit = 'op.student' alumni_boolean = fields.Boolean('Alumni Student') passing_year = fields.Many2one('op.batch', 'Passing Year') current_position = fields.Char('Current Position', size=256) current_job = fields.Char('Current Job', size=256)
class ycloud_wx_thirdplatform(models.Model): _name = 'wx.third_platform' _rec_name = 'auth_component_platformname' auth_component_appid=fields.Char("第三方平台Appid") auth_component_appsecret=fields.Char("第三方平台Appsecret") auth_component_token=fields.Char("第三方平台Token") auth_component_encodingasekey=fields.Char("第三方平台消息加解密密钥") auth_component_platformname=fields.Char("第三方平台名称") auth_component_platfromtype=fields.Selection([('openplatform', '公众号开放平台'), ('thirdpart', '企业号第三方应用'), ('session_service', '企业号会话服务'), ('customer_service', '企业号客服服务')],string="第三方平台类型")
class wx_message_template(models.AbstractModel): _name = 'wx.message_template_base' _rec_name = "template_code" template_name = fields.Char("模板名称", required=True) template_code = fields.Char("模板编码", required=True) message_type = fields.Many2one('wx.messagetype', string='消息类型') #officialaccount = fields.Many2one('wx.officialaccount', string='微信服务号') iseffective = fields.Boolean('是否生效')
class SaasPricingPrice(models.Model): _name = 'saas_pricing.price' name = fields.Char('Price name') interval = fields.Char('Price interval') price = fields.Float('Price', digits=(16, 2)) stripe_planid = fields.Char('Stripe Plan id') stripe_currency = fields.Many2one('res.currency') trial_period_days = fields.Char('Stripe trial period days')
class wx_officialaccount(models.Model): _name = 'wx.webapplication' _rec_name = "wx_webappname" wx_webappname = fields.Char(string="应用名称") wx_webappid = fields.Char(string="应用AppID") wx_webappsecret = fields.Char(string="应用密钥") wx_webapp_authwebsiteurl = fields.Char(string="授权回调域") wx_webapp_desc = fields.Char(string="备注")
class report_plm_document_wall(models.Model): _name = "report.plm_document.wall" _description = "Users that did not inserted documents since one month" _auto = False name = fields.Date(_('Month'), readonly=True) user_id = fields.Many2one('res.users', _('Owner'), readonly=True) user = fields.Char(_('User'), size=64, readonly=True) month = fields.Char(_('Month'), size=24, readonly=True) last = fields.Datetime(_('Last Posted Time'), readonly=True)
class sale_order_price(models.Model): ''' 功能:报表报价部分 ''' _name = 'sale.order.price' order_id = fields.Many2one('sale.order', string='报价单') seq = fields.Char(string='序号') name = fields.Char(string='名称') price = fields.Char(string='报价') description = fields.Char(string='备注')
class intrastat_transport_mode(models.Model): _name = 'l10n_be_intrastat.transport_mode' code = fields.Char('Code', required=True, readonly=True) name = fields.Char('Description', readonly=True) _sql_constraints = [ ('l10n_be_intrastat_trmodecodeunique', 'UNIQUE (code)', 'Code must be unique.'), ]
class SaasPortalPlan(models.Model): _name = 'saas_portal.plan' _inherit = 'saas_portal.plan' page_url = fields.Char('Plan URL', placeholder='some-name') yuancloud_version = fields.Char('yuancloud Version', placeholder='9.0') app_store_module_ids = fields.Many2many('saas_portal.module', 'saas_portal_plan_module', 'plan_id', 'module_id', 'Modules')
class plm_config_settings(models.Model): _name = 'plm.config.settings' _inherit = 'res.config.settings' plm_service_id = fields.Char(_('Register PLM module, insert your Service ID.'), size=128, help=_("Insert the Service ID and register your PLM module. Ask it to OmniaSolutions.")) activated_id = fields.Char(_('Activated PLM client'), size=128, help=_("Listed activated Client.")) active_editor = fields.Char(_('Client Editor Name'), size=128, help=_("Used Editor Name")) active_node = fields.Char(_('OS machine name'), size=128, help=_("Editor Machine name")) active_os = fields.Char(_('OS name'), size=128, help=_("Editor OS name")) active_os_rel = fields.Char(_('OS release'), size=128, help=_("Editor OS release")) active_os_ver = fields.Char(_('OS version'), size=128, help=_("Editor OS version")) active_os_arch = fields.Char(_('OS architecture'), size=128, help=_("Editor OS architecture")) node_id = fields.Char(_('Registered PLM client'), size=128, help=_("Listed registered Client.")) def GetServiceIds(self, cr, uid, oids, default=None, context=None): """ Get all Service Ids registered. """ ids = [] partIds = self.search(cr, uid, [('activated_id', '=', False)], context=context) for part in self.browse(cr, uid, partIds): ids.append(part.plm_service_id) return list(set(ids)) def RegisterActiveId(self, cr, uid, vals, default=None, context=None): """ Get all Service Ids registered. [serviceID, activation, activeEditor, (system, node, release, version, machine, processor) ] """ defaults = {} serviceID, activation, activeEditor, platformData, nodeId = vals if activation: defaults['plm_service_id'] = serviceID defaults['activated_id'] = activation defaults['active_editor'] = activeEditor defaults['active_os'] = platformData[0] defaults['active_node'] = platformData[1] defaults['active_os_rel'] = platformData[2] defaults['active_os_ver'] = platformData[3] defaults['active_os_arch'] = platformData[4] defaults['node_id'] = nodeId partIds = self.search(cr, uid, [('plm_service_id', '=', serviceID), ('activated_id', '=', activation)], context=context) if partIds: for partId in partIds: self.write(cr, uid, [partId], defaults, context=context) return False self.create(cr, uid, defaults, context=context) return False def GetActiveServiceId(self, cr, uid, vals, default=None, context=None): """ Get all Service Ids registered. [serviceID, activation, activeEditor, (system, node, release, version, machine, processor) ] """ results = [] nodeId, activation, activeEditor, platformData = vals activeEditor = activeEditor platformData = platformData partIds = self.search(cr, uid, [('node_id', '=', nodeId), ('activated_id', '=', activation)], context=context) for partId in self.browse(cr, uid, partIds): results.append(partId.plm_service_id) return results
class templates(models.Model): _name = "wx.notify_templates" _rec_name = 'templates_remark' message_wx_templateid = fields.Char('微信模板ID') message_template_url = fields.Char("跳转地址") officialaccount = fields.Many2one("wx.officialaccount", '微信服务号') templates_remark = fields.Char("模板使用说明") message_templateid = fields.One2many('wx.notify_templates_value', 'templateid', '模板KEYS') model_id = fields.Many2one( 'ir.model', '应用模型', help="Base model on which the server action runs.")
class MailMessageSubtype(models.Model): """ Class holding subtype definition for messages. Subtypes allow to tune the follower subscription, allowing only some subtypes to be pushed on the Wall. """ _name = 'mail.message.subtype' _description = 'Message subtypes' _order = 'sequence, id' name = fields.Char( 'Message Type', required=True, translate=True, help='Message subtype gives a more precise type on the message, ' 'especially for system notifications. For example, it can be ' 'a notification related to a new record (New), or to a stage ' 'change in a process (Stage change). Message subtypes allow to ' 'precisely tune the notifications the user want to receive on its wall.' ) description = fields.Text( 'Description', translate=True, help='Description that will be added in the message posted for this ' 'subtype. If void, the name will be added instead.') internal = fields.Boolean( 'Internal Only', help= 'Messages with internal subtypes will be visible only by employees, aka members of base_user group' ) parent_id = fields.Many2one( 'mail.message.subtype', string='Parent', ondelete='set null', help= 'Parent subtype, used for automatic subscription. This field is not ' 'correctly named. For example on a project, the parent_id of project ' 'subtypes refers to task-related subtypes.') relation_field = fields.Char( 'Relation field', help='Field used to link the related model to the subtype model when ' 'using automatic subscription on a related document. The field ' 'is used to compute getattr(related_document.relation_field).') res_model = fields.Char( 'Model', help= "Model the subtype applies to. If False, this subtype applies to all models." ) default = fields.Boolean('Default', default=True, help="Activated by default when subscribing.") sequence = fields.Integer('Sequence', default=1, help="Used to order subtypes.") hidden = fields.Boolean('Hidden', help="Hide the subtype in the follower options")
class OpClassroom(models.Model): _name = 'op.classroom' name = fields.Char('Name', size=16, required=True) code = fields.Char('Code', size=4, required=True) course_id = fields.Many2one('op.course', 'Course', required=True) capacity = fields.Integer(string='No of Person') facilities = fields.One2many('op.facility.line', 'classroom_id', string='Facility Lines') asset_line = fields.One2many('op.asset', 'asset_id', 'Asset')