在离线模式下在openerp上工作



我是开Openerp的新手,很抱歉问这个基本问题。

我们可以保存和检索自定义模块的数据,而开Openerp未连接到服务器[离线模式]。如果是"是",则在创建自定义模块以脱机时需要遵循什么步骤。数据如何同步?如何在离线模式下连接openerp

[不关心离线数据存储限制]

您的问题不是那么基础。本地揭幕战没有离线模式。但是,作为开源且完全可扩展的揭幕战可以让您自己做。

您可以使用HTML5 Web存储实现此类功能。它允许您在Web浏览器中本地存储数据。您的实施将负责启动时数据检索和数据同步。可以肯定的是,您将面临一些约束,例如存储限制(取决于浏览器 - 类似5MB或10MB)和性能问题。

openerp的销售点模块实现了本地存储。我不确定它是否已被使用,但您可以将其用作例如。您可能需要查看在此处实现此模块的本地存储功能的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.
 */

最新更新