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账号

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

    求助:' list' object can not be callable

    Odoo 新手求助
    3
    4
    5063
    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.
    • L
      lygping last edited by

      大家好,我新建了一个wizard,
      主要功能是,从'stock.production.lot',选择一项,读取当前行的数据,然后把这个数据用create方法写到另一个Object里,
      但是报错 ' list' object can not be callable
      我想错误应该在 pick = picking_obj.browse(cr, uid, data['id'], context)  这一句里,但是不知道应该如何修改!
      还请大家帮忙!

      def _sample2_create(obj, cr, uid, data, context):

          picking_obj=pooler.get_pool(cr.dbname).get('stock.production.lot')

          pick = picking_obj.browse(cr, uid, data['id'], context)  # 参照 stock/wizard/wizard_invoice_onshipping.py 写的

          tracking_id=self.pool.get('stock.tracking').create(cr, uid, {

                                  'orderline_id': pick.orderline_id,

                                  'prodlot_id': pick.id,

                                  # add real batch NO into vichical lot

                                  'realbatch': pick.realbatch,

                                  'serial': ref,

                                  'state': 'wait',

                                                         

                                  } )     



          return tracking_id
      ##########################################################################################################################################

      class wizard_stock_sample2_create(wizard.interface):

          states = {

              'init': {

                  'actions': [],

                'result': {'type': 'action', 'action': [_sample2_create], 'state':'end'}

              }

          }

      wizard_stock_sample2_create('stock.sample2.create')

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

        'result': {'type': 'action', 'action': [_sample2_create], 'state':'end'}

        result.action 是要按规范写的...

        我觉得你在 _sample2_create 的 返回中有问题.. 你还是参考 stock/wizard/wizard_invoice_onshipping.py 把你的 return 也返回成 create object  的 read 结果.

        试试.

        另: 建议给你贴子加上一些标签.. 这样 别人可以直接使用标签就可以检索到贴子.

        1 Reply Last reply Reply Quote 0
        • D
          dreambecky last edited by

          错误太多了,代码可以模仿,但是主要是要理解代码的含义。
          self.pool.get('stock.tracking')           
          pick.orderline_id,
          'action': [_sample2_create],
          还有你的return,有什么特殊意义?

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