Odoo modules extending contacts / partners
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
692 B

  1. # -*- coding: utf-8 -*-
  2. # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
  3. from odoo import fields, models, api
  4. class ResPartnerEmancipate(models.TransientModel):
  5. _name = "res.partner.emancipate"
  6. _description = "Partner Emancipation Wizard"
  7. _rec_name = "partner_id"
  8. partner_id = fields.Many2one("res.partner", string="Partner", required=True)
  9. emancipation_date = fields.Date(
  10. string="Emancipation date",
  11. required=True,
  12. )
  13. def emancipate_partner(self):
  14. if self.partner_id.is_company:
  15. return {"type": "ir.actions.act_window_close"}
  16. self.partner_id.write({"emancipation_date": self.emancipation_date})