2014-02-05 55 views
8

我是openerp的新手,很抱歉提出這個基本問題。在離線模式下處理openerp

openERP沒有連接到服務器[離線模式],我們可以保存和檢索自定義模塊的數據嗎?如果'是',那麼在創建定製模塊以便脫機工作時要遵循的步驟是什麼。數據如何同步?怎樣的OpenERP在離線模式下連接

[不關心的離線數據存儲限制]

回答

3

你的問題不是那麼基本。本機OpenERP沒有離線模式。但是作爲開放源代碼和完全可擴展的OpenERP,您可以自己完成。

您可以使用HTML5 Web Storage實現此功能。它允許您在Web瀏覽器中本地存儲數據。您的實施將負責啓動時的數據檢索和數據同步。當然,您將面臨一些限制,例如存儲限制(取決於瀏覽器 - 例如5MB或10MB)和性能問題。

OpenERP的Point Of Sale模塊實現了這樣的本地存儲。我不確定它是否再次使用,但您可以將其用作示例。您可能需要查看實現此模塊的本地存儲功能的Javascript - db.js

該模塊可以作爲離線實施的很好例子。儘管如此,模塊中不再使用離線模式。一個好的推理在db.js文件開頭的註釋給出:

/* The db module was intended to be used to store all the data needed to run the Point 
* of Sale in offline mode. (Products, Categories, Orders, ...) It would also use WebSQL 
* or IndexedDB to make the searching and sorting products faster. It turned out not to be 
* a so good idea after all. 
    * 
* First it is difficult to make the Point of Sale truly independant of the server. A lot 
* of functionality cannot realistically run offline, like generating invoices. 
* 
* IndexedDB turned out to be complicated and slow as hell, and loading all the data at the 
* start made the point of sale take forever to load over small connections. 
* 
* LocalStorage has a hard 5.0MB on chrome. For those kind of sizes, it is just better 
* to put the data in memory and it's not too big to download each time you launch the PoS. 
    * 
* So at this point we are dropping the support for offline mode, and this module doesn't really 
* make sense anymore. But if at some point you want to store millions of products and if at 
* that point indexedDB has improved to the point it is usable, you can just implement this API. 
* 
* You would also need to change the way the models are loaded at the start to not reload all your 
* product data. 
*/ 
+0

感謝您的PROMT答覆。同時我已經安裝了銷售點模塊,並且在線模式下工作正常。後來我關閉了openerp服務來驗證離線模式。在這裏我不確定如何啓動離線銷售點模塊。請幫我在這 – user3276175

+0

我不認爲它目前在離線模式下工作。請看我更新的答案。 –