Use commercial partners for operating accounts
This commit is contained in:
parent
7859d6a7a1
commit
89c7e28100
@ -19,6 +19,7 @@ class OperatingSystemSetup:
|
||||
self._promote_existing_customers()
|
||||
self._ensure_active_portfolio()
|
||||
self._hide_empty_seed_accounts()
|
||||
self._hide_child_contact_accounts()
|
||||
self._ensure_followup_cron_active()
|
||||
|
||||
def _promote_existing_customers(self):
|
||||
@ -29,8 +30,10 @@ class OperatingSystemSetup:
|
||||
("commercial_partner_id", "!=", False),
|
||||
]
|
||||
).mapped("commercial_partner_id")
|
||||
customers = self.Partner.search([("customer_rank", ">", 0)])
|
||||
for partner in customers | invoice_partners:
|
||||
customer_accounts = self.Partner.search(
|
||||
[("customer_rank", ">", 0)]
|
||||
).mapped("commercial_partner_id")
|
||||
for partner in customer_accounts | invoice_partners:
|
||||
values = {"mcs_is_client_account": True}
|
||||
if not partner.mcs_account_status:
|
||||
values["mcs_account_status"] = "active"
|
||||
@ -248,3 +251,14 @@ class OperatingSystemSetup:
|
||||
)
|
||||
if not has_invoice and not partner.mcs_project_ids:
|
||||
partner.write({"mcs_is_client_account": False})
|
||||
|
||||
def _hide_child_contact_accounts(self):
|
||||
child_accounts = self.Partner.search(
|
||||
[
|
||||
("mcs_is_client_account", "=", True),
|
||||
("parent_id", "!=", False),
|
||||
]
|
||||
)
|
||||
for partner in child_accounts:
|
||||
if not partner.mcs_project_ids:
|
||||
partner.write({"mcs_is_client_account": False})
|
||||
|
||||
@ -440,6 +440,8 @@ class McsOperatingDashboard(models.Model):
|
||||
rows = []
|
||||
for partner in partners:
|
||||
projects = client_projects.filtered(lambda project: project.partner_id == partner)
|
||||
if partner.parent_id and not projects:
|
||||
continue
|
||||
if (
|
||||
not projects
|
||||
and not partner.mcs_total_invoiced
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user