Odoo Help


How to get total workers by button ? [Closed]

on 4/18/13, 5:42 AM 2,463 views

The Question has been closed

Sudhir Arya (ERP Harbor Consulting Services)
on 04/18/2013 06:51:23

my requirement like this when i adding workers in select workers tree view, then need to add total of them right side bottom total workers field.its ok its show when i'm going to save or when i clicked the (update) button. i refer the purchase module but i can't find what function exaclty called when that button clicked.

my whole code uploaded to here@GitHub refer line 397 in bpl_view.xml and line 335 in bpl.py

as per purchase module i wrote function.but its have only return statement.thats also confused to me.

def button_total(self, cr, uid, ids, context=None):
    return True

please advice me on this issue & please tell me why when clicked the button records save automatically.?its have only return True statement. ? ?



Sudhir Arya (ERP Harbor Consulting Services)

--Sudhir Arya (ERP Harbor Consulting Services)--
| 6 8 8
Ahmedabad, India
--Sudhir Arya (ERP Harbor Consulting Services)--

• Co-Founder & Co-Owner at ERP Harbor Consulting Services

• ERP Consultant / ERP Customization / TechnoFunctional Expert

• Sound knowledge in Python, Odoo (Open ERP), XML, PostgreSQL

• Domain knowledge of Sale Management, Purchase Management, Warehouse Management, Manufacturing, Multi Company Configuration & Management, HR Management, Medical Management, Construction Management, Education Management, Point of Sale, Third Party Integrations

• Positive attitude and quick Learner

• Good analytical skill, quick bug and issue tracing and find the solution

• Good knowledge and experience in payment gateway integration with Odoo

• Ready to accept new challenges

• Active Memeber On Stackoverflow 




Sudhir Arya
ERP Harbor Consulting Services
Sudhir Arya (ERP Harbor Consulting Services)
On 4/18/13, 6:40 AM

Write this code:

def button_total(self, cr, uid, ids, context=None):
    tea_worker_line_ids = self.browse(cr, uid, ids[0], context=context).selected_tea_workers_line_ids or []
    total_tea_worker = len(tea_worker_line_ids)
    self.write(cr, uid, ids, {'total_workers': total_tea_worker}, context=context)
    return True

wow..its worked Arya thanks

on 4/18/13, 6:48 AM

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

0 follower(s)


Asked: 4/18/13, 5:42 AM
Seen: 2463 times
Last updated: 3/16/15, 8:10 AM