Odoo Help


One2many through wizard, (without errors, but no add to the record)

Antonio Fernandez
on 2/3/16, 9:51 AM 685 views

Hi, I am a beginner and do not know that failure can have my code. I'm trying to pass a value from a field in the wizard to a field one2many from parent form. No errors, but it adds nothing. The function is called from a button at the wizard. Please, I need to know that in my code fails

Here is the code:


# -*- coding: utf-8 -*-
from openerp import models, fields, api
import openerp.exceptions
class wizard_box(models.TransientModel):
_name = 'test_am.wizard_box'
name = fields.Char(string="Box")
    def assing_value(self):                                                                                             self.env['test_am.delivery_note'].write({'assing_box': (0, 0,{'name': 'self.name'})})


class test_am_delivery_note(models.Model):
_name = 'test_am.delivery_note'
assing_box = fields.One2many('test_am.box','name', 'Boxes')

Thanks for the help in advance!


Jignesh Mehta

--Jignesh Mehta--
| 6 5 8
Surat, India
--Jignesh Mehta--

- I have 3+ years of Industry Experience, specializing Odoo Development, Analysis, Customization, Implementation, Integration.
- I have done many Customization modules in Sale, Purchase, Point of Sale, Inventory, CRM and much more. Also Worked in the Odoo Themes like Business Theme or E-Commerce Theme.
- Develop Jewelery Manufacturing process from Scratch. It have more than 10 Department. Develop PDF and Excel reports for this project around 150 per format.

Jignesh Mehta
On 2/3/16, 10:56 PM

Hello Antonio,

Try below method.


def assign_value(self):

    test_obj = self.env['test_am.delivery_note'].browse(self._context.get('active_id'))

    for test in test_obj:

        self.name = test.name

Hope it works for you.


can I use (self._context.get('active_id') if my record is not saved? or If I am creating new record ?

Solanki Shamji
on 2/4/16, 4:28 AM

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.


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

1 follower(s)


Asked: 2/3/16, 9:51 AM
Seen: 685 times
Last updated: 2/3/16, 10:56 PM