Odoo Help


How to get value from many2one relationship and update it to a new field?

on 11/29/14, 9:48 AM 900 views

How can I get initialending from test.weeklyperiod and update it to ending from test.product. Please help me to solve this .Thank you

class test_product(osv.Model):
    _name = "test.product"

    _columns = {
        'prodcode_id': fields.many2one("test.prodcode", 'Product Code'),
        'weeklyperiod_id': fields.many2one('test.weeklyperiod', 'Periods Covered', ondelete='cascade'),
        'price': fields.float('Price', digits=(12,2)),
        'beginning': fields.integer('Beginning'),
        'ending': fields.function(get_endings, method=True,type='integer',string='Ending', store=True),

class weeklyperiod(osv.Model):
    _name = "test.weeklyperiod"
    _columns = {
        'start_date': fields.date('Start Date'),
        'end_date': fields.date('End Date'),
        'name': fields.char('Periods', size=32, required=True),
        'initialbeginning': fields.integer('Initial Beginning', size=32, ondelete='cascade'),
        'initialending': fields.integer('Initial Ending', size=32, ondelete='cascade'),

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: 11/29/14, 9:48 AM
Seen: 900 times
Last updated: 3/16/15, 8:10 AM