Add header grouping on report
issue6760 review351221002
This commit is contained in:
1 parent
850f106056
commit
abb9288145
3 files changed
+18
-2
No files matched your search
@@ -19,6 +19,8 @@ from trytond.wizard import (Wizard, StateView, StateTransition, StateReport,
|
||||
from trytond.tools import grouped_slice
|
||||
from trytond.modules.company import CompanyReport
|
||||
|
||||
from .exceptions import PrintDepreciationTableError
|
||||
|
||||
|
||||
def date2datetime(date):
|
||||
return datetime.datetime.combine(date, datetime.time())
|
||||
@@ -928,8 +930,8 @@ class AssetDepreciationTable(CompanyReport):
|
||||
__name__ = 'account.asset.depreciation_table'
|
||||
|
||||
@classmethod
|
||||
def get_context(cls, records, data):
|
||||
context = super(AssetDepreciationTable, cls).get_context(records, data)
|
||||
def get_context(cls, records, header, data):
|
||||
context = super().get_context(records, header, data)
|
||||
|
||||
AssetDepreciation = cls.get_asset_depreciation()
|
||||
AssetDepreciation.start_date = data['start_date']
|
||||
@@ -1120,6 +1122,9 @@ class PrintDepreciationTable(Wizard):
|
||||
('end_date', '>', self.start.start_date),
|
||||
('state', '!=', 'draft'),
|
||||
])
|
||||
if not assets:
|
||||
raise PrintDepreciationTableError(
|
||||
gettext('account_asset.msg_no_assets'))
|
||||
return action, {
|
||||
'ids': [a.id for a in assets],
|
||||
'start_date': self.start.start_date,
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.exceptions import UserError
|
||||
|
||||
|
||||
class PrintDepreciationTableError(UserError):
|
||||
pass
|
||||
@@ -18,5 +18,8 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.message" id="msg_invoice_line_asset_unique">
|
||||
<field name="text">Asset can be used only once on invoice line.</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_no_assets">
|
||||
<field name="text">There is no started asset.</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
Reference in new issue
Block a user