|
|
@ -11,7 +11,7 @@ class LedgerReportWizard(models.TransientModel): |
|
|
|
_description = "Ledger Report Wizard" |
|
|
|
|
|
|
|
company_id = fields.Many2one(comodel_name='res.company') |
|
|
|
# date_range = ?? |
|
|
|
date_range_id = fields.Many2one(comodel_name='date.range', required=True) |
|
|
|
date_from = fields.Date() |
|
|
|
date_to = fields.Date() |
|
|
|
target_move = fields.Selection([('posted', 'All Posted Entries'), |
|
|
@ -66,8 +66,14 @@ class LedgerReportWizard(models.TransientModel): |
|
|
|
|
|
|
|
def _build_contexts(self, data): |
|
|
|
result = {} |
|
|
|
result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['journal_ids'] or False |
|
|
|
result['state'] = 'target_move' in data['form'] and data['form']['target_move'] or '' |
|
|
|
result['journal_ids'] = ( |
|
|
|
'journal_ids' in data['form'] and |
|
|
|
data['form']['journal_ids'] or False |
|
|
|
) |
|
|
|
result['state'] = ( |
|
|
|
'target_move' in data['form'] and |
|
|
|
data['form']['target_move'] or '' |
|
|
|
) |
|
|
|
result['date_from'] = data['form']['date_from'] or False |
|
|
|
result['date_to'] = data['form']['date_to'] or False |
|
|
|
result['strict_range'] = True if result['date_from'] else False |
|
|
@ -79,7 +85,15 @@ class LedgerReportWizard(models.TransientModel): |
|
|
|
data = {} |
|
|
|
data['ids'] = self.env.context.get('active_ids', []) |
|
|
|
data['model'] = self.env.context.get('active_model', 'ir.ui.menu') |
|
|
|
data['form'] = self.read(['date_from', 'date_to', 'journal_ids', 'target_move'])[0] |
|
|
|
data['form'] = self.read(['date_from', 'date_to', |
|
|
|
'journal_ids', 'target_move'])[0] |
|
|
|
used_context = self._build_contexts(data) |
|
|
|
data['form']['used_context'] = dict(used_context, lang=self.env.context.get('lang', 'en_US')) |
|
|
|
data['form']['used_context'] = ( |
|
|
|
dict(used_context, lang=self.env.context.get('lang', 'en_US')) |
|
|
|
) |
|
|
|
return self._print_report(data) |
|
|
|
|
|
|
|
@api.onchange('date_range_id') |
|
|
|
def onchange_date_range_id(self): |
|
|
|
self.date_from = self.date_range_id.date_start |
|
|
|
self.date_to = self.date_range_id.date_end |