Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Welcome to csv2odoo's repository
csv2odoo
is a Python converter from the csv
format to OpenObject
data
models.
csv2odoo
is an easy way to import records from heterogeneous datas by editing
a simple script as the manner of Odoo
data model.
You can specify pre-treatment(s) before any records insertions, you can also,
according to criteria, omit the insertion of an entire record, mofify it or just
create it (CRUD abilities).
Some features of csv2odoo
include abilities of Python csv
module to specify
input file configuration. It also include some useful functions to make
specific value operations on each individual columns (See callbacks
for more
informations).
Sample::
#!/usr/bin/env python
#.. your_script.py
from csv2odoo import Model, Field, Odoo, Session
#
# Configure Odoo connection
#
odoo = Odoo(
host='198.168.0.1', port=8069,
user='admin', pwd='admin', dbname='database',
lang'fr_FR')
#
# Create a new importation instance::
#
session = Session(
'file.csv', delimiter=';', quotechar='"', encoding='utf-8',
offset=1, limit=10)
#
# Define your mapping to link both csv and Odoo::
#
# res.partner is unique by siren and will not be updated if exists
res_partner = Model('res.partner', fields=[
Field('name', columns=[1]),
Field('siren', columns=[2]),
Field('website', columns=[16]),
], update=False, search=['siren'])
# res.country is unique by code and name and will not be updated if exists
res_country = Model('res.country', fields=[
Field('code', columns=[13], default='FR'),
Field('name', columns=[13], default='FRANCE'),
], update=False, search=['code', 'name'])
# res.partner.address is unique by type and partner_id
res_partner_address = Model('res.partner.address', fields=[
# Simple fields, some with default value and some unique between records
Field('zip', columns=[9], default='35000'),
Field('city', columns=[10], default='RENNES'),
Field('phone', column=[14]),
Field('fax', columns=[15]),
Field('email', columns=[17], unique=True, ignore=True),
Field('cedex', columns=[68]),
# Mixing columns (by concatenation or selection)
Field('street', columns=[7, 6], method='selection'),
Field('street2', columns=[8, 5], method='concatenate'),
# Model's relations with res.partner which must exists
Field('country_id', relation=res_country),
Field('partner_id', relation=res_partner, required=True),
# Adding a custom value to a missing field in the `csv` file
Field('type', custom='delivery'),
], search=['type', 'partner_id'])
#
# Finally join objects to the session which starts the import process
#
# There is no particular needs to also inject res.partner model, as it's
# already contained as a relation of res.partner.address
session.bind(odoo, [res_partner_address, ])
#
# Optionaly: show statistics of records's activities during the importation process
#
csv2odoo.show_stats()
csv2odoo
support Python versions 2.7.
This software is made available under the LGPLv3 license.
Please, feel free to report bugs or suggestions in the Bug Tracker <https://bitbucket.org/StefMangin/python-csv2odoo/issues?status=new&status=open>
_!
FAQs
Python CSV to Odoo importation library
We found that csv2odoo demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.