zoukankan      html  css  js  c++  java
  • (18)odoo规范

    * 约定
        # 命名会用  蛇形式或驼峰式
            todo_task_stage 蛇形式
            class TodoTask 驼峰式
          变量名还是蛇形居多, 类名和方法名驼峰式居多
         
        # 模式
            from openerp import models
           
        # 字段
            from openerp import fields
           
        # 翻译
            from openerp import _
           
        # 接口
            from openerp import api
           
        # 异常
            from openerp import exceptions
           
        # 典型模块导入
            from openerp import models,fields,api,_
           
        # 类
            class Toto(models.Model):
               pass

            class Titi(models.TransientModel):
               pass
              
        # 新的异常类
            openerp.exceptions.Warning
           
        # 字段
            定义词义比较好的,不要一味缩写
           
        # 在模型中,不要去改变self 用一个方法,否则缓存都无效了
       
        # 数据库句柄 用当前的 self.env.cr
       
        # 约束 用上 @api.constrains

  • 相关阅读:
    js中undefined,null,NaN的区别
    js中数字计算精度
    BestCoder Round #32
    POJ 2299 求逆序对(归并排序或树状数组)
    POJ 2603
    CodeForces 515C
    POJ 1853 背包问题
    UVA 10115 子符串替换
    POJ 1155 树状dp
    HDU 2196 树状dp 求树中节点之间的最长距离
  • 原文地址:https://www.cnblogs.com/toby2chen/p/5177149.html
Copyright © 2011-2022 走看看