Skip to Content
Menú
This question has been flagged
1 Respondre
87 Vistes

 i created  a contact for a personal trainer . how can i link it to specific services like ( 10-Session Personal Training Package) to  profile.



Avatar
Descartar
Best Answer

Hi,


Link a specific service product (e.g., "10-Session Personal Training Package") to a contact (e.g., a personal trainer) in Odoo using a Many2one field.

Steps to Implement:


    1. Create the Service Product


        Go to Sales > Products.


        Click Create.


        Set:


            Name: 10-Session Personal Training Package


            Product Type: Service


            Add other details (price, invoice policy, etc.)


        Save the product.


    2. Add a Many2one Field to Contacts (res.partner)


        Use custom code or Odoo Studio.


        Field details:


            Name: training_package_id


            Type: Many2one


            Related Model: product.product


            Domain: [('type', '=', 'service')] - so only service products appear.


    3. Code Example (if using Python code)


class ResPartner(models.Model):

   _inherit = 'res.partner'


   training_package_id = fields.Many2one(

'product.product',

string='Assigned Training Package',

domain=[('type', '=', 'service')],

   )


   4. Use It in Contacts


   Go to Contacts > Open a Trainer's Profile.


   You’ll see the new dropdown field.


   Select the desired service product (e.g., the 10-session package).


   5. Result


    Each trainer/contact can be linked to one specific training service.


    Can be used for filtering, reporting, or invoicing logic later.

   

Hope it helps.

Avatar
Descartar