File tree Expand file tree Collapse file tree
account_vat_period_end_statement/report Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88import time
99
1010from odoo import api , models
11+ from odoo .exceptions import UserError
1112from odoo .tools .misc import formatLang
1213from 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 }
You can’t perform that action at this time.
0 commit comments