Skip to content

Commit 4f7eed1

Browse files
committed
[14.0][FIX] account_vat_period_end_statement multicompany non stampa le imposte
1 parent 3c95af5 commit 4f7eed1

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

account_vat_period_end_statement/report/vat_statement.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import time
99

1010
from odoo import api, models
11+
from odoo.exceptions import UserError
1112
from odoo.tools.misc import formatLang
1213
from odoo.tools.translate import _
1314

@@ -19,11 +20,15 @@ class VatPeriodEndStatementReport(models.AbstractModel):
1920
@api.model
2021
def _get_report_values(self, docids, data=None):
2122
docs = self.env["account.vat.period.end.statement"].browse(docids)
23+
companies = docs.mapped("company_id")
24+
if len(companies) != 1:
25+
raise UserError(_("You must select documents from the same company!"))
26+
company = companies[0]
2227
vals = {
2328
"docs": docs,
2429
"time": time,
25-
"tax_amounts": self._get_taxes_amounts,
26-
"account_vat_amounts": self._get_account_vat_amounts,
30+
"tax_amounts": self.with_company(company)._get_taxes_amounts,
31+
"account_vat_amounts": self.with_company(company)._get_account_vat_amounts,
2732
"formatLang": formatLang,
2833
"env": self.env,
2934
}

0 commit comments

Comments
 (0)