[16.0][IMP] subscription_oca: improve config UX and duplication#1319
[16.0][IMP] subscription_oca: improve config UX and duplication#1319
Conversation
b88158f to
4ee0743
Compare
Add '(copy)' suffix on duplication and sequence handles for stages, templates, tags, and close reasons. Enable tree,form views and remove inline editing. Task: 5020
4c26395 to
a649ab2
Compare
|
Hi @carlos-domatix we made some UI/UX enhancements of your beautiful module, would appreciate your review! |
|
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
marcos-mendez
left a comment
There was a problem hiding this comment.
Automated Review -- Tests Failed
1. Root Cause
The test failure occurs in setUpClass of TestSubscriptionOCA when trying to search for a journal using cls.env["account.journal"].search([]) which returns an empty recordset, leading to an IndexError: tuple index out of range when accessing cls.cash_journal[0].
2. Suggested Fix
In subscription_oca/tests/test_subscription_oca.py, line 29, replace:
cls.cash_journal = cls.env["account.journal"].search([])with:
cls.cash_journal = cls.env["account.journal"].search([("type", "=", "cash")], limit=1)or ensure that at least one cash journal exists in the test environment before this line.
3. Additional Code Issues
-
Missing field definitions in inherited models: The models
sale_subscription_close_reason,sale_subscription_stage,sale_subscription_tag, andsale_subscription_templateinherit fromsubscription.generic.field.mixinbut do not explicitly define thenameandsequencefields (they are inherited). While this works, it's not immediately clear from the model definition that these fields exist unless you know the mixin. It's better to document or explicitly show field usage in the models if not usingfields.*imports directly. -
Mixin
_orderfield: The mixin defines_order = "sequence, name"which applies to all inheriting models. This is fine, but if any of the inheriting models have custom ordering requirements or need to override this, it should be documented or handled carefully.
4. Test Improvements
Add a TransactionCase or SavepointCase test to validate that the mixin works correctly across different models:
def test_generic_field_mixin_inheritance(self):
# Test that all models using the mixin have expected fields and behavior
model_names = [
"sale.subscription.close.reason",
"sale.subscription.stage",
"sale.subscription.tag",
"sale.subscription.template"
]
for model_name in model_names:
model = self.env[model_name]
self.assertTrue(hasattr(model, 'name'))
self.assertTrue(hasattr(model, 'sequence'))Also, improve the existing test for copy behavior by adding edge cases:
def test_subscription_generic_field_mixin_copy_edge_cases(self):
TestModel = self.env["sale.subscription.template"]
original = TestModel.create({"name": "Test Template", "code": "test"})
# Test copy with empty name
original.name = ""
copied = original.copy()
self.assertEqual(copied.name, "(copy)")
# Test copy with None name
original.name = None
copied = original.copy()
self.assertEqual(copied.name, "(copy)")Use SavepointCase for tests involving model creation and copying to ensure clean state isolation between tests.
⏰ PR Aging Alert
This PR by @Mohajiro has been open for 144 days (4 months).
🔴 Zero human reviews in 144 days. This contributor invested their time to improve this module. The PSC owes them at least a response — even a "needs changes" is better than silence.
Every ignored PR is a contributor who might not come back. Review time matters. (OCA Aging Report)
Reciprocal Review Request
Hi everyone! I found some test failures on this PR and left detailed feedback above. I am happy to discuss or help debug. In the meantime, if any of you get a chance, I would appreciate a look at my open PR(s):
My open PRs across OCA:
- server-tools#3548 [18.0][MIG] base_kanban_stage: Migration to 18.0
- hr-attendance#262 [16.0][ADD] Hr_attendance_idsecure: iDSecure (ControliD) attendance integration
- stock-logistics-workflow#2276 [16.0][ADD] stock_move_line_devaluation
- stock-logistics-workflow#2275 [16.0][ADD] Stock move line analytic account
- stock-logistics-workflow#2268 [16.0][ADD] stock_move_line_picking_partner
- purchase-workflow#2694 [16.0][IMP]Purchase workflow added to review state & exception fix
Reviewing each other's work helps the whole community move forward. Thank you!
Environment via OCA Neural Reviewer: Minikube + K8s Job + oca-ci/py3.10-odoo16.0 | Odoo 16.0
Automated review by OCA Neural Reviewer + qwen3-coder:30b
Add '(copy)' suffix on duplication and sequence handles for stages, templates, tags, and close reasons.
Enable tree,form views and remove inline editing.
Task: 5020