i have created an audit button in the contacts module and two submenus for individual contacts and company contacts. How do I perform the following task :if the user is an individual contact if he clicks an audit button an individual contact checklist should appear and when the contact is a company contact a company contact checklist should appear. The end result should be that if the person is audited after the submit button is clicked the checklist appears in quality assurance. but l have made that lm left with the linking

i tried this code:

def action_individual_contact_audit_wizard(self):
    active_individual = self.env[res.partner].browse(self._context.get("active_id"))
    if active_individual.is_company:
        wizard = self.env.ref[
            "company.contact.checklist.wizard.action_individual_contact_audit_wizard"
        ].create(
            # {"contact_id": active_contact.id}
        )

    else:
        wizard = self.env.ref[
            "individual.contact.audit.wizard.action_individual_contact_audit_wizard"
        ].create(
            # {"contact_id": active_contact.id}
        )

    return {
        "name": "Checklist",
        "view_mode": "form",
        "res_model": "company.contact.checklist.wizard",
        "view_type": "form",
        "type": "ir.actions.act_window",
        "target": "current",
        "views": [(action_individual_contact_audit_wizard, "")],
    }

but its not working out

0

There are 0 best solutions below