Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
you must have a relation field between class account voucher (but you do not give this information), with example I give after, with field voucher_id in class record, and use a field type related or function (use function type for better performance) depending of the amount field in class voucher which will give the value in the field amount in record class when field amount change in class voucher.
Never use an onchange for that because if I do a write from a function in current class or a write from an other class in this field, the onchange will be not used and the value will not change in the record class.
from openerp import models, fields, api
voucher_id = fields.Many2one('account.voucher', 'Voucher')
amount = fields.Float(compute='_get_voucher_amount', string='Voucher amount')
self.amount = self.voucher_id.amount
here i using odoo 8. after press the amount in account.voucher model. u can get the amount value in another model. for that u just simply inherit the model in ur current model and use that value in ur current model.
from openerp import models, fields, api, _
_inherit = 'account.voucher'
def onchange_amount(self, amount, rate, partner_id, journal_id, currency_id, ttype, date, payment_rate_currency_id, company_id):
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
|Asked: 4/3/15, 3:35 AM|
|Seen: 867 times|
|Last updated: 4/5/15, 9:29 PM|