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 multiply the percent value to another field

By
louie
on 2/19/15, 9:46 PM 540 views

how to multiply the percent value to another field? what i did, i have a field and on that field the number will be input and i sue the code + '%'to translate it in percent. so im gonna multiply it on another field which is the total of the other computation. but i encounter a error. can anybody help me with this????? i really need all your help to those prof. of this odoo or openerp.

Hi Louie,, can you please add more details..??

Baiju
on 2/20/15, 12:02 AM

paste your code.

Demirel yakito
on 2/20/15, 1:51 AM

You should add "%" sign using widget (you can extend existing widget) in javascript, not in python... then in python you'll have only a number value and you can use it as you need.

Temur
on 2/25/15, 3:52 AM

what is the code for that? i really need help

louie
on 3/2/15, 7:22 AM

i really need a sample code. since im a newbie...

louie
on 3/2/15, 7:23 AM
1
louie
On 3/27/15, 8:04 PM

def _show_percent(self, cr, uid, ids, field_names=None, arg=False, context=None):

    res = {}

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

        res[rec.id] = str(rec.numtopercentage) + "%"

    return res

class appraisal_report(osv.Model):

    _name = 'appraisal.report'

    _description = 'Appraisal Report'

    _columns = {

        'housevalue': fields.function(difference_year, string='House Value', type='char'),

        'numtopercentage': fields.float('% of Comp', required=True),

        'percentage': fields.function(_show_percent, string='Percentage', type='char'), }


so what i want is to multiply the house value to percentage. how could do that? what code should i write?

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

2 follower(s)

Stats

Asked: 2/19/15, 9:46 PM
Seen: 540 times
Last updated: 4/25/16, 10:37 AM