Skip to content

Instantly share code, notes, and snippets.

View oussama-ht's full-sized avatar

Ben Rejeb Oussama oussama-ht

  • RTE
  • France
View GitHub Profile
@oussama-ht
oussama-ht / scrapy_csv_exporter.md
Created June 26, 2018 16:08 — forked from jbinfo/scrapy_csv_exporter.md
How to create a Scrapy CSV Exporter with a custom delimiter and order fields

Create a scrapy exporter on the root of your scrapy project, we suppose the name of your project is my_project, we can name this exporter: my_project_csv_item_exporter.py

from scrapy.conf import settings
from scrapy.contrib.exporter import CsvItemExporter

class MyProjectCsvItemExporter(CsvItemExporter):

    def __init__(self, *args, **kwargs):
 delimiter = settings.get('CSV_DELIMITER', ',')

Odoo - Rename an addon without losing data

Rename addon

  • Change __openerp__.py addon name field
  • Change README.rst file
def is_valid_barcode(value):
if not isinstance(value, str):
return False
if len(value) not in [8, 12, 13, 14, 17, 18]:
return False
if len(value) != 18:
number_zero_to_add = 18 - len(value)
value = '0' * number_zero_to_add + value