Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions base_import_strip/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

===================
Base Import - Strip
===================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:7b7615161bb5ade8db8e191e77c5956985c469e5129485193892a557bb86b5ab
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--backend-lightgray.png?logo=github
:target: https://github.com/OCA/server-backend/tree/16.0/base_import_strip
:alt: OCA/server-backend
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-backend-16-0/server-backend-16-0-base_import_strip
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-backend&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module extends the ``base_import`` odoo module.

by default, in odoo, if a spreadsheet contains the value ' France ' in
a column 'country_id' the according item (``base.fr``) will not be found
because Odoo realize a strict search.
This module 'strip' all the values before importing, and so fixes such
cases.

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-backend/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/server-backend/issues/new?body=module:%20base_import_strip%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* GRAP

Contributors
~~~~~~~~~~~~

* `GRAP <https://www.grap.coop>`_:
* Sylvain LE GAL

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-legalsylvain| image:: https://github.com/legalsylvain.png?size=40px
:target: https://github.com/legalsylvain
:alt: legalsylvain

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-legalsylvain|

This module is part of the `OCA/server-backend <https://github.com/OCA/server-backend/tree/16.0/base_import_strip>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions base_import_strip/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
15 changes: 15 additions & 0 deletions base_import_strip/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2026 - GRAP - Sylvain LE GAL
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Base Import - Strip",
"summary": "Remove whitespaces at the beginning and end of values"
" when importing data from sheets .(csv, ods, ...)",
"version": "16.0.1.0.0",
"category": "Tools",
"website": "https://github.com/OCA/server-backend",
"author": "GRAP, Odoo Community Association (OCA)",
"maintainers": ["legalsylvain"],
"license": "AGPL-3",
"depends": ["base_import"],
}
6 changes: 6 additions & 0 deletions base_import_strip/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_import_strip
#
msgid ""
msgstr ""
1 change: 1 addition & 0 deletions base_import_strip/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import base_import_import
13 changes: 13 additions & 0 deletions base_import_strip/models/base_import_import.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2026 - GRAP - Sylvain LE GAL
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models


class BaseImportImport(models.TransientModel):
_inherit = "base_import.import"

def _read_file(self, options):
nb_rows, rows = super()._read_file(options)
if not self.env.context.get("base_import_strip_disabled"):
rows = [[x.strip() for x in row] for row in rows]
return nb_rows, rows
2 changes: 2 additions & 0 deletions base_import_strip/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* `GRAP <https://www.grap.coop>`_:
* Sylvain LE GAL
7 changes: 7 additions & 0 deletions base_import_strip/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This module extends the ``base_import`` odoo module.

by default, in odoo, if a spreadsheet contains the value ' France ' in
a column 'country_id' the according item (``base.fr``) will not be found
because Odoo realize a strict search.
This module 'strip' all the values before importing, and so fixes such
cases.
Loading
Loading