Odoo Help

Welcome!

This community 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.

0

Server Actions Fields Mapping Openerp 7

By
George Tsagkogeorgas
on 6/14/13, 10:54 AM 1,905 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

--Ghanshyam Prajapati--
1377
| 4 4 8
Pune, India
--Ghanshyam Prajapati--
OpenERP Developer
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, ...})]

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

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