odoo 清除所有运行数据
测试odoo,如果需要一个干净的db。经常需要清除掉所有业务数据。做如下操作,较为方便
1:建立一个服务器动作,动作的python代码入下。 然后新建一个菜单,菜单动作关联到 这个动作。需要清空db,点击这个菜单就OK啦。
1 to_removes = [ 2 ['procurement.order',], 3 ['purchase.order.line',], 4 ['purchase.order',], 5 6 ['stock.quant',], 7 ['stock.move',], 8 ['stock.pack.operation',], 9 ['stock.picking',], 10 ['stock.inventory.line',], 11 ['stock.inventory',], 12 ['stock.quant.package',], 13 ['stock.quant.move.rel',], 14 ['stock.production.lot',], 15 ['stock.fixed.putaway.strat',], 16 ['mrp.production.workcenter.line',], 17 ['mrp.production',], 18 ['mrp.production.product.line',], 19 ['sale.order.line',], 20 ['sale.order',], 21 ['pos.order.line',], 22 ['pos.order',], 23 24 ['account.voucher.line',], 25 ['account.voucher',], 26 ['account.invoice',], 27 ['account.partial.reconcile',], 28 ['account.move',], 29 ] 30 31 def remove_data(cr): 32 try: 33 for line in to_removes : 34 obj_name = line[0] 35 obj = self.pool.get(obj_name) 36 if obj and obj._table_exist: 37 sql = "delete from %s" % obj._table 38 cr.execute( sql) 39 40 41 except Exception, e: 42 raise Warning(e) 43 44 return True 45 46 remove_data(cr,)
~~~~~~~
需要odoo 实施,二开,培训 等服务
QQ:190170444