El 19/04/18 a les 18:14, Richard PALO ha escrit:
> Le 19/04/2018 à 17:38, Cédric Krier a écrit :
>> On 2018-04-18 17:40, Richard PALO wrote:
>>> In the French plan, there are unfortunately 7 instances of
>>> account_account_type_template
>>> with the name 'Autres'... but in the xml, there are indeed unique
>>> ID's...
>>>
>>> Is the mapping of these (xml id => sql id) stored somewhere it can be
>>> accessed
>>> to somehow facilitate import?
>>
>> In "ir.model.data".
>
> Great, for example in my case in hand I find a record with
> fs_id = 'creances_autres' having db_id = 196
> which is correct for account_account_type_template
>
> Guess I'm not sure what do I need to do to get 'creances_autres' (unique
> xml id)
> to work instead of using the name 'Autres' for the 'type' (last field in
> account.csv)
> Seems account_account_type_template record id's differ from
> account_account_type ids.
You can use the following code to get the db ids:
pool = Pool()
ModelData = pool.get('ir.model.data')
db_id = ModelData.get_id('account_fr', 'creances_autres')
And then you can get the type of your company with:
Type = pool.get('account.type')
type, = Type.search([('company', '=', company.id), ('template', '=',
db_id)])
--
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk
--
You received this message because you are subscribed to the Google Groups
"tryton-dev" group.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tryton-dev/51bd2d6a-680e-5556-5b94-eea42d0eb58d%40koolpi.com.