mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[RFC]pms_api_rest: rename segmentations service for partner categories
This commit is contained in:
@@ -6,7 +6,7 @@ from odoo.addons.component.core import Component
|
|||||||
class PmsPartnerCategoriesService(Component):
|
class PmsPartnerCategoriesService(Component):
|
||||||
_inherit = "base.rest.service"
|
_inherit = "base.rest.service"
|
||||||
_name = "res.partner.category.service"
|
_name = "res.partner.category.service"
|
||||||
_usage = "segmentations"
|
_usage = "categories"
|
||||||
_collection = "pms.services"
|
_collection = "pms.services"
|
||||||
|
|
||||||
@restapi.method(
|
@restapi.method(
|
||||||
@@ -21,17 +21,17 @@ class PmsPartnerCategoriesService(Component):
|
|||||||
output_param=Datamodel("res.partner.category.info", is_list=True),
|
output_param=Datamodel("res.partner.category.info", is_list=True),
|
||||||
auth="jwt_api_pms",
|
auth="jwt_api_pms",
|
||||||
)
|
)
|
||||||
def get_parent_segmentation_ids(self):
|
def get_categories(self):
|
||||||
result_segmentation_ids = []
|
result_categories = []
|
||||||
ResPartnerCategoryInfo = self.env.datamodels["res.partner.category.info"]
|
ResPartnerCategoryInfo = self.env.datamodels["res.partner.category.info"]
|
||||||
for segmentation_id in self.env["res.partner.category"].search([]):
|
for category in self.env["res.partner.category"].search([]):
|
||||||
result_segmentation_ids.append(
|
result_categories.append(
|
||||||
ResPartnerCategoryInfo(
|
ResPartnerCategoryInfo(
|
||||||
id=segmentation_id.id,
|
id=category.id,
|
||||||
name=segmentation_id.name,
|
name=category.name,
|
||||||
parentId=segmentation_id.parent_id.id
|
parentId=category.parent_id.id
|
||||||
if segmentation_id.parent_id.id
|
if category.parent_id.id
|
||||||
else 0,
|
else 0,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return result_segmentation_ids
|
return result_categories
|
||||||
|
|||||||
Reference in New Issue
Block a user