Skip to content

Commit fd74eb1

Browse files
authored
Merge pull request #16 from gisce/add_exists_to_orm
Add orm_mongodb.exists method
2 parents dbf61a5 + 48b6fc6 commit fd74eb1

File tree

5 files changed

+146
-0
lines changed

5 files changed

+146
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
.pydevproject
33
.settings
44
*.pyc
5+
.idea

i18n/ca_ES.po

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Translation of OpenERP Server.
2+
# This file contains the translation of the following modules:
3+
#
4+
# Translators:
5+
# Jaume Florez Valenzuela <[email protected]>, 2017.
6+
msgid ""
7+
msgstr ""
8+
"Project-Id-Version: GISCE-ERP\n"
9+
"Report-Msgid-Bugs-To: https://github.com/gisce/erp/issues\n"
10+
"POT-Creation-Date: 2017-10-24 11:27\n"
11+
"PO-Revision-Date: 2017-10-24 09:36+0000\n"
12+
"Last-Translator: Jaume Florez Valenzuela <[email protected]>\n"
13+
"Language-Team: Catalan (Spain) <[email protected]>\n"
14+
"MIME-Version: 1.0\n"
15+
"Content-Type: text/plain; charset=UTF-8\n"
16+
"Content-Transfer-Encoding: \n"
17+
"Language: ca_ES\n"
18+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
19+
20+
#. module: mongodb_backend
21+
#: model:ir.module.module,shortdesc:mongodb_backend.module_meta_information
22+
msgid "MongoDB Backend"
23+
msgstr "MongoDB Backend"
24+
25+
#. module: mongodb_backend
26+
#: model:ir.module.module,description:mongodb_backend.module_meta_information
27+
msgid ""
28+
"\n"
29+
"NoSQL MongoDB backend for OpenERP. It allows to create objects and store\n"
30+
"all the data in a NoSQL way. You can interact with this data the same way\n"
31+
"as it was stored in PostgreSQL from the client.\n"
32+
" "
33+
msgstr "\nNoSQL MongoDB backend per OpenERP. Permet la creació i emmagatzematge d'objectes mitjançant NoSQL. Es pot interactuar amb les dades de la mateixa manera que amb PostgreSQL desde el client.\n "
34+
35+
#. module: mongodb_backend
36+
#: code:addons/mongodb_backend/orm_mongodb.py:437
37+
#, python-format
38+
msgid "Error"
39+
msgstr "Error"
40+
41+
#. module: mongodb_backend
42+
#: code:addons/mongodb_backend/orm_mongodb.py:438
43+
#, python-format
44+
msgid "Bad order declaration for model %s"
45+
msgstr "Declaració incorrecta del ordre per al model %s"

i18n/es_ES.po

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Translation of OpenERP Server.
2+
# This file contains the translation of the following modules:
3+
#
4+
# Translators:
5+
# Jaume Florez Valenzuela <[email protected]>, 2017.
6+
msgid ""
7+
msgstr ""
8+
"Project-Id-Version: GISCE-ERP\n"
9+
"Report-Msgid-Bugs-To: https://github.com/gisce/erp/issues\n"
10+
"POT-Creation-Date: 2017-10-24 11:27\n"
11+
"PO-Revision-Date: 2017-10-24 09:34+0000\n"
12+
"Last-Translator: Jaume Florez Valenzuela <[email protected]>\n"
13+
"Language-Team: Spanish (Spain) <[email protected]>\n"
14+
"MIME-Version: 1.0\n"
15+
"Content-Type: text/plain; charset=UTF-8\n"
16+
"Content-Transfer-Encoding: \n"
17+
"Language: es_ES\n"
18+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
19+
20+
#. module: mongodb_backend
21+
#: model:ir.module.module,shortdesc:mongodb_backend.module_meta_information
22+
msgid "MongoDB Backend"
23+
msgstr "MongoDB Backend"
24+
25+
#. module: mongodb_backend
26+
#: model:ir.module.module,description:mongodb_backend.module_meta_information
27+
msgid ""
28+
"\n"
29+
"NoSQL MongoDB backend for OpenERP. It allows to create objects and store\n"
30+
"all the data in a NoSQL way. You can interact with this data the same way\n"
31+
"as it was stored in PostgreSQL from the client.\n"
32+
" "
33+
msgstr "\nNoSQL MongoDB backend para OpenERP. Permite la creación y almacenaje de datos con NoSQL. Puede interactuar con los datos de la misma forma que con PostgreSQL desde el cliente.\n "
34+
35+
#. module: mongodb_backend
36+
#: code:addons/mongodb_backend/orm_mongodb.py:437
37+
#, python-format
38+
msgid "Error"
39+
msgstr "Error"
40+
41+
#. module: mongodb_backend
42+
#: code:addons/mongodb_backend/orm_mongodb.py:438
43+
#, python-format
44+
msgid "Bad order declaration for model %s"
45+
msgstr "Mala declaración del orden para el modelo %s"

i18n/mongodb_backend.pot

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Translation of OpenERP Server.
2+
# This file contains the translation of the following modules:
3+
# * mongodb_backend
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: OpenERP Server 5.0.14\n"
8+
"Report-Msgid-Bugs-To: [email protected]\n"
9+
"POT-Creation-Date: 2017-10-24 11:27\n"
10+
"PO-Revision-Date: 2017-10-24 11:27\n"
11+
"Last-Translator: <>\n"
12+
"Language-Team: \n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: \n"
16+
"Plural-Forms: \n"
17+
18+
#. module: mongodb_backend
19+
#: model:ir.module.module,shortdesc:mongodb_backend.module_meta_information
20+
msgid "MongoDB Backend"
21+
msgstr ""
22+
23+
#. module: mongodb_backend
24+
#: model:ir.module.module,description:mongodb_backend.module_meta_information
25+
msgid "\n"
26+
"NoSQL MongoDB backend for OpenERP. It allows to create objects and store\n"
27+
"all the data in a NoSQL way. You can interact with this data the same way\n"
28+
"as it was stored in PostgreSQL from the client.\n"
29+
" "
30+
msgstr ""
31+
32+
#. module: mongodb_backend
33+
#: code:addons/mongodb_backend/orm_mongodb.py:437
34+
#, python-format
35+
msgid "Error"
36+
msgstr ""
37+
38+
#. module: mongodb_backend
39+
#: code:addons/mongodb_backend/orm_mongodb.py:438
40+
#, python-format
41+
msgid "Bad order declaration for model %s"
42+
msgstr ""
43+

orm_mongodb.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,18 @@ def preformat_write_fields(self, vals):
222222
ss = self._columns[key]._symbol_set
223223
vals[key] = ss[1](value)
224224

225+
def exists(self, cr, uid, ids, context=None):
226+
collection = mdbpool.get_collection(self._table)
227+
228+
if not context:
229+
context = {}
230+
if not ids:
231+
return False
232+
233+
mongo_cr = collection.find({'id': ids}, ['id'])
234+
res = [x for x in mongo_cr]
235+
return True if res else False
236+
225237
def read(self, cr, user, ids, fields=None, context=None,
226238
load='_classic_read'):
227239

0 commit comments

Comments
 (0)