diff --git a/controllers/main.py b/controllers/main.py index 76917c488e737c0443d1c198a3bea73528356903..6b85533c031717f603e781bb8684b8fe7673609e 100644 --- a/controllers/main.py +++ b/controllers/main.py @@ -19,8 +19,10 @@ class ExportJournalCg(http.Controller): @http.route('/web/export_journal_cg/', type='http', auth="user") @serialize_exception def export_journal_cg( - self, date_start, date_end, date_creation_start, date_creation_end, - company_id, partner_ids, **kwargs): + self, company_id, + date_start=False, date_end=False, + date_creation_start=False, date_creation_end=False, + partner_ids=False, **kwargs): """ Sélectionne les account.move.line correspondants aux journaux et à la plage de date définis @@ -48,7 +50,7 @@ class ExportJournalCg(http.Controller): ('date', '>=', date_start), ('date', '<=', date_end), ] - if date_start and date_end: + if date_creation_start and date_creation_end: domain += [ ('create_date', '>=', date_creation_start), ('create_date', '<=', date_creation_end), diff --git a/wizard/export_journal_wizard.py b/wizard/export_journal_wizard.py index a3e4b0bf652d1390f3def863b9c2d572d2cb55ef..4b421dd80e424d7de3f9bfee1072c143d8ffd997 100755 --- a/wizard/export_journal_wizard.py +++ b/wizard/export_journal_wizard.py @@ -48,13 +48,20 @@ class ExportJournalWizard(models.TransientModel): """ datas = { 'export_type': self.export_type, - 'date_start': self.date_start, - 'date_end': self.date_end, - 'date_creation_start': self.date_creation_start, - 'date_creation_end': self.date_creation_end, 'company_id': self.company_id.id, - 'partner_ids': ','.join(str(x) for x in self.partner_ids.ids), } + if self.date_start and self.date_end: + datas.update({ + 'date_start': self.date_start, + 'date_end': self.date_end, + }) + if self.date_creation_start and self.date_creation_end: + datas.update({ + 'date_creation_start': self.date_start, + 'date_creation_end': self.date_end, + }) + if self.partner_ids: + datas['partner_ids'] = ','.join(str(x) for x in self.partner_ids.ids) return { 'type': 'ir.actions.act_url', 'url': '/web/export_journal_cg?' + urlencode(datas),