Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
Make use of update() + renamed button method
Browse files Browse the repository at this point in the history
  • Loading branch information
astirpe committed Oct 10, 2019
1 parent 50e87b5 commit 8240038
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion l10n_nl_tax_statement/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)',
Expand Down
8 changes: 5 additions & 3 deletions l10n_nl_tax_statement/models/l10n_nl_vat_statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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':
Expand Down
8 changes: 4 additions & 4 deletions l10n_nl_tax_statement/tests/test_l10n_nl_vat_statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion l10n_nl_tax_statement/views/l10n_nl_vat_statement.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</header>
<sheet>
<div class="oe_button_box" name="button_box">
<button name="update" string="Update" states="draft" type="object" class="oe_stat_button" icon="fa-repeat"/>
<button name="statement_update" string="Update" states="draft" type="object" class="oe_stat_button" icon="fa-repeat"/>
<button name="post" string="Post" states="draft" type="object" class="oe_stat_button" icon="fa-arrow-right text-success"/>
</div>
<label for="name"/>
Expand Down

0 comments on commit 8240038

Please sign in to comment.