首页 > 其他 > 详细

odoo里的开发规范

时间:2020-12-02 09:43:55      阅读:20      评论:0      收藏:0      [点我收藏+]

1、模块命名[驼峰命名方法]

res开头的是:resources   常见模型:res.users,   res.company,    res.partner,   res.config.settings   等。。。

 

@api.model
def _selection_grade(self):
res_grade = []
grade_list = self.env[‘ir.config_parameter‘].search([(‘key‘,‘like‘,‘‘)])
for item in grade_list:
res_grade.append((item.key[12:],_(item.value)))
return res_grade

 2、三级联动案例:

 

country_id = fields.Many2one(‘res.country‘,string=u‘国家‘)
state_id=fields.Many2one(‘res.country.state‘,domain=[(‘country_id‘,‘=‘,country_id.id)],string=u‘省份‘)
state_id=fields.Many2one(‘res.country.state‘,domain=lambda self:[(‘country_id‘,‘=‘,self.env.user.country_id.id)],string=u‘省份‘)


<field name="country_id" />
<field name="state_id" domain="[(‘country_id‘,‘=‘,country_id)]"/>



待完善

odoo里的开发规范

原文:https://www.cnblogs.com/1314520xh/p/14065745.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!