Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Nekilnojamasis turtas
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Konsultavimas
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Maistas
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Saulės energijos sistemos
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Kiti
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

How to import csv file on odoo

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
xmlqwebjsodooV8
3 Replies
11683 Rodiniai
Portretas
Rihene

Hello friends!!

I have tried this for you!!

Who can help me enrich this code as a work team ;)

XML:

< class="oe_web_example_message">Press to upload!/h3>

<p class="oe_web_example_file">

<input type="file" id="fileUpload" name="file" />

<button>entire file</button>

</p>

<p class="oe_web_example_filesa" id="dvCSV">

<textarea name="dvCSVs" rows="4" cols="50"></textarea>

</p>

</div>

</templates>

Js:


openerp.test_paie = function (instance)

{

var QWeb = instance.web.qweb;

var _t = instance.web._t;

instance.seetek_paie.Mywidget = instance.web.form.FormWidget.extend(instance.web.form.ReinitializeWidgetMixin,{

template : "seetek_paie.Mywidget",

events: {

'click .oe_web_example_file button': 'Upload',

},

Upload: function () {

var fileUpload = document.getElementById("fileUpload");

var regex = /^([a-zA-Z0-9\s_\\.\-:])+(.csv|.txt)$/;

if (regex.test(fileUpload.value.toLowerCase())) {

if (typeof (FileReader) != "undefined") {

var reader = new FileReader();

var tabResult = new Array();

reader.onload = function (e) {

var table = document.createElement("table");

var rows = e.target.result.split("\n");

var y = new Array();

var matricule = new Array();

for (var i = 0; i < (rows.length - 1); i++) {

var row = table.insertRow(-1);

var cells = rows[i].split(",");

if (cells[0] != 0)

{ var mat = cells[0];}

console.log("La" + i + "ème matricule est \n"+ mat);

if (cells[0]!= "")

{matricule.push(cells[0]);}

// Affiche doc

for (var j = 0; j < cells.length; j++) {

var cell = row.insertCell(-1);

cell.innerHTML = cells[j];

}

}

console.log(matricule);

var days = new Array();

var heures = new Array();

for (var i = 1; i < rows.length; i++) {

var row = table.insertRow(-1);

var cells = rows[i].split(",");

days = rows[0].split(",");

var obj = {};

var obj2 = {};

for (var j = 0; j < cells.length; j++) {

obj2[j] = cells[j];

}

obj[i] = obj2;

heures.push(obj);

}

var my_jsons_days;

var my_jsons_days_all = new Array();

var oups;

for (var i = 0; i < (rows.length - 2); i++) {

var my_jsons_days_all_temp = new Array();

for (var dd = 1; dd < days.length; dd++) {

var z;

if (heures[i][i+1][dd] > 0) { z = 'T';} else {z = 'A'; }

my_jsons_days = {"day":days[dd],"hours":heures[i][i+1][dd],"nature":z};

my_jsons_days_all_temp.push(my_jsons_days);

}

oups = {"days": my_jsons_days_all_temp};

var jsonStrssEM = JSON.stringify(oups);

console.log(jsonStrssEM);

var node = document.createElement("LI");

var textnode = document.createTextNode(jsonStrssEM);

node.appendChild(textnode);

document.getElementById("myList2").appendChild(node);

}

var dvCSV = document.getElementById("dvCSV");

dvCSV.innerHTML = "";

dvCSV.appendChild(table);

}

reader.readAsText(fileUpload.files[0]);

} else {

alert("This browser does not support HTML5.");

}

} else {

alert("Please upload a valid CSV file.");

}

},


});

instance.web.form.custom_widgets.add('momo1', 'instance.test_paie.Mywidget');

};

Ihave tried it to upload a csv file and then make some treatment.

I didnt finish it yet you can use it and change it as you want ;)

1
Portretas
Atmesti
PY

Hello. First, use the code markup, and indent your code, please. Then, why doing a widget, when you can import csv files through the regular interface ? Did you read the documentation ?

Akhil P Sivan

Hi Drees, I have did custom modules to import the csv of bank statements, bill of materials (based on some conditions) etc. For both odoo 8 and 7. I did using a wizard and file object to read content from csv and functions to write the content to database. I can help you, if you have any doubts: akhilpsivan@outlook.com. And PY, if you want to check some conditions or do some process before importing data, its not possible through regular interface.

Rihene
Autorius

can you post your code to use

Portretas
superpan86
Best Answer

Do you have to add the widget or something in your "columns" from your .py file?Or in your __openerp__.py?

In the xml file it would be something like this: <field name="name"  widget="MyWidget" />?


0
Portretas
Atmesti
Portretas
Rihene
Autorius Best Answer

In the __openerp__.py file, you have to add attributes like this:


js': ['static/src/js/xxxxx.js'],

'css': ['static/src/css/xxxxxx.css'],

'qweb': ['static/src/xml/xxxxxxx.xml'],

Like in this link:

http://openerp-web-v7.readthedocs.org/en/latest/module.html

0
Portretas
Atmesti
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registracija
Related Posts Replies Rodiniai Veikla
how to pass data from Qweb to javascript in odoo 12.
xml qweb event js
Portretas
0
birž. 21
3666
How to modify the position of the <tr> tags in reports under Accounting Reports and Journal in Odoo 8?
xml qweb odooV8 qweb-report
Portretas
0
spal. 16
4314
Hide base module button with inheritance Solved
xml hide js odooV8
Portretas
1
geg. 16
5701
odoo17 qweb boolean t-if condition in xml not working as expected
xml qweb boolean odooV8 odoo17
Portretas
Portretas
1
saus. 25
1845
Is it possible to include client_order_ref in a picking report? Solved
xml qweb picking report odooV8
Portretas
Portretas
Portretas
3
liep. 23
7987
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now