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

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

    求助point_of_sale模块中pos_config的_check_cash_control

    Python 开发
    2
    4
    5216
    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.
    • P
      panlee last edited by

      point_of_sale模块中pos_config的_check_cash_control中的
      all(
                  (sum(int(journal.cash_control) for journal in record.journal_ids) <= 1)
                  for record in self.browse(cr, uid, ids, context=context)
              )这个all中的迭代对像是啥?
      新手求解

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

        all是用来判断其输入的可遍历的对象的所有的值为True则其返回True否则为False
        在你的例子中其迭代对象是一个True和False组成的Tuple,而True是满足sum的值为<=1的值,这个意思就是说在Pos configration中不能出现一个以上有cash_control的journal。
        而事实上这个_check_cash_control也是用于下列的constraint中


        (_check_cash_control, &quot;You cannot have two cash controls in one Point Of Sale !&quot;, &#91;&#039;journal_ids&#039;])
        

        【上海先安科技】(tony AT openerp.cn)

        1 Reply Last reply Reply Quote 0
        • P
          panlee last edited by

          谢谢 😘 😘

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