From 728da88941ca6fc74d5a0c5f73d906ec59a5bd35 Mon Sep 17 00:00:00 2001 From: Andrea Date: Wed, 21 Jun 2017 10:30:00 +0200 Subject: [PATCH] Make use of update() + renamed button method --- l10n_nl_tax_statement/__manifest__.py | 2 +- l10n_nl_tax_statement/models/l10n_nl_vat_statement.py | 8 +++++--- l10n_nl_tax_statement/tests/test_l10n_nl_vat_statement.py | 8 ++++---- l10n_nl_tax_statement/views/l10n_nl_vat_statement.xml | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/l10n_nl_tax_statement/__manifest__.py b/l10n_nl_tax_statement/__manifest__.py index e20d64292..b463aef16 100644 --- a/l10n_nl_tax_statement/__manifest__.py +++ b/l10n_nl_tax_statement/__manifest__.py @@ -4,7 +4,7 @@ { 'name': 'Netherlands BTW Statement', - 'version': '10.0.1.0.0', + 'version': '10.0.1.0.1', 'category': 'Localization', 'license': 'AGPL-3', 'author': 'Onestein, Odoo Community Association (OCA)', diff --git a/l10n_nl_tax_statement/models/l10n_nl_vat_statement.py b/l10n_nl_tax_statement/models/l10n_nl_vat_statement.py index c8e292181..4d692cc23 100644 --- a/l10n_nl_tax_statement/models/l10n_nl_vat_statement.py +++ b/l10n_nl_tax_statement/models/l10n_nl_vat_statement.py @@ -72,8 +72,10 @@ def default_get(self, fields_list): @api.onchange('date_range_id') def onchange_date_range_id(self): if self.date_range_id and self.state == 'draft': - self.from_date = self.date_range_id.date_start - self.to_date = self.date_range_id.date_end + self.update({ + 'from_date': self.date_range_id.date_start, + 'to_date': self.date_range_id.date_end, + }) @api.onchange('from_date', 'to_date') def onchange_date(self): @@ -208,7 +210,7 @@ def _get_tags_map(self): } @api.multi - def update(self): + def statement_update(self): self.ensure_one() if self.state == 'posted': diff --git a/l10n_nl_tax_statement/tests/test_l10n_nl_vat_statement.py b/l10n_nl_tax_statement/tests/test_l10n_nl_vat_statement.py index 9f7757582..0d9ae1e82 100644 --- a/l10n_nl_tax_statement/tests/test_l10n_nl_vat_statement.py +++ b/l10n_nl_tax_statement/tests/test_l10n_nl_vat_statement.py @@ -143,17 +143,17 @@ def test_06_unlink_working(self): def test_07_update_exception1(self): self.statement_1.post() with self.assertRaises(UserError): - self.statement_1.update() + self.statement_1.statement_update() def test_08_update_exception2(self): self.config.unlink() with self.assertRaises(UserError): - self.statement_1.update() + self.statement_1.statement_update() def test_09_update_working(self): self.invoice_1._onchange_invoice_line_ids() self.invoice_1.action_invoice_open() - self.statement_1.update() + self.statement_1.statement_update() self.assertEqual(len(self.statement_1.line_ids.ids), 19) _1 = self.StatLine.search( @@ -174,7 +174,7 @@ def test_09_update_working(self): def test_10_line_unlink_exception(self): self.invoice_1.action_invoice_open() - self.statement_1.update() + self.statement_1.statement_update() self.statement_1.post() with self.assertRaises(UserError): self.statement_1.line_ids.unlink() diff --git a/l10n_nl_tax_statement/views/l10n_nl_vat_statement.xml b/l10n_nl_tax_statement/views/l10n_nl_vat_statement.xml index 757a40545..7667e77a6 100644 --- a/l10n_nl_tax_statement/views/l10n_nl_vat_statement.xml +++ b/l10n_nl_tax_statement/views/l10n_nl_vat_statement.xml @@ -11,7 +11,7 @@
-