تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
3423 أدوات العرض

I'm trying to make it so that when I click a button on an invoice, to update the individual unit price for each invoice line by a factor specified in a custom field. I know how to put the button, and define the fields and all that, but I can't seem to figure out the python code that i need to put in my function. I've managed to create this:

    def button_convert_unitprice(self, cr, uid, ids, context=None):
        if context is None:
            context = {}
        for id in ids:
            lines = self.browse(cr, uid, id, context=context).invoice_line
            val=self.browse(cr, uid, id, context=context).x_multiplier
            for line in lines:
                line.price_unit=line.price_unit*val
        self.button_reset_taxes(cr, uid, ids, context)
        return True

Unfortunately it doesn't do aything but refresh the page, and I'm completely lost in this odoo syntax. Can someone please point me the right direction with a working example somewhere? I know this is usualy done by onchange events, but I need it to be manually on click.

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
يناير 25
1907
2
سبتمبر 22
9663
2
أبريل 22
4691
0
يوليو 21
7332
1
مارس 21
5066