Odoo Help


How to display projects bloc in the Customer Form view.

on 10/14/14, 8:15 AM 940 views

Is there any possibility to display a project count in the Customer Form View?


On 10/15/14, 9:17 AM

Hi Mohamed, 

thank's for your answer, 

i think it will works, will try!



Mohamed Magdy
On 10/14/14, 9:20 AM

If you mean the number of projects related to a customer

class res_partner(osv.Model):

_name = 'res.partner'

_inherit = 'res.partner'

def _get_number_of_projects(self, cr, uid, ids, name, args, context=None):

res = {}

for partner_id in ids:

proj_ids = self.pool.get('project.project').search(cr, uid, [('partner_id', 'in', ids)], context=context)

res[partner_id] = len(proj_ids)

return res


_columns = {

'num_of_projects': fields.function(_get_number_of_projects, type='integer', string='Number Of Projects' , store=True),


Then in the view :

<record id="inherit_partner_veiw" model="ir.ui.view">

<field name="name">Inherit Partner View</field>

<field name="model">res.partner</field>

<field name="inherit_id" ref="base.view_partner_form"/>

<field name="arch" type="xml">

<xpath expr="//field[@name='website'] " position="after">

<field name="num_of_projects"/>




I Hope this helps you :)

I'm gradually learning Odoo through trial and error and community help. How or where do I implement this, do I have to build a module or can I add this to the existing code (if yes - what and where). Thanks for your support and time Chris Keen

Keen Intelligence, Chris Keen
on 11/6/14, 6:08 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

1 follower(s)


Asked: 10/14/14, 8:15 AM
Seen: 940 times
Last updated: 3/16/15, 8:10 AM