eiru_study_feature.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # -*- coding: utf-8 -*-
  2. from openerp import api, models, fields
  3. from openerp.exceptions import ValidationError, except_orm, Warning, RedirectWarning
  4. import logging
  5. _log = logging.getLogger(__name__)
  6. class StudyFeature(models.Model):
  7. _name = 'study.feature'
  8. _description = 'Study Feature'
  9. _inherit = ['mail.thread', 'ir.needaction_mixin']
  10. def _get_user(self):
  11. return self.env.uid
  12. def _get_number(self):
  13. return self.env['ir.sequence'].get('study.feature') or '*'
  14. name = fields.Char(
  15. string=u'Code',
  16. readonly=True,
  17. default=_get_number
  18. )
  19. user_id = fields.Many2one(
  20. comodel_name='res.users',
  21. string='Engineer',
  22. default=_get_user
  23. )
  24. partner_id = fields.Many2one(
  25. comodel_name='res.partner',
  26. string='Partner'
  27. )
  28. product_id = fields.Many2one(
  29. comodel_name='product.product',
  30. string='Product'
  31. )
  32. order_date = fields.Datetime(
  33. string='Order date',
  34. default=fields.Datetime.now
  35. )
  36. diagnostic = fields.Text(
  37. string='Diagnostic'
  38. )
  39. causes = fields.Text(
  40. string='Causes'
  41. )
  42. actions = fields.Text(
  43. string='Actions'
  44. )
  45. recommendations = fields.Text(
  46. string="recommendations"
  47. )
  48. @api.one
  49. def onchange_partner_id(self, partner_id):
  50. _log.info('-'*100)
  51. _log.info(partner_id)