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

Automatically Close Project when all its tasks are Closed

By
Zohair Iyaz
on 1/11/16, 10:55 PM 411 views

I am trying to this: Automatically Close Purchase Order when all its tasks are CompletedI cannot touch the code directly at this moment (too many changes from front-end). So that's the LAST option I want to pursue. So, from front-end GUI, I am thinking to create an Automated Action on Task Update that runs a Server Action to do this task.

How to find if the task's project has all tasks in closed/cancelled state (or not)?

Can we modify any of these below and use them in a server action to do this?

    def
_task_count(self, cr, uid, ids, field_name, arg, context=None):
        res={}
        for tasks in self.browse(cr, uid, ids, dict(context, active_test=False)):
            res[tasks.id] = len(tasks.task_ids)
        return res


ids = models.execute_kw(db, uid, password,
'res.partner', 'search',
[[['is_company', '=', True], ['customer', '=', True]]],
{'limit': 1})
[record] = models.execute_kw(db, uid, password,
'res.partner', 'read', [ids])
# count the number of fields fetched by default
len(record)

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

1 follower(s)

Stats

Asked: 1/11/16, 10:55 PM
Seen: 411 times
Last updated: 2/24/16, 2:58 AM