* 模块中增加序列
    __openerp__.py :
    ...
     'data': [
        'product_data.xml',
    ],
    ...
    ------
    product_data.xml:
   
    <?xml version="1.0" encoding="utf-8"?>
    <openerp>
        <data noupdate="1">

            <record 序列  设置->技术->序列与标识符->序列 找到
    # name 序列名称
    # code 序列用到的编码
    # padding 多少位数字
    -----
    product.py :
   
    @api.model
    def create(self, vals):
        if (
                not vals.get('internal_code', False) and
                not self._context.get('default_internal_code', False)):
            vals['internal_code'] = self.env[
                'ir.sequence'].get('product.internal.code') or '/'
        return super(product, self).create(vals)
       
        # 上面做了这么多就是为 self.env['ir.sequence'].get('product.internal.code')
          这句做基础

    _sql_constraints = {
        ('internal_code_uniq', 'unique(internal_code)',
            'Internal Code mast be unique!')
    }

相关文章:

  • 2021-05-21
  • 2021-08-01
  • 2021-07-21
  • 2022-01-27
  • 2021-05-07
  • 2022-12-23
猜你喜欢
  • 2022-02-05
  • 2022-02-06
  • 2021-07-16
  • 2021-09-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案