GoodERP
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.1KB

  1. # Copyright 2016 上海开阖软件有限公司 (http://www.osbzr.com)
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  3. from odoo import fields, models
  4. class CoreValue(models.Model):
  5. '''
  6. 当客户要求下拉字段可编辑,可使用此表存储可选值
  7. 按type分类,在字段上用domain和context筛选
  8. '''
  9. _name = 'core.value'
  10. _description = '可选值'
  11. name = fields.Char('名称', required=True)
  12. type = fields.Char('类型', required=True,
  13. default=lambda self: self._context.get('type'))
  14. note = fields.Text(
  15. string='备注',
  16. help='此字段用于详细描述该可选值的意义,或者使用一些特殊字符作为程序控制的标识'
  17. )
  18. parent_id = fields.Many2one('core.value', '上级')
  19. color = fields.Integer('Color Index')
  20. active = fields.Boolean('启用', default=True)
  21. company_id = fields.Many2one(
  22. 'res.company',
  23. string='公司',
  24. change_default=True,
  25. default=lambda self: self.env.company)
  26. _sql_constraints = [
  27. ('name_uniq', 'unique(type,name)', '同类可选值不能重名')
  28. ]
上海开阖软件有限公司 沪ICP备12045867号-1