0
我試圖更新所有POS訂單,但是因爲我有大約50,000條記錄,所以當發生任何錯誤或強行停止執行時。然後,執行的記錄數量必須更新,但在中間停止腳本時不存儲記錄。 所以,請給我一些這方面的解決方案...我使用的更新記錄使用python更新所有POS訂單
代碼...
@api.multi
def update_all_amount(self):
for order in self.search([('copy_amount_total', '=', 0)]):
self._cr.execute("""update pos_order set copy_amount_total=%s where id = %s"""\
% (str(order.amount_total), str(order.id)))
# print "\nupdated amount --- >", order.copy_amount_total,
print "success"
我們無法調試我們看不到的代碼。請製作[mcve]。如果你閱讀[問],這也會有所幫助。 –
我不是在談論代碼,但我想要的東西,如果執行停止強制然後,使用上述代碼更新記錄必須保持不回滾。 –