# -*- coding: utf-8 -*- from openerp import api, models, fields from openerp.exceptions import ValidationError, except_orm, Warning, RedirectWarning import logging _log = logging.getLogger(__name__) class StudyFeature(models.Model): _name = 'study.feature' _description = 'Study Feature' _inherit = ['mail.thread', 'ir.needaction_mixin'] def _get_user(self): return self.env.uid def _get_number(self): return self.env['ir.sequence'].get('study.feature') or '*' name = fields.Char( string=u'Code', readonly=True, default=_get_number ) user_id = fields.Many2one( comodel_name='res.users', string='Engineer', default=_get_user ) partner_id = fields.Many2one( comodel_name='res.partner', string='Partner' ) product_id = fields.Many2one( comodel_name='product.product', string='Product' ) order_date = fields.Datetime( string='Order date', default=fields.Datetime.now ) diagnostic = fields.Text( string='Diagnostic' ) causes = fields.Text( string='Causes' ) actions = fields.Text( string='Actions' ) recommendations = fields.Text( string="recommendations" ) @api.one def onchange_partner_id(self, partner_id): _log.info('-'*100) _log.info(partner_id)