[IMP]pms_api_rest: new field code in document types datamodel

This commit is contained in:
braisab
2023-09-21 12:33:12 +02:00
committed by Darío Lodeiros
parent e1ea288bb5
commit 5bae4cd590
2 changed files with 3 additions and 1 deletions

View File

@@ -7,3 +7,4 @@ class PmsIdCategoryInfo(Datamodel):
_name = "pms.id.category.info"
id = fields.Integer(required=False, allow_none=True)
documentType = fields.String(required=False, allow_none=True)
code = fields.String(required=False, allow_none=True)

View File

@@ -24,11 +24,12 @@ class PmsIdCategoryService(Component):
def get_id_categories(self):
result_id_categories = []
PmsIdCategoryInfo = self.env.datamodels["pms.id.category.info"]
for id_category in self.env["res.partner.id_category"].search([]):
for id_category in self.env["res.partner.id_category"].with_context(lang=self.env.user.lang).search([]):
result_id_categories.append(
PmsIdCategoryInfo(
id=id_category.id,
documentType=id_category.name,
code=id_category.code,
)
)
return result_id_categories