Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
595 Представления

I have add field which called project name in the invoice from view, and I want to add domain for to show which when I choose the customer name will show for me only the projects linked to him 

Аватар
Отменить
Лучший ответ

Hello Isa MArzooq,

To render project associated with customer, we need to update few things 


At view level set below code

Also you need to set computer method

project_name = fields.Many2many(
        'project.project', string="Project Names", compute='_compute_project_name')

    @api.depends('partner_id')
    def _compute_project_name(self):
        for move in self:
            if move.partner_id:
                # Fetch all projects related to the partner_id
                projects = self.env['project.project'].search(
                    [('partner_id', '=', move.partner_id.id)])
                move.project_name = projects
            else:
                move.project_name = False


I hope this will help you. Please let me know if you need any further support.

Thanks

Vimal Rughani (Founder and CTO)

Himanjali Intelligent Automation Pvt Ltd

Contact: +91- 972-606-7737

Emailhello@himanjali.com 

NewsletterThe Odoo Scoop

Websitewww.himanjali.com

 
Аватар
Отменить
Лучший ответ

Hello,

I believe that you have created a new field "project_id" which is many2one of project.project model.

Now the project.project model has many2one field called "partner_id" of res.partner model.

As per your requirement, we need to allow the user to choose a project which has the same  partner as selected in invoice.


Add following domain in form view to define project_id field:

Thanks & Regards,


CandidRoot Solutions Pvt. Ltd.

Mobile: (+91) 8849036209

Email: info@candidroot.com


Аватар
Отменить