Odoo Help

0

Server Actions Fields Mapping Openerp 7

By
George Tsagkogeorgas
on 6/14/13, 10:54 AM 2,233 views

I want with a server action (Create Object) to create a new Object Invoice. In fields mapping I set model Invoice and

Destination - Type - Value

Partner - Formula - object.partner_id.id

Journal - Formula - object.journal_id.id

Account - Formula - object.account_id.id

Invoice Lines - Formula - object.invoice_line

I get error for Invoice Lines: KeyError: "Field '0' does not exist in object 'browse_record(account.invoice.line, 80)'" How can I set the value for the Invoice Lines?

0
Ghanshyam Prajapati
On 6/14/13, 6:39 PM

For one2many field, You should use 1st option,

1) (0, 0, { values }) - link to a new record that needs to be created with the given values dictionary

2) (1, ID, { values }) - Update the linked record with id = ID (write values on it)

3) (2, ID) - 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)

Example:

[(0, 0, {'field_name':field_value_record1, ...}), (0, 0, {'field_name':field_value_record2, ...})]

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)

Stats

Asked: 6/14/13, 10:54 AM
Seen: 2233 times
Last updated: 3/16/15, 8:10 AM