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.

2

How to get total workers by button ? [Closed]

By
priyankahdp
on 4/18/13, 5:42 AM 1,898 views

The Question has been closed

by
Sudhir Arya (SA)
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. ? ?

screen

2

Sudhir Arya (SA)

--Sudhir Arya (SA)--
10150
| 6 8 8
Ahmedabad, India
--Sudhir Arya (SA)--

Working as an OpenERP/Odoo developer and a Team Leader 

Top 5 Odoo contributor On Stackoverflow

LinkedIn

Blog

Stackoverflow

Sudhir Arya (SA)
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

priyankahdp
on 4/18/13, 6:48 AM

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

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