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.

29 lines
998 B

  1. # Copyright 2019 Lorenzo Battistini @ TAKOBI
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  3. from odoo import models
  4. class AbstractWizard(models.AbstractModel):
  5. _name = "account_financial_report_abstract_wizard"
  6. _description = "Abstract Wizard"
  7. def _get_partner_ids_domain(self):
  8. return [
  9. "&",
  10. "|",
  11. ("company_id", "=", self.company_id.id),
  12. ("company_id", "=", False),
  13. "|",
  14. ("parent_id", "=", False),
  15. ("is_company", "=", True),
  16. ]
  17. def _default_partners(self):
  18. context = self.env.context
  19. if context.get("active_ids") and context.get("active_model") == "res.partner":
  20. partners = self.env["res.partner"].browse(context["active_ids"])
  21. corp_partners = partners.filtered("parent_id")
  22. partners -= corp_partners
  23. partners |= corp_partners.mapped("commercial_partner_id")
  24. return partners.ids