Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

How to import CSV with multiple lines (same ID)

Subscriure's

Get notified when there's activity on this post

This question has been flagged
modulecustomodoo8.0
1 Respondre
8946 Vistes
Avatar
Dr Obx

Guys, how can I import data from CSV file but if for example some lines contains data related to the same "order number"? 

Picture below should explain everything.


Same customer, multiple items. I would like to combine it into one single record.

| 143306 | 18-Sep-2015 | 18-Sep-2015 | 250869522623 Full Height Matrox G550 PCI Card F7011-0001G55MDDAP32DB,
 260747082667 Matrox G200 MMS Quad Display Graphics Card 4 DVI fp, 261084913104 NVidia NVS285 PCI-E x16 New Shape 128MB Low Profile Card+Dual DVI Splitter Cable | .....

Or maybe every record should contain a table (many2one fields)?

Going that way I added a class:

class item_list(models.Model):
_name = 'item.list'
_description = "Item list in record"
nitem_id = fields.Many2one('item_id')
nitem_title = fields.Many2one('item_title')
nquantity = fields.Many2one('quantity')
item_log_id = fields.Many2one('item_list','Product')
and in main class I added
items_list = fields.One2many('item.list','item_log_id', string="Items ordered ⇒")

   Now loading a data from CSV and still got nothing not even one item is added :(


0
Avatar
Descartar
Avatar
Pawan
Best Answer

Dr Obx,

you can use the following format for your csv file to add the data if you are using systems default import functionality.

You don't need to give the order name again in every line, just change the product and quantity in every next line for same orders.:

Order Date,Order Reference,Supplier,Destination,Pricelist,Order Lines / Product,Order Lines / Quantity

2012-12-15,PO00008,ASUSTeK,Stock,Default Purchase Pricelist,ADPT,20

,,,,,CARD,30

,,,,,C-Case,40

2012-12-15,PO00009,Axelor,Stock,Default Purchase Pricelist,CD,5

,,,,,CPUa8,15

Hope this will help you

0
Avatar
Descartar
Dr Obx
Autor

Hi Pawan, unfortunately I have no choice, CSV file comes from outside source so I prefer not to change anything (to be hones for me it doesn't matter but third person can have a problem with it) so better if it will as it is (CSV file). As we spoken earlier, I just importing ready (downloaded) CSV file without change option :)

Pawan

then you have to write a customized functionality for reading a csv file and import data from it for creating your orders...

Dr Obx
Autor

Should be data written into the table into class which inherits from parent class ?

Dr Obx
Autor

or is it there but need to be loaded into the table ?

Dr Obx
Autor

Studying examples ... still not found how to ...

Pawan

where are you stucked??

Dr Obx
Autor

It's difficult to say where i'm not stucked :) I just need one more time to do everything step by step with you i guess ;) First thing: I created a class order_lines and inside this class I have item_id, item_title, quantity, sale_price. However I found that is a very bad idea because a lot of other things require item_id for example. So once I update module getting a lot of errors :) However, sorted it out but still when I'm trying to load CSV it won't load anything into those fields. Also, getting errors like:

2015-09-23 09:38:13,562 4533 WARNING GNG openerp.fields: Field order.lines.item_order_line with unknown comodel_name 'iprodstep_log'
2015-09-23 09:38:13,562 4533 WARNING GNG openerp.fields: Field order.lines.item_title with unknown comodel_name 'iprodstep_log'
2015-09-23 09:38:13,562 4533 WARNING GNG openerp.fields: Field order.lines.item_id with unknown comodel_name 'iprodstep_log'
2015-09-23 09:38:13,563 4533 WARNING GNG openerp.fields: Field order.lines.sale_price with unknown comodel_name 'iprodstep_log'
2015-09-23 09:38:13,563 4533 WARNING GNG openerp.fields: Field order.lines.sales_record_number with unknown comodel_name 'iprodstep_log'
2015-09-23 09:38:13,800 4533 WARNING GNG openerp.fields: Field product.line.state with unknown comodel_name 'iprodstep_log'
I know why, baceuse in this class 'order_lines' I should create a fields like: item_id = fields.Char() but I tried with item_id = fields.Many2one(). So once I add:
#----------------- Order lines ----------------
class order_lines(models.Model):
	_name = 'order.lines'
	_description = 'Order lines'
	
	item_order_line = fields.Many2one('iprodstep_log','Item')
	item_id = fields.Char()
	item_title = fields.Char()
	quantity = fields.Integer()
	sale_price = fields.Char()

	
#----------------- Main class -----------------    
class iprodstep_log(models.Model):
	_name = 'iprodstep.log'
	_description = 'iprodstep log'
	_inherit = ['ir.needaction_mixin','order.lines']

#------------------ Sub table -----------------
	order_line = fields.One2many('order.lines','item_order_line',string='item lines')

#--------- Sub table related fields -----------
	item_id = fields.Char('Item Number')
	item_title = fields.Char('Item Title')
	quantity = fields.Integer('Quantity')
	sale_price = fields.Char('Sale price')

I have a table but how can i write some data from one class to another ? Tried using write:
			record.write({'order_lines.item_id': 'item_id'})
2015-09-23 11:29:03,314 6987 WARNING GNG openerp.models: iprodstep.log.write() with unknown fields: order_lines.item_id
Dr Obx
Autor

New week, new, ideas, new challenges ! Any thoughts how to solve this issue ??

Pawan

New week, new ideas, new challenges, and new solution.... new problem.... ;)

Pawan

anyway, please provide a brief what has been done till now in that....

Dr Obx
Autor

Hi Pawan, been busy last week, so I had no time to try. This week I will buid custom import module and I hope it will work :):)

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

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

Registrar-se
Related Posts Respostes Vistes Activitat
Custom Module Not Populating in Apps List Solved
module custom
Avatar
Avatar
4
d’oct. 20
9941
Import data from CSV
module import data custom odoo8.0
Avatar
0
d’oct. 15
4203
How can I create a Popup Message? Solved
modules custom odoo8.0
Avatar
Avatar
Avatar
Avatar
Avatar
4
d’oct. 25
16382
For Odoo hosted version, how would I upload a custom module? Solved
module upload custom
Avatar
Avatar
Avatar
Avatar
3
de febr. 24
11538
importing custom module
module custom importing
Avatar
Avatar
1
de nov. 23
3858
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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