清除ODOO所有运行数据,配置迁移应用

测试odoo,如果需要一个干净的db数据库。经常需要清除掉所有业务数据。

最省事的办法是从官网下载我们开发的免费插件,适用于odoo12,11,10,9的版本

http://www.odoo.com/apps/modules/12.0/app_odoo_customize/

 

作为长期官网第一第二下载量的插件,其功能极全,可以完全自定义一个你的 odoo

在符合odoo开源协议的前提下,去除odoo版权信息,自定义你的odoo

可完全自行设置下列 odoo 选项,让 odoo 看上去像是你的软件产品。

支持odoo 12, 11, 10, 9 版本,社区版企业版通用

1. 删除菜单导航页脚的 Odoo 标签
2. 将弹出窗口中 "Odoo" 设置为自定义名称
3. 自定义用户菜单中的 Documentation, Support, About 的链接
4. 在用户菜单中增加快速切换开发模式
5. 在用户菜单中增加快速切换多国语言
6. 对语言菜单进行美化,设置国旗图标
7. 在用户菜单中增加中/英文用户手册,可以不用翻墙加速了
8. 在用户菜单中增加开发者手册,含python教程,jquery参考,Jinja2模板,PostgresSQL参考
9. 在用户菜单中自定义"My odoo.com account"
10. 单独设置面板,每个选项都可以自定义
11. 提供236个国家的国旗文件(部份需要自行设置文件名)
12. 多语言版本
13. 自定义登陆界面中的 Powered by Odoo
14. 快速删除测试数据,支持模块包括:销售/POS门店/采购/生产/库存/会计/项目/消息与工作流等.
15. 将各类单据的序号重置,从1开始,包括:SO/PO/MO/Invoice 等
16. 修复odoo启用英文后模块不显示中文的Bug
17. 可停用odoo自动订阅功能,避免“同样对象关注2次”bug,同时提升性能
18. 显示/隐藏应用的作者和网站-在应用安装面板中
19. 一键清除所有数据(视当前数据情况,有时需点击2次)
20. 在应用面板显示快速升级按键,点击时不会导航至 odoo.com
21. 清除并重置会计科目表
22. 全新升级将odoo12用户及开发手册导航至国内网站,或者自己定义的网站
23. 增加清除网站数据功能

This module can help to white label the Odoo

White label odoo. 
Support Odoo 12, 11, 10, 9. Including communicate and enterprise version.
You can config odoo, make it look like your own platform.
1. Deletes Odoo label in footer
2. Replaces "Odoo" in Windows title
3. Customize Documentation, Support, About links and title in usermenu
4. Adds "Developer mode" link to the top right-hand User Menu.
5. Adds Quick Language Switcher to the top right-hand User Menu.
6. Adds Country flags  to the top right-hand User Menu.
7. Adds English and Chinese user documentation access to the top right-hand User Menu.
8. Adds developer documentation access to the top right-hand User Menu.
9. Customize "My odoo.com account" button
10. Standalone setting panel, easy to setup.
11. Provide 236 country flags.
12. Multi-language Support.
13. Change Powered by Odoo in login screen.(Please change '../views/app_odoo_customize_view.xml' #15)
14. Quick delete test data in Apps: Sales/POS/Purchase/MRP/Inventory/Accounting/Project/Message/Workflow etc.
15. Reset All the Sequence to beginning of 1: SO/PO/MO/Invoice...
16. Fix odoo reload module translation bug while enable english language
17. Stop Odoo Auto Subscribe(Performance Improve)
18. Show/Hide Author and Website in Apps Dashboard
19. One Click to clear all data (Sometime pls click twice)
20. Show quick upgrade in app dashboard, click to show module info not go to odoo.com
21. Can clear and reset account chart. Be cautious
22. Update online manual and developer document to odoo12
23. Add reset or clear website blog data

 

如果是代码控,清除数据可自行做如下操作,较为方便

1.建立一个服务器动作,动作的python代码入下。 然后新建一个菜单,菜单动作关联到 这个动作。需要清空db,点击这个菜单就OK啦。

具体清除的数据表根据模块决定,相关系统参数要另行处理

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,)

对于开发人员经常要用的的配置迁移,只需要将当前库克隆一个,然后一键清除业务数据即可。

Odoo10离线中文用户手册下载-开发手册在线阅读