To import account move lines you have two ways:
1 - from the form "Entries encoding by line" or "Entries encoding by move", 
open form and go to menu form -> import data. haven't tested.

2 - create a data module where you put either xml or csv files with data to 
import. csv files is easier, must have a file per object named 
"name.of.the.object.csv" those files must be declared in __terp__.py in section 
'update.xml'. See l10n_lu module for examples.

I've been testing this functionality, created files 
'account.move.csv' with fields 
"id","ref","name","type","journal_id:id","state","period_id:id","date"

and 'account.move.line.csv' with fields
"id","account_id:id","period_id:id","date","name","journal_id:id","credit","state","move_id:id","debit","date_created","ref"
fields names go in the file firt line

foreign keys fields are named 'field_name:id' like 'account_id:id' or 
'move_id:id'
the foreign keys ids are the id strings used in xml or csv import files. those 
strings are stored on table ir_module_data. 
I fyou want to reference journals or accounts that were not imported through 
data modules, they will have no record in ir_module_data an dyou'll get an 
"IndexError: list index out of range"

A woraround is to apdate ir_module_data inserting there the records you need. 
In my case in inserted records for accounts generated from template with this 
query executed in pgadmin

INSERT INTO ir_model_data (create_uid, create_date, noupdate, name, 
date_init, date_update, module, model, res_id)
SELECT 1, '2009-01-01', 'TRUE', code, '2009-01-01', '2009-01-01', 
'--your.module.name--', 'account.account', id
FROM account_account
WHERE code < '881' AND type <> 'view' 

Maybe there's a cleaner way, it worked for me. 
You can also check this thread http://www.openobject.com/forum/topic10606.html




-------------------- m2f --------------------

--
http://www.openobject.com/forum/viewtopic.php?p=35566#35566

-------------------- m2f --------------------


_______________________________________________
Tinyerp-users mailing list
http://tiny.be/mailman/listinfo/tinyerp-users

Reply via email to