Skip to content

Commit

Permalink
[MIG] sequence_python: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaspaulb committed Nov 12, 2024
1 parent e9aeae3 commit f4941cc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sequence_python/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"summary": """Calculate a sequence number from a Python expression""",
"author": "Sunflower IT,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/server-tools",
"version": "16.0.1.0.0",
"version": "17.0.1.0.0",
"license": "AGPL-3",
"category": "Generic Modules",
"depends": ["base"],
Expand Down
2 changes: 1 addition & 1 deletion sequence_python/models/ir_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ def get_next_char(self, number_next):
+ interpolated_suffix
)
else:
return super(IrSequence, self).get_next_char(number_next)
return super().get_next_char(number_next)

Check warning on line 85 in sequence_python/models/ir_sequence.py

View check run for this annotation

Codecov / codecov/patch

sequence_python/models/ir_sequence.py#L85

Added line #L85 was not covered by tests
6 changes: 6 additions & 0 deletions sequence_python/tests/test_ir_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,9 @@ def test_nogap_sequence(self):
self.assertEqual(next_number, "AB01C")
next_number = self.sequence._next()
self.assertEqual(next_number, "AB02C")

def test_preview_with_wrong_python_syntax(self):
# This will raise a Python TypeError exception
self.sequence.python_code = "number_padded + 1"
# It will not raise but put the Exception text in the preview field
self.assertIn("TypeError", self.sequence.python_code_preview)
4 changes: 2 additions & 2 deletions sequence_python/views/ir_sequence.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
widget="ace"
options="{'mode': 'python'}"
placeholder="number"
attrs="{'invisible': [('use_python_code', '=', False)]}"
invisible="use_python_code == False"
/>
<field
name="python_code_preview"
attrs="{'invisible': [('use_python_code', '=', False)]}"
invisible="use_python_code == False"
/>
</group>
<div style="margin-top: 4px;">
Expand Down

0 comments on commit f4941cc

Please sign in to comment.