跳转至内容
  • 版块
  • 标签
  • 热门
  • 用户
  • 群组
皮肤
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 默认(Flatly)
  • 不使用皮肤
折叠

Odoo 中文社区

  1. 主页
  2. 版块
  3. Odoo 开发与实施交流
  4. OpenERP对象定义详解(连载中...)

OpenERP对象定义详解(连载中...)

已定时 已固定 已锁定 已移动 Odoo 开发与实施交流
30 帖子 17 发布者 70.1k 浏览
  • 从旧到新
  • 从新到旧
  • 最多赞同
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • JoshuaJ 离线
    JoshuaJ 离线
    Joshua 管理员
    写于 最后由 编辑
    #21

    关于field.function我有其他问题,例如
    sale这个模块里面的

    <br />&#039;amount_untaxed&#039;: fields.function(_amount_all, method=True, digits=(16, int(config&#91;&#039;price_accuracy&#039;])), string=&#039;Untaxed Amount&#039;,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; store = {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#039;sale.order&#039;: (lambda self, cr, uid, ids, c={}: ids, &#91;&#039;order_line&#039;], 10),<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#039;sale.order.line&#039;: (_get_order, &#91;&#039;price_unit&#039;, &#039;tax_id&#039;, &#039;discount&#039;, &#039;product_uom_qty&#039;], 10),<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; multi=&#039;sums&#039;),<br />
    


    _get_order

    <br />&nbsp; &nbsp; def _get_order(self, cr, uid, ids, context={}):<br />&nbsp; &nbsp; &nbsp; &nbsp; result = {}<br />&nbsp; &nbsp; &nbsp; &nbsp; for line in self.pool.get(&#039;sale.order.line&#039;).browse(cr, uid, ids, context=context):<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result[line.order_id.id] = True<br />&nbsp; &nbsp; &nbsp; &nbsp; return result.keys()<br />
    


    问题来了上面的代码是在sale.order里面的,他是根据sale.order.line的变化。而触发调不调用 _amount_all。但是_get_oeder里面的ids究竟是从何而来呢?是自动对应这个sale.order的sale.order.line吗?这里的_amount_all是任意一个sale.order.line变化就会触发,还是某个sale.order的sale.order.line变化才促发呢?

    【上海先安科技】(joshua AT openerp.cn),欢迎关注公众号:openerp_cn

    1 条回复 最后回复
    0
    • N 离线
      N 离线
      NewZN
      写于 最后由 编辑
      #22

      > 问题来了上面的代码是在sale.order里面的,他是根据sale.order.line的变化。而触发调不调用 _amount_all。但是_get_oeder里面的ids究竟是从何而来呢?是自动对应这个sale.order的sale.order.line 吗?这里的_amount_all是任意一个sale.order.line变化就会触发,还是某个sale.order的 sale.order.line变化才促发呢?

      这个问题太深入了,俺没深入调查源代码,只是凭经验回答。_get_order里面的ids从界面上来,是界面上当前Order的order.line的ids。因此,当前界面上的sale.order的任意一个 sale.order.line的变化,将会触发_amount_all的调用。

      1 条回复 最后回复
      0
      • wjfonhandW 离线
        wjfonhandW 离线
        wjfonhand
        写于 最后由 编辑
        #23

        sale.order.line有个比较讨厌的地方就是,他有单独的menu。这样用户可能不在订单header界面进去而是直接修改订单行。

        估计这个store参数就是为了解决这个问题的

        GoodERP -- Odoo China fork

        1 条回复 最后回复
        0
        • K 离线
          K 离线
          K_Go
          写于 最后由 编辑
          #24

          写的真好~~

          1 条回复 最后回复
          0
          • C 离线
            C 离线
            codefans
            写于 最后由 编辑
            #25

            原来楼主就是老肖

            1 条回复 最后回复
            0
            • M 离线
              M 离线
              mf1389004071
              写于 最后由 编辑
              #26

              mark

              1 条回复 最后回复
              0
              • Z 离线
                Z 离线
                zx0800
                写于 最后由 编辑
                #27

                很好,mark

                1 条回复 最后回复
                0
                • H 离线
                  H 离线
                  hzren
                  写于 最后由 编辑
                  #28

                  很好,mark

                  1 条回复 最后回复
                  0
                  • 佳先生佳 离线
                    佳先生佳 离线
                    佳先生
                    写于 最后由 编辑
                    #29

                    请问,text 可以显示长度吗??

                    1 条回复 最后回复
                    0
                    • L 离线
                      L 离线
                      lindyue
                      写于 最后由 编辑
                      #30

                      学习了

                      1 条回复 最后回复
                      0

                      • 登录

                      • 没有帐号? 注册

                      • 登录或注册以进行搜索。
                      • 第一个帖子
                        最后一个帖子
                      0
                      • 版块
                      • 标签
                      • 热门
                      • 用户
                      • 群组