What does this code in account.move.line means?

Asked by Cuong

Hi,

This code is from method reconcile of class account_move_line, line about 896 (due to my modifications, so the line is not exactly from the original source)
===
 r_id = move_rec_obj.create(cr, uid, {
            'type': type,
            'line_id': map(lambda x: (4, x, False), ids),
            'line_partial_ids': map(lambda x: (3, x, False), ids)
        })
===

Why using (4,x,False) to for line_id creation. (4,x,False), (3,x,False) ?

Thanks,

Question information

Language:
English Edit question
Status:
Solved
For:
Odoo Server (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Solved by:
digitalsatori(Shine IT)
Solved:
Last query:
Last reply:
Revision history for this message
Cuong (bhcuong2008) said :
#1

file: addons/account/account_move_line.py
module: account

Revision history for this message
Best digitalsatori(Shine IT) (digitalsatori) said :
#2

for many2many or one2many field:

                 (0, 0, { values }) link to a new record that needs to be created with the given values dictionary
                 (1, ID, { values }) update the linked record with id = ID (write *values* on it)
                 (2, ID, False) remove and delete the linked record with id = ID (calls unlink on ID, that will delete the object completely, and the link to it as well)
                 (3, ID, False) cut the link to the linked record with id = ID (delete the relationship between the two objects but does not delete the target object itself)
                 (4, ID, False) link to existing record with id = ID (adds a relationship)
                 (5, False, False) unlink all (like using (3,ID) for all linked records)
                 (6, 0, [IDs]) replace the list of linked IDs (like using (5) then (4,ID) for each ID in the list of IDs)

Revision history for this message
Cuong (bhcuong2008) said :
#3

Hi digitalsatori,

Thank you very much for your guide.
Could you show me where to find documents about this.

Revision history for this message
Lorenzo Battistini (elbati) said :
#4
Revision history for this message
Cuong (bhcuong2008) said :
#5

Thank you very much.

Revision history for this message
Cuong (bhcuong2008) said :
#6

Thanks digitalsatori, that solved my question.