Odoo中文社区可以通过以下三个域名访问:shine-it.net , odoocn.org,odoo.net.cn

原论坛用户的基本信息和发帖这里都予以保留,请注意:原论坛用户无需重新注册新用户,但是您的密码需要重置

开发人员可以登录gitter讨论组: http://gitter.im/odoo-china/Talk, 需要github账号

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

实用脚本:OpenERP基础篇-新手入门-业务模拟-清除模拟数据反复测试-OpenERPV6



  • OpenERP基础篇-新手入门-业务模拟-数据清除


    使用场景:
    建好了一个帐套,做了很多业务模拟,现在想重新开始,又不想再重新建帐套.
    其中,只想清除销售,采购,库存,会计模块的一些业务数据,产品、客户、供应商和基础配置保留,如果是这样,就可以使用下面的SQL脚本。

    [b]
    [size=14pt][color=red]申明:
    使用有风险,操作需谨慎。
    操作前先备份数据!!![/color][/size][/b]


    --会计部分
    TRUNCATE table account_invoice CASCADE;
    TRUNCATE table account_invoice_line CASCADE;
    TRUNCATE table account_invoice_line_tax CASCADE;
    TRUNCATE table account_invoice_tax CASCADE;
    TRUNCATE table account_move CASCADE;
    TRUNCATE table account_move_line CASCADE;
    TRUNCATE table account_move_reconcile CASCADE;

    TRUNCATE table account_balance_report_journal_rel CASCADE;
    TRUNCATE table account_bank_accounts_wizard CASCADE;
    TRUNCATE table account_bank_statement CASCADE;
    TRUNCATE table account_bank_statement_line CASCADE;
    TRUNCATE table account_bank_statement_line_move_rel CASCADE;
    TRUNCATE table account_cashbox_line CASCADE;
    TRUNCATE table account_invoice CASCADE;
    TRUNCATE table account_invoice_line CASCADE;
    TRUNCATE table account_invoice_refund CASCADE;
    TRUNCATE table account_voucher CASCADE;
    TRUNCATE table account_voucher_line CASCADE;


    TRUNCATE table payment_order CASCADE;

    --POS模块
    TRUNCATE table pos_order CASCADE;
    TRUNCATE table pos_order_line CASCADE;
    TRUNCATE table pos_make_payment CASCADE;
    TRUNCATE table pos_close_statement CASCADE;
    TRUNCATE table pos_box_entries CASCADE;
    TRUNCATE table pos_receipt CASCADE;
    TRUNCATE table pos_confirm CASCADE;
    TRUNCATE table pos_details CASCADE;
    TRUNCATE table pos_open_statement CASCADE;

    --采购模块
    TRUNCATE table purchase_order CASCADE;
    TRUNCATE table purchase_order_line CASCADE;
    TRUNCATE table purchase_order_taxe CASCADE;


    --销售模块
    TRUNCATE table sale_order CASCADE;
    TRUNCATE table sale_order_invoice_rel CASCADE;
    TRUNCATE table sale_order_line CASCADE;
    TRUNCATE table sale_order_line_invoice_rel CASCADE;
    TRUNCATE table sale_order_line_property_rel CASCADE;
    TRUNCATE table sale_order_tax CASCADE;


    --库存模块
    TRUNCATE table stock_inventory CASCADE;
    TRUNCATE table stock_inventory_line CASCADE;
    TRUNCATE table stock_inventory_move_rel CASCADE;
    TRUNCATE table stock_move CASCADE;
    TRUNCATE table stock_move_history_ids CASCADE;
    TRUNCATE table stock_picking CASCADE;


    TRUNCATE table procurement_order CASCADE;
    TRUNCATE table procurement_order_compute CASCADE;
    TRUNCATE table procurement_order_compute_all CASCADE;
    TRUNCATE table procurement_orderpoint_compute CASCADE;
    TRUNCATE table procurement_property_rel CASCADE;


    TRUNCATE table res_log CASCADE;
    TRUNCATE table mail_message CASCADE;

    --CRM模块
    TRUNCATE table crm_lead CASCADE;
    TRUNCATE table crm_meeting CASCADE;
    TRUNCATE table crm_make_sale CASCADE;
    TRUNCATE table crm_phonecall CASCADE;
    TRUNCATE table crm_segmentation_line CASCADE;

    TRUNCATE table edi_document CASCADE;
    TRUNCATE table detail_ledger CASCADE;

    --HR模块
    TRUNCATE table hr_sign_in_out CASCADE;
    TRUNCATE table hr_sign_in_out_ask CASCADE;
    TRUNCATE table hr_sign_in_project CASCADE;
    TRUNCATE table hr_sign_out_project CASCADE;


    看累了,可以下载文档PDF

    [attach=1]



  • OpenERP基础篇-新手入门-业务模拟-数据清除


    使用场景:
    建好了一个帐套,做了很多业务模拟,现在想重新开始,又不想再重新建帐套.
    其中,只想清除销售,采购,库存,会计模块的一些业务数据,产品、客户、供应商和基础配置保留,如果是这样,就可以使用下面的SQL脚本。

    [b]
    [size=14pt][color=red]申明:
    使用有风险,操作需谨慎。
    操作前先备份数据!!![/color][/size][/b]


    --会计部分
    TRUNCATE table account_invoice CASCADE;
    TRUNCATE table account_invoice_line CASCADE;
    TRUNCATE table account_invoice_line_tax CASCADE;
    TRUNCATE table account_invoice_tax CASCADE;
    TRUNCATE table account_move CASCADE;
    TRUNCATE table account_move_line CASCADE;
    TRUNCATE table account_move_reconcile CASCADE;

    TRUNCATE table account_balance_report_journal_rel CASCADE;
    TRUNCATE table account_bank_accounts_wizard CASCADE;
    TRUNCATE table account_bank_statement CASCADE;
    TRUNCATE table account_bank_statement_line CASCADE;
    TRUNCATE table account_bank_statement_line_move_rel CASCADE;
    TRUNCATE table account_cashbox_line CASCADE;
    TRUNCATE table account_invoice CASCADE;
    TRUNCATE table account_invoice_line CASCADE;
    TRUNCATE table account_invoice_refund CASCADE;
    TRUNCATE table account_voucher CASCADE;
    TRUNCATE table account_voucher_line CASCADE;


    TRUNCATE table payment_order CASCADE;

    --POS模块
    TRUNCATE table pos_order CASCADE;
    TRUNCATE table pos_order_line CASCADE;
    TRUNCATE table pos_make_payment CASCADE;
    TRUNCATE table pos_close_statement CASCADE;
    TRUNCATE table pos_box_entries CASCADE;
    TRUNCATE table pos_receipt CASCADE;
    TRUNCATE table pos_confirm CASCADE;
    TRUNCATE table pos_details CASCADE;
    TRUNCATE table pos_open_statement CASCADE;

    --采购模块
    TRUNCATE table purchase_order CASCADE;
    TRUNCATE table purchase_order_line CASCADE;
    TRUNCATE table purchase_order_taxe CASCADE;


    --销售模块
    TRUNCATE table sale_order CASCADE;
    TRUNCATE table sale_order_invoice_rel CASCADE;
    TRUNCATE table sale_order_line CASCADE;
    TRUNCATE table sale_order_line_invoice_rel CASCADE;
    TRUNCATE table sale_order_line_property_rel CASCADE;
    TRUNCATE table sale_order_tax CASCADE;


    --库存模块
    TRUNCATE table stock_inventory CASCADE;
    TRUNCATE table stock_inventory_line CASCADE;
    TRUNCATE table stock_inventory_move_rel CASCADE;
    TRUNCATE table stock_move CASCADE;
    TRUNCATE table stock_move_history_ids CASCADE;
    TRUNCATE table stock_picking CASCADE;


    TRUNCATE table procurement_order CASCADE;
    TRUNCATE table procurement_order_compute CASCADE;
    TRUNCATE table procurement_order_compute_all CASCADE;
    TRUNCATE table procurement_orderpoint_compute CASCADE;
    TRUNCATE table procurement_property_rel CASCADE;


    TRUNCATE table res_log CASCADE;
    TRUNCATE table mail_message CASCADE;

    --CRM模块
    TRUNCATE table crm_lead CASCADE;
    TRUNCATE table crm_meeting CASCADE;
    TRUNCATE table crm_make_sale CASCADE;
    TRUNCATE table crm_phonecall CASCADE;
    TRUNCATE table crm_segmentation_line CASCADE;

    TRUNCATE table edi_document CASCADE;
    TRUNCATE table detail_ledger CASCADE;

    --HR模块
    TRUNCATE table hr_sign_in_out CASCADE;
    TRUNCATE table hr_sign_in_out_ask CASCADE;
    TRUNCATE table hr_sign_in_project CASCADE;
    TRUNCATE table hr_sign_out_project CASCADE;


    看累了,可以下载文档PDF

    [attach=1]



  • 主要是自己经常用,希望对大家有所帮助.



  • 这个不错,可以推荐使用



  • 不错.... 能给贴子加上标签(Tag) 就更棒了哇. ....



  • [quote author=mrshelly link=topic=4190.msg11309#msg11309 date=1338991829]
    不错.... 能给贴子加上标签(Tag) 就更棒了哇. ....
    [/quote]

    :D 已添加


登录后回复
 

与 Odoo 中文社区 的连接断开,我们正在尝试重连,请耐心等待