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

I ask if can set a float value in fields.function(_funct_total, ), without use cur_obj.round(cr, uid, cur, val) in my framework module ???

By
AKRAM
on 11/3/15, 10:09 AM 264 views

def _amount_all(self, cr, uid, ids, field_name, arg, context=None):

res = {}

for inter in self.browse(cr, uid, ids, context=context):

res[inter.id] = {

'amount_total': 0.0,

}

val = 0.0

for line in inter.ligneinter_ids:

val += line.total_line

res[inter.id]['amount_total'] = val

return res


'amount_total': fields.function(_amount_all, string='Total', type='float', digits_compute=dp.get_precision('Account'), help="The total amount."),

I resolve this problem by the modify in function: def _amount_all(self, cr, uid, ids, field_name, arg, context=None): res = {} for inter in self.browse(cr, uid, ids, context=context): val = 0.0 for line in inter.ligneinter_ids: val += line.total_line res[inter.id] = val return res this just for my framework module, thinks ;)

AKRAM
on 11/3/15, 10:38 AM

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/3/15, 10:09 AM
Seen: 264 times
Last updated: 11/3/15, 10:38 AM