from odoo import api, models


class PartnerContractCustomer(models.Model):
    _name = "partner.contract.customer"
    _inherit = ["partner.contract.customer", "docx.template.mixin"]

    @api.onchange("profile_id")
    def _onchange_profile_id_set_docx_template(self):
        for rec in self:
            if rec.profile_id and not rec.docx_template_id and rec.profile_id.docx_template_id:
                rec.docx_template_id = rec.profile_id.docx_template_id
