[IMP]pms_api_rest: added get, post and patch services and datamdels to partner

This commit is contained in:
braisab
2022-10-03 19:42:12 +02:00
committed by Darío Lodeiros
parent 5fc6fbe4ce
commit c4b459f7d6
8 changed files with 309 additions and 103 deletions

View File

@@ -0,0 +1,35 @@
from odoo.addons.base_rest import restapi
from odoo.addons.base_rest_datamodel.restapi import Datamodel
from odoo.addons.component.core import Component
class PmsAccountPaymentTermService(Component):
_inherit = "base.rest.service"
_name = "pms.account.payment.term.service"
_usage = "payment-terms"
_collection = "pms.services"
@restapi.method(
[
(
[
"/",
],
"GET",
)
],
output_param=Datamodel("pms.account.payment.term.info", is_list=True),
auth="jwt_api_pms",
)
def get_account_payment_terms(self):
PmsAccountPaymenttermInfo = self.env.datamodels["pms.account.payment.term.info"]
res = []
for payment_term in self.env["account.payment.term"].search([]):
res.append(
PmsAccountPaymenttermInfo(
id=payment_term.id,
name=payment_term.name,
)
)
return res