Skip to content

Commit

Permalink
Merge PR OCA#3269 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Oct 16, 2023
2 parents 5bc2c55 + f98e314 commit dcf92d2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions l10n_es_aeat/models/l10n_es_aeat_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ class L10nEsAeatReport(models.AbstractModel):
SPANISH_STATES = ss

def _default_journal(self):
return self.env["account.journal"].search([("type", "=", "general")])[:1]
return self.env["account.journal"].search(
[("type", "=", "general"), ("company_id", "=", self.env.company.id)]
)[:1]

def get_period_type_selection(self):
period_types = []
Expand Down Expand Up @@ -229,7 +231,7 @@ def _get_export_config(self, date):
journal_id = fields.Many2one(
comodel_name="account.journal",
string="Journal",
domain=[("type", "=", "general")],
domain="[('type', '=', 'general'), ('company_id', '=', company_id)]",
default=_default_journal,
help="Journal in which post the move.",
states={"done": [("readonly", True)]},
Expand Down Expand Up @@ -312,6 +314,8 @@ def onchange_company_id(self):
or self.env.user.partner_id.mobile
or self.env.user.company_id.phone
)
if self.journal_id.company_id != self.company_id:
self.journal_id = self.with_company(self.company_id.id)._default_journal()

@api.depends("year", "period_type")
def _compute_dates(self):
Expand Down

0 comments on commit dcf92d2

Please sign in to comment.