From fb9aea079da56e2951a59e293d4f83324d25cb27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dar=C3=ADo=20Lodeiros?= Date: Wed, 12 Jan 2022 18:39:11 +0100 Subject: [PATCH] [FIX]pms: prepare invoice journal default property context --- pms/models/account_move.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pms/models/account_move.py b/pms/models/account_move.py index 90cc65b2b..16cf009fa 100644 --- a/pms/models/account_move.py +++ b/pms/models/account_move.py @@ -133,23 +133,23 @@ class AccountMove(models.Model): default_pms_property_id is set in context """ journal = super(AccountMove, self)._search_default_journal(journal_types) - if self._context.get("pms_property_id"): + if self._context.get("default_pms_property_id"): property_id = self._context.get("default_pms_property_id") + pms_property = self.env["pms.property"].browse(property_id) domain = [ - ("company_id", "=", property_id.company_id), + ("company_id", "=", pms_property.company_id.id), ("type", "in", journal_types), ("pms_property_ids", "in", property_id), ] journal = self.env["account.journal"].search(domain, limit=1) if not journal: domain = [ - ("company_id", "=", property_id.company_id), + ("company_id", "=", pms_property.company_id.id), ("type", "in", journal_types), ("pms_property_ids", "=", False), ] journal = self.env["account.journal"].search(domain, limit=1) if not journal: - pms_property = self.env["res.company"].browse(property_id) error_msg = _( """No journal could be found in property %(property_name)s for any of those types: %(journal_types)s""",