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

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

    Server Action里面有个base model,这个应该选什么?

    Odoo 新手求助
    2
    4
    1528
    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.
    • E
      elliotxin last edited by

      我在网上看了一个教程,说是在建立一个server action,然后把代码贴进去,之后在建立一个菜单,就可以清空数据库里的运行数据了。现在我的问题是,我在odoo9里建立server action的时候,有一个base model,我想问一问,这个base model因该选什么啊?谢谢了!
      我现在把代码贴在下面。
      to_removes = [
              ['procurement.order',],
              ['purchase.order.line',],
              ['purchase.order',],

              ['stock.quant',],
              ['stock.move',],
              ['stock.pack.operation',],
              ['stock.picking',],
              ['stock.inventory.line',],
              ['stock.inventory',],
              ['stock.quant.package',],
              ['stock.quant.move.rel',],
              ['stock.production.lot',],
              ['stock.fixed.putaway.strat',],
              ['mrp.production.workcenter.line',],
              ['mrp.production',],
              ['mrp.production.product.line',],
              ['sale.order.line',],
              ['sale.order',],
              ['pos.order.line',],
              ['pos.order',],

              ['account.voucher.line',],
              ['account.voucher',],
              ['account.invoice',],
              ['account.partial.reconcile',],
              ['account.move',],
      ]

      def remove_data(cr):
              try:
                  for line in to_removes :
                      obj_name = line[0]
                      obj = self.pool.get(obj_name)
                      if obj and obj._table_exist:
                          sql = "delete from %s" % obj._table
                          cr.execute( sql)


              except Exception, e:
                  raise Warning(e)

              return True

      remove_data(cr,)

      1 Reply Last reply Reply Quote 0
      • E
        elliotxin last edited by

        上个星期五发的帖子,到今天,40多个浏览,0回复,伤心啊!难道大家都这么喜欢技术保留吗?一点都不愿意分享?

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

          根据你的代码这个Server Action是看来用来删除demo 数据的,应该和选择什么base model没有关系的,你就随便选择一个好了。试试 res.company ?

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