<field eval="[(6,0,[])]" name="child_consol_ids"/>

Asked by aymen on 2013-03-28

Hello, i'm asking if someone can help me and explain to me what this code return :
<field eval="[(6,0,[])]" name="child_consol_ids"/>

"child_consol_ids" is a field in account_account and his type is "one2many"

Question information

Language:
English Edit question
Status:
Solved
For:
Odoo Addons (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Solved by:
aymen
Solved:
2013-04-04
Last query:
2013-04-04
Last reply:
2013-04-04

This erases the value of the many2many, or one2many field 'child_consol_ids' by writing an empty set of ids. More about manipulating x2many field values here: http://stackoverflow.com/questions/9377402/insert-into-many-to-many-openerp/9387447#9387447

Aymen,

This specifies that the 'child_console_ids' field of your model does not contain any value by specifying [].

Functionally, there are no consolidated accounts when the articular account was created.

Thanks.

aymen (alaya-mohamedaymen) said : #3

Stefan, Serpent,
Thank you so much for your answers , that helped me so much

aymen (alaya-mohamedaymen) said : #4

Hello, i tried to do as u said and as it's mentioned on the link but it doesn't work.
i tried to do this : <field name="child_consol_ids" eval="[(6,0,[ref('account231000')])]"/>
'account231000' is the id of a record
Thereare nor errors but it does'nt return any result

Try module.xml_id. I've experienced this for csv Id not being recognized.

Otherwise, trace ORM, you will get the reason why.

Thanks.

aymen (alaya-mohamedaymen) said : #6

I tried that but i have the same result. Otherwise, i think that may not have any effects because i work on the same module, so there are no differences between putting the name of the module or not

The next big thing is:
1. Make sure you xml gets encountered or not.
2. debug what is being considered when your xml is getting parsed!

Thanks.

aymen (alaya-mohamedaymen) said : #8

i checked everything, all records are generated just the field "child_consol_ids" is still empty

Interesting,

Would you please send some code here if you want us to help you?

Thanks.

aymen (alaya-mohamedaymen) said : #10

I'm trying to generate accounts from a template, i created the accounts by
the following manner :
<record id="account21" model="account.account.template">
            <field name="code">21</field>
            <field eval="1" name="reconcile"/>
            <field name="name">Immobilisations incorporelles </field>
            <field model="account.account.type" name="user_type"
search="[('name', '=', u'Vue')]"/>
            <field name="parent_id" ref="account2"/>
            <field name="type">view</field>
</record>

but in some accounts i need to specify some consolidated child, so i tried
to do that by this code:
<record id="accountBA111-IMM-INCOR" model="account.account.template">
            <field name="code">BA111-IMM-INCOR</field>
            <field eval="0" name="reconcile"/>
            <field name="name">Immobilisations incorporelles</field>
            <field model="account.account.type" name="user_type"
search="[('name', '=', u'Vue')]"/>
            <field name="parent_id" ref="accountBA11-AI"/>
            <field name="child_consol_ids"
eval="[(6,0,[ref('account21')])]"/>
            <field name="type">consolidation</field>
 </record>

this works normally in some other modules, but i don't know why it didn't
work here

2013/4/2 Serpent Consulting Services <email address hidden>

> Your question #225368 on OpenERP Addons changed:
> https://answers.launchpad.net/openobject-addons/+question/225368
>
> Serpent Consulting Services proposed the following answer:
> Interesting,
>
> Would you please send some code here if you want us to help you?
>
> Thanks.
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
>
> https://answers.launchpad.net/openobject-addons/+question/225368/+confirm?answer_id=8
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/openobject-addons/+question/225368
>
> You received this question notification because you asked the question.
>

--

Cordialement,

  ALAYA Mohamed Aymen
  Élève ingénieur en Ingénierie Logicielle et Systèmes d'Information
  *É*cole *N*ationale des *S*ciences de l'*I*nformatique

Aymen,

child_console_ids canot be added to template, this is not one of the fields for template, but is for account.

Thanks.

aymen (alaya-mohamedaymen) said : #12

I created a class which inherits from account_account_template and i added this field typically with the field created on account_account

Override create() and see whether the table gets filled up with the values or not!

aymen (alaya-mohamedaymen) said : #14

sorry but i didn't understand you, could you explain to me what i have to do exactly?

Are you aware about create()? If yes, override to see what gets counted for creation of template!
Thanks.

aymen (alaya-mohamedaymen) said : #16

the problem were in the method "generate account" , i had to add the field child_consol_ids in the account_account_template, then redefine the method "generate account" with some changes , but the problem now is that can just specify only one value to child_account_ids.
i specify the values by this manner:
when i put :<field name="child_consol_ids" eval="[(6,0,[ref('account21')])]"/> it works but
when i want to add other values like this:
<field name="child_consol_ids" eval="[(6,0,[ref('account21',account231000',account237')])]"/> it doesn't work and doesn't return any result

aymen (alaya-mohamedaymen) said : #17

i tried also this : <field name="child_consol_ids" eval="[(6,0,[ref('account21'),re('account231000'),ref('account237')])]"/> but it doesn't return any result also

aymen (alaya-mohamedaymen) said : #19

yes unfortunately

aymen (alaya-mohamedaymen) said : #20

sorry for the disturbance but i will be so grateful if you help me to understand this. I would like to know the difference between writing ( eval="[(6,0,[ref('account21')])] ) and ( eval="[(6,0,[account21])] )
Thanks

The ref(XMLID) will give you the database referential id of the record for which the xmlid exists.

[account21] is of no use!

Thanks.

aymen (alaya-mohamedaymen) said : #22

thank you so much, i have solved the problem. I have forgot to put the parent_id of an account, so it will not be generated because it is not linked to the root, then i tried to associate it to child_consol_ids, so the error