Navigation

    Odoo 中文社区

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Popular
    • Users
    • Groups

    Odoo中文社区可以通过以下两个域名访问:shine-it.net , odoo.net.cn

    由于系统升迁的原因,本论坛部分较早期的内容存在格式和链接损坏失效的问题,并非本论坛系统本身的缺陷,望谅解

    本社区没有维护任何QQ群讨论组,任何与本社区同名的QQ群讨论组的言论与本社区无关!

    开发人员可以登录gitter讨论组: http://gitter.im/odoo-china/Talk, 需要github账号

    如果您登录系统碰到问题,请在微信公众号留言:

    修改产品视图中的字段长度

    Odoo 开发与实施交流
    5
    9
    5239
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W
      wanjin6666 last edited by

      OE中默认的“系统型号栏位”字段为char(64),因为对产品型号描述的字数较多超过此字段长度,所以想修改字段长度,
      通过“数据库结构”去修改系统提示不可修改只能通过代码修改,怎么办?

      刚开始学习开发,正好研究下练练手
      过程
      1.切换至安装目录下的GreenOdoo-7.0-linux64/source/addons/product
        $下载product.py
        打开文件修改
        #  'variants': fields.char('Variants', size=64),     
              'variants': fields.char('Variants', size=1000),
        保存上传
      2.更新模块/升级product模块
      3.sudo reboot

      如果需要修改视图中的单行方本框为text呢?    修改视图吧

      初学,纯属瞎搞,莫吐水……

      1 Reply Last reply Reply Quote 0
      • wjfonhand
        wjfonhand last edited by

        跑偏了

        请新建模块用继承的方式修改

        1 Reply Last reply Reply Quote 0
        • 卓忆
          卓忆 last edited by

          其实也是帮助你,
          直接改代码,和界面开发,
          可维护性很差,
          也就是说出了问题,
          高手都不一定能解决。。。。。

          写个模块 才是正道

          1 Reply Last reply Reply Quote 0
          • W
            wanjin6666 last edited by

            感谢大神指教!

            1 Reply Last reply Reply Quote 0
            • W
              wanjin6666 last edited by

              [quote author=Jeff link=topic=16495.msg28453#msg28453 date=1405007095]
              跑偏了

              请新建模块用继承的方式修改
              [/quote]

              你好,Jeff!请问如果通过继承来修改字段长度,下面的代码是否正确?

              # -- encoding: utf-8 --

              from osv import osv, fields
              class product_variants(osv.osv):
                  """
                  修改产品模版表variants字段长度为1500,
                  """
                  _inherit = "product.product"
                  _columns = {
                      'variants': fields.char('Variants', size=1500)
                      }
              product_variants()

              1 Reply Last reply Reply Quote 0
              • Joshua
                Joshua 管理员 last edited by

                [quote author=wanjin6666 link=topic=16495.msg28481#msg28481 date=1405404859]
                [quote author=Jeff link=topic=16495.msg28453#msg28453 date=1405007095]
                跑偏了

                请新建模块用继承的方式修改
                [/quote]

                你好,Jeff!请问如果通过继承来修改字段长度,下面的代码是否正确?

                # -- encoding: utf-8 --

                from osv import osv, fields
                class product_variants(osv.osv):
                    """
                    修改产品模版表variants字段长度为1500,
                    """
                    _inherit = "product.product"
                    _columns = {
                        'variants': fields.char('Variants', size=1500)
                        }
                product_variants()
                [/quote]
                正确,如果要改成是text不用改视图,直接:

                 'variants': fields.text('Variants')
                

                1 Reply Last reply Reply Quote 0
                • W
                  wanjin6666 last edited by

                  [quote author=Joshua link=topic=16495.msg28482#msg28482 date=1405410922]
                  [quote author=wanjin6666 link=topic=16495.msg28481#msg28481 date=1405404859]
                  [quote author=Jeff link=topic=16495.msg28453#msg28453 date=1405007095]
                  跑偏了

                  请新建模块用继承的方式修改
                  [/quote]

                  你好,Jeff!请问如果通过继承来修改字段长度,下面的代码是否正确?

                  # -- encoding: utf-8 --

                  from osv import osv, fields
                  class product_variants(osv.osv):
                      """
                      修改产品模版表variants字段长度为1500,
                      """
                      _inherit = "product.product"
                      _columns = {
                          'variants': fields.char('Variants', size=1500)
                          }
                  product_variants()
                  [/quote]
                  正确,如果要改成是text不用改视图,直接:

                   'variants': fields.text('Variants')
                  


                  [/quote]

                  嗯,谢谢,之前搞TIPTOP习惯了,都是直接修改代码

                  1 Reply Last reply Reply Quote 0
                  • 佳先生
                    佳先生 last edited by

                    [quote author=Joshua link=topic=16495.msg28482#msg28482 date=1405410922]
                    [quote author=wanjin6666 link=topic=16495.msg28481#msg28481 date=1405404859]
                    [quote author=Jeff link=topic=16495.msg28453#msg28453 date=1405007095]
                    跑偏了

                    请新建模块用继承的方式修改
                    [/quote]

                    你好,Jeff!请问如果通过继承来修改字段长度,下面的代码是否正确?

                    # -- encoding: utf-8 --

                    from osv import osv, fields
                    class product_variants(osv.osv):
                        """
                        修改产品模版表variants字段长度为1500,
                        """
                        _inherit = "product.product"
                        _columns = {
                            'variants': fields.char('Variants', size=1500)
                            }
                    product_variants()
                    [/quote]
                    正确,如果要改成是text不用改视图,直接:

                     'variants': fields.text('Variants')
                    


                    [/quote]


                    请问text能限制输入字数吗??

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post