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.
 
 
 
 

36 lines
1.2 KiB

# Copyright 2019 Lorenzo Battistini @ TAKOBI
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class AbstractWizard(models.AbstractModel):
_name = "account_financial_report_abstract_wizard"
_description = "Abstract Wizard"
def _get_partner_ids_domain(self):
return [
"&",
"|",
("company_id", "=", self.company_id.id),
("company_id", "=", False),
"|",
("parent_id", "=", False),
("is_company", "=", True),
]
def _default_partners(self):
context = self.env.context
if context.get("active_ids") and context.get("active_model") == "res.partner":
partners = self.env["res.partner"].browse(context["active_ids"])
corp_partners = partners.filtered("parent_id")
partners -= corp_partners
partners |= corp_partners.mapped("commercial_partner_id")
return partners.ids
company_id = fields.Many2one(
comodel_name="res.company",
default=lambda self: self.env.company.id,
required=False,
string="Company",
)