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

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

By
philip
on 11/29/14, 9:48 AM 559 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'),
    }

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

1 follower(s)

Stats

Asked: 11/29/14, 9:48 AM
Seen: 559 times
Last updated: 3/16/15, 8:10 AM