Commit ec59a601 authored by Jorge Sanabria's avatar Jorge Sanabria
Browse files

2020-12-08 Update

parent a5852b9e
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
#lib/
#lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
#*.mo
#*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
.idea/
controllers/__pycache__/
models/__pycache__/
models/listings/__pycache__/
tests/__pycache__/
/i18n/*.mo
/.idea
/.directory
*.pyc
\ No newline at end of file
......@@ -6,7 +6,7 @@
'description': """Update data from csv files""",
'author': "Jorels, Jorge Sanabria",
'author': "Jorels SAS",
'website': "https://www.jorels.com",
'license': 'LGPL-3',
......
......@@ -30,16 +30,28 @@ class ResCompany(models.Model):
if line_count == 0:
_logger.debug(f'Column names are {", ".join(row)}')
field_names = row
# Insert
query = "insert into " + table_name + "("
for field_name in field_names:
query = query + field_name + ","
query = query + "create_uid,create_date,write_uid,write_date) values("
for field_name in field_names:
query = query + "$$" + row[field_name] + "$$,"
query = query + str(self.env.user.id) + ',NOW(),' + str(self.env.user.id) + \
',NOW()) ON CONFLICT DO NOTHING'
query = query + str(self.env.user.id) + ',NOW(),' + str(self.env.user.id) + ',NOW()) ON CONFLICT(id) DO UPDATE SET '
# Update
for field_name in field_names:
query = query + field_name + "=$$" + row[field_name] + "$$,"
query = query + "write_uid=" + str(self.env.user.id) + ",write_date=NOW()"
# Execute query
#_logger.debug(query)
self._cr.execute(query)
# Count
line_count += 1
self._cr.execute("select max(id) from " + table_name)
max_id = self._cr.dictfetchall()[0]['max']
self._cr.execute(f"SELECT setval('{table_name}_id_seq',{str(max_id + 1)}, true)")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment