odoo_dev 开发培训作业:图书管理系统
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

85 lines
3.1KB

  1. from odoo import models, fields
  2. import time
  3. class res_company(models.Model):
  4. _name = "res.company"
  5. _inherit = "res.company"
  6. company_bp_ids = fields.One2many('company.bp', 'company_id', 'Plans')
  7. class company_bp(models.Model):
  8. _name = "company.bp"
  9. _description = "Company buisiness plans"
  10. company_id = fields.Many2one('res.company', 'Company', ondelete='cascade',
  11. default = lambda self: self.env.company)
  12. name = fields.Char('Period',size=200 ,
  13. default =lambda *a: time.strftime('%Y-%m'))
  14. state = fields.Selection([('draft','Draft'),
  15. ('tobevalidated','To be validated'),
  16. ('valid','Valid'),
  17. ('obsolete','Obsolete'),], 'State',readonly=True , default = 'draft' )
  18. start_date = fields.Date('Start date')
  19. end_date = fields.Date('End date')
  20. validation_date = fields.Datetime('ValiDation date',readonly=True)
  21. # MAIN
  22. mission = fields.Text('Mission')
  23. positioning = fields.Text('Positioning')
  24. problems = fields.One2many('company.problem', 'bp_id', 'Problems')
  25. annual_targets = fields.One2many('company.target', 'bp_id', 'Targets')
  26. # PEST
  27. political = fields.Text('Political')
  28. econo = fields.Text('Economical')
  29. social = fields.Text('Social')
  30. techno = fields.Text('Technological')
  31. # PORTER
  32. porter_customers = fields.Text('Porter customer analysis')
  33. porter_suppliers = fields.Text('Porter suppliers analysis')
  34. porter_competitors = fields.Text('Porter competitors analysis')
  35. porter_entrants = fields.Text('Porter entrants analysis')
  36. porter_substitutes = fields.Text('Porter substitutes analysis')
  37. # SWOT
  38. strenghts = fields.Text('SWOT : Strenghts')
  39. weaknesses = fields.Text('SWOT : Weaknesses')
  40. opportunities = fields.Text('SWOT : Opportunities')
  41. threats = fields.Text('SWOT : Threats')
  42. # Strategy
  43. strategy = fields.Text('Strategy')
  44. # Notes
  45. notes = fields.Text('Notes')
  46. def button_request_validation(self):
  47. for bp in self:
  48. bp.state = "tobevalidated"
  49. def button_valid(self):
  50. for bp in self:
  51. bp.state = "valid"
  52. def button_set_obsolete(self):
  53. for bp in self:
  54. bp.state = "obsolete"
  55. def button_set_draft(self):
  56. for bp in self:
  57. bp.state = "draft"
  58. class company_bp_problem(models.Model):
  59. _name = "company.problem"
  60. _description = "List of period's problems to solve"
  61. bp_id = fields.Many2one('company.bp', 'Business plan', ondelete='cascade')
  62. name = fields.Char('Problem',size=200)
  63. solution = fields.Char('Action',size=200)
  64. is_achived = fields.Boolean('Achived')
  65. notes = fields.Text('Notes')
  66. class company_bp_target(models.Model):
  67. _name = "company.target"
  68. _description = "List of period's targets"
  69. bp_id = fields.Many2one('company.bp', 'Business plan', ondelete='cascade')
  70. name = fields.Char('Target',size=200)
  71. result = fields.Char('Action',size=200)
  72. is_achived = fields.Boolean('Achived')
  73. notes = fields.Text('Notes')
上海开阖软件有限公司 沪ICP备12045867号-1