Hello,
I have a student registration form. I want to make a student as Partner. so that we can generate an invoice for him?
How can I do that?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello,
I have a student registration form. I want to make a student as Partner. so that we can generate an invoice for him?
How can I do that?
The idea same as the creation of the user, when you create a user the related partner will be created automatically so you can use delegation inheritance as below:
https://github.com/odoo/odoo/blob/11.0/odoo/addons/base/res/res_users.py#L182
See how to use delegation inheritance:
https://www.odoo.com/documentation/13.0/reference/orm.html#delegation
modify your student model, when you create a student, a related partner will be create automatically:
class Student(models.Model):
_name = "Your model"
_description = 'Your model name'
_inherits = {'res.partner': 'partner_id'}
partner_id = fields.Many2one('res.partner', required=True, ondelete='restrict', auto_join=True,string='Related Partner', help='Partner-related data of the student')
# overridden inherited fields to bypass access rights, in case you have
# access to the student but not its corresponding partner
# Use the pass name and email from student to partner, if there is no email for student you can remove the below line
name = fields.Char(related='partner_id.name', inherited=True, readonly=False)
email = fields.Char(related='partner_id.email', inherited=True, readonly=False)
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up