mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[RFC]pms_api_rest: payments to transactions
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
from . import pms_property
|
||||
from . import res_users
|
||||
from . import account_payment
|
||||
|
||||
36
pms_api_rest/models/account_payment.py
Normal file
36
pms_api_rest/models/account_payment.py
Normal file
@@ -0,0 +1,36 @@
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class AccountPayment(models.Model):
|
||||
_inherit = "account.payment"
|
||||
|
||||
pms_api_transaction_type = fields.Selection(
|
||||
selection=[
|
||||
("customer_inbound", "Customer Payment"),
|
||||
("customer_outbound", "Customer Refund"),
|
||||
("supplier_outbound", "Supplier Payment"),
|
||||
("supplier_inbound", "Supplier Refund"),
|
||||
("internal_transfer", "Internal Transfer"),
|
||||
],
|
||||
string="PMS API Transaction Type",
|
||||
help="Transaction type for PMS API",
|
||||
compute="_compute_pms_api_transaction_type",
|
||||
store=True,
|
||||
)
|
||||
|
||||
@api.depends("payment_type", "partner_type")
|
||||
def _compute_pms_api_transaction_type(self):
|
||||
for record in self:
|
||||
if record.is_internal_transfer:
|
||||
return "internal_transfer"
|
||||
if record.partner_type == "customer":
|
||||
if record.payment_type == "inbound":
|
||||
return "customer_payment"
|
||||
else:
|
||||
return "customer_refund"
|
||||
if record.partner_type == "supplier":
|
||||
if record.payment_type == "inbound":
|
||||
return "supplier_payment"
|
||||
else:
|
||||
return "supplier_refund"
|
||||
return False
|
||||
Reference in New Issue
Block a user