实用脚本: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]