mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP]pms_api_rest: added get, post and patch services and datamdels to partner
This commit is contained in:
35
pms_api_rest/services/pms_account_payment_terms_service.py
Normal file
35
pms_api_rest/services/pms_account_payment_terms_service.py
Normal 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
|
||||
Reference in New Issue
Block a user