[FIX] account: print multiple GL

When several accounts are selected to print their GL, the GL of only one
is printed. This is due to two issues:
- 'active_id' is retrieved instead of 'active_ids'
- the method `get_action` is called with the wrong records. `self`
  refers to the wizard, not to the accounts selected.

opw-676061
This commit is contained in:
Nicolas Martinelli
2016-05-11 10:11:24 +02:00
parent 34f09a0e69
commit 2ad4bd4846
2 changed files with 3 additions and 2 deletions
@@ -110,7 +110,7 @@ class ReportGeneralLedger(models.AbstractModel):
@api.multi
def render_html(self, data):
self.model = self.env.context.get('active_model')
docs = self.env[self.model].browse(self.env.context.get('active_id'))
docs = self.env[self.model].browse(self.env.context.get('active_ids', []))
init_balance = data['form'].get('initial_balance', True)
sortby = data['form'].get('sortby', 'sort_date')
@@ -19,4 +19,5 @@ class AccountReportGeneralLedger(models.TransientModel):
data['form'].update(self.read(['initial_balance', 'sortby'])[0])
if data['form'].get('initial_balance') and not data['form'].get('date_from'):
raise UserError(_("You must define a Start Date"))
return self.env['report'].with_context(landscape=True).get_action(self, 'account.report_generalledger', data=data)
records = self.env[data['model']].browse(data.get('ids', []))
return self.env['report'].with_context(landscape=True).get_action(records, 'account.report_generalledger', data=data)