Odoo Help


How to use create and write on function fields

on 5/12/16, 12:50 PM 732 views

Hello everyone,

I have a new object and I need to write on the field 'credit' on the class account.account which is a function fields how can I do it and thanks a lot

class kms_remise(osv.osv):


def create(self, cr, uid, vals, context=None):

result = super(kms_remise, self).create(cr, uid, vals, context=context)

check_remise_obj = self.browse(cr, uid, result, context=context)

bank_account = check_remise_obj.bank.id

bank_name = check_remise_obj.bank.journal_id.name

print 'bank_name', bank_name

account_obj= self.pool.get('account.account').search(cr, uid, [('name','=',bank_name)])

print 'account_obj', account_obj

if bank_account:

for check in check_remise_obj.check_line:

bank_amount = check.amount

print ' bank_amount', bank_amount

self.pool.get('account.voucher').write(cr, uid, check.id,{'bank':bank_account})

self.pool.get('account.account').write(cr, uid, account_obj,{'credit':bank_amount})

return result

_columns = {

'bank': fields.many2one('res.partner.bank', 'Bank account'),

'check_line': fields.many2many('account.voucher','check_remise_ref','remise_id','voucher_id','Checks List'),


odoo.ma by IBS Group

--odoo.ma by IBS Group--
| 4 6 8
Tétouan, Morocco
--odoo.ma by IBS Group--

For more informations about IBS, please visit our website at www.ibs-na.com.

For a specific questions, collaboration or help, please send us an email to support@ibs-na.com

odoo.ma by IBS Group
On 5/12/16, 1:16 PM

Computed fields are not supposed to be modified directly, you need to change your strategy.

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: 5/12/16, 12:50 PM
Seen: 732 times
Last updated: 5/13/16, 3:28 AM