如何按按钮计算员工总数?

2024-09-28 03:23:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我的要求是这样的 当我在selectworkers树视图中添加工人时,需要在右边底部添加工人总数字段.its确定当我要保存或单击(更新)按钮时显示。 我参考了购买模块,但我找不到exaclty在单击该按钮时调用了什么函数。你知道吗

我的全部代码都上传到了here@GitHub 请参阅bpl中的第397行_查看.xml第335行业务伙伴你知道吗

按照我写的购买模块功能。但是它只有回报声明。就是这样我也很困惑。你知道吗

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

请就这个问题给我建议&请告诉我为什么单击按钮时记录会自动保存。?它只有返回真语句?你知道吗

screen


Tags: 模块函数代码github视图here请参阅数字
1条回答
网友
1楼 · 发布于 2024-09-28 03:23:26

编写以下代码:

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

相关问题 更多 >

    热门问题