Server Action里面有个base model,这个应该选什么?
-
我在网上看了一个教程,说是在建立一个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,)