Skip to content

Commit ac1bb9c

Browse files
committed
fix(spp_import_match): fix duplicate field constraint test and pre-commit README
- Use Command.create() in test to trigger parent @api.constrains properly - Align README.rst and index.html table widths with CI Python 3.11 output
1 parent 30da2b1 commit ac1bb9c

File tree

3 files changed

+20
-16
lines changed

3 files changed

+20
-16
lines changed

spp_import_match/README.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ Key Capabilities
4646
Key Models
4747
~~~~~~~~~~
4848

49-
+-----------------------------+---------------------------------------+
50-
| Model | Description |
51-
+=============================+=======================================+
52-
| ``spp.import.match`` | Matching rule configuration for a |
53-
| | specific model |
54-
+-----------------------------+---------------------------------------+
55-
| ``spp.import.match.fields`` | Individual field in a rule, with |
56-
| | optional sub-field |
57-
+-----------------------------+---------------------------------------+
49+
+-----------------------------+----------------------------------------+
50+
| Model | Description |
51+
+=============================+========================================+
52+
| ``spp.import.match`` | Matching rule configuration for a |
53+
| | specific model |
54+
+-----------------------------+----------------------------------------+
55+
| ``spp.import.match.fields`` | Individual field in a rule, with |
56+
| | optional sub-field |
57+
+-----------------------------+----------------------------------------+
5858

5959
Configuration
6060
~~~~~~~~~~~~~

spp_import_match/static/description/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,8 @@ <h1>Key Capabilities</h1>
395395
<h1>Key Models</h1>
396396
<table border="1" class="docutils">
397397
<colgroup>
398-
<col width="43%" />
399-
<col width="57%" />
398+
<col width="42%" />
399+
<col width="58%" />
400400
</colgroup>
401401
<thead valign="bottom">
402402
<tr><th class="head">Model</th>

spp_import_match/tests/test_import_match_model.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Part of OpenSPP. See LICENSE file for full copyright and licensing details.
22

3+
from odoo import Command
34
from odoo.exceptions import ValidationError
45
from odoo.tests import TransactionCase, tagged
56

@@ -220,11 +221,14 @@ def test_constrains_duplicate_name(self):
220221
def test_constrains_duplicate_non_relational_field(self):
221222
"""_check_duplicate_fields raises on duplicate non-relational fields on save."""
222223
with self.assertRaises(ValidationError):
223-
self._create_match_rule(
224-
[
225-
{"field_id": self.name_field.id},
226-
{"field_id": self.name_field.id},
227-
]
224+
self.env["spp.import.match"].create(
225+
{
226+
"model_id": self.res_partner_model.id,
227+
"field_ids": [
228+
Command.create({"field_id": self.name_field.id}),
229+
Command.create({"field_id": self.name_field.id}),
230+
],
231+
}
228232
)
229233

230234
def test_constrains_allows_duplicate_relational_field(self):

0 commit comments

Comments
 (0)