Skip to content

Commit 80f171f

Browse files
committed
[FIX] partnership: make partnership saleable
Versions -------- - saas-18.3+ Steps ----- 1. Have a partnership product; 2. publish it on eCommerce; 3. as Portal or Public user, open /shop; 4. if visible, buy it & go back to /shop. Issue ----- Product is not available on /shop (anymore). Cause ----- Partnership tracking on service products isn't made saleable. Solution -------- Add `partnership` to `_get_saleable_tracking_types`. opw-4926679 closes odoo#218522 X-original-commit: d750ddd Signed-off-by: Vallaeys Valentin (vava) <[email protected]>
1 parent 9470fbe commit 80f171f

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

addons/partnership/models/product_template.py

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

3-
from odoo import fields, models
3+
from odoo import api, fields, models
44

55

66
class ProductTemplate(models.Model):
@@ -10,3 +10,7 @@ class ProductTemplate(models.Model):
1010
selection_add=[('partnership', 'Membership / Partnership')], ondelete={'partnership': 'set default'}
1111
)
1212
grade_id = fields.Many2one('res.partner.grade', string="Assigned Level")
13+
14+
@api.model
15+
def _get_saleable_tracking_types(self):
16+
return super()._get_saleable_tracking_types() + ['partnership']

addons/partnership/tests/test_partnership.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
from odoo import Command
44
from odoo.exceptions import ValidationError
5+
from odoo.tests import tagged
56

67
from .common import PartnershipCommon
78

89

10+
@tagged('post_install', '-at_install')
911
class TestPartnership(PartnershipCommon):
1012

1113
def test_sell_basic_partnership(self):
@@ -32,3 +34,15 @@ def test_constrains_uniqueness_partnership_grade(self):
3234
with self.assertRaises(ValidationError):
3335
# A sale order cannot contain partnership products assigning different grade levels
3436
self.sale_order_partnership.order_line = [Command.create({'product_id': partnership.id})]
37+
38+
def test_partnership_product_domain(self):
39+
ProductTemplate = self.env['product.template']
40+
product_domain = [
41+
('sale_ok', '=', True),
42+
('service_tracking', 'in', ProductTemplate._get_saleable_tracking_types()),
43+
]
44+
self.assertIn(
45+
self.partnership_product.product_tmpl_id,
46+
ProductTemplate.search(product_domain),
47+
"Partnership product should be saleable",
48+
)

0 commit comments

Comments
 (0)