feat: hide authorizer for rental orders, auto-set sale type
Rental orders no longer show the "Authorizer Required?" question or the Authorizer field. The sale type is automatically set to 'Rentals' when creating or confirming a rental order. Validation logic also skips authorizer checks for rental sale type. Made-with: Cursor
This commit is contained in:
@@ -51,6 +51,11 @@ class PoyntRefundWizard(models.TransientModel):
|
||||
required=True,
|
||||
readonly=True,
|
||||
)
|
||||
provider_name = fields.Char(
|
||||
related='provider_id.name',
|
||||
string="Poynt Provider",
|
||||
readonly=True,
|
||||
)
|
||||
original_transaction_id = fields.Many2one(
|
||||
'payment.transaction',
|
||||
string="Original Transaction",
|
||||
@@ -104,6 +109,9 @@ class PoyntRefundWizard(models.TransientModel):
|
||||
)
|
||||
status_message = fields.Text(string="Status", readonly=True)
|
||||
|
||||
def _get_provider_sudo(self):
|
||||
return self.provider_id.sudo()
|
||||
|
||||
@api.model
|
||||
def default_get(self, fields_list):
|
||||
res = super().default_get(fields_list)
|
||||
@@ -130,8 +138,9 @@ class PoyntRefundWizard(models.TransientModel):
|
||||
res['original_invoice_id'] = credit_note.reversed_entry_id.id
|
||||
res['original_poynt_txn_id'] = orig_tx.poynt_transaction_id
|
||||
|
||||
if orig_tx.provider_id.poynt_default_terminal_id:
|
||||
res['terminal_id'] = orig_tx.provider_id.poynt_default_terminal_id.id
|
||||
provider = orig_tx.provider_id.sudo()
|
||||
if provider.poynt_default_terminal_id:
|
||||
res['terminal_id'] = provider.poynt_default_terminal_id.id
|
||||
|
||||
age_days = 0
|
||||
if orig_tx.create_date:
|
||||
@@ -201,7 +210,7 @@ class PoyntRefundWizard(models.TransientModel):
|
||||
still showing ``status: CAPTURED``. We must check the full chain.
|
||||
"""
|
||||
orig_tx = self.original_transaction_id
|
||||
provider = self.provider_id
|
||||
provider = self._get_provider_sudo()
|
||||
txn_id = orig_tx.poynt_transaction_id
|
||||
|
||||
try:
|
||||
@@ -278,7 +287,7 @@ class PoyntRefundWizard(models.TransientModel):
|
||||
def _process_referenced_refund(self):
|
||||
"""Send a referenced REFUND using the original transaction's parentId."""
|
||||
orig_tx = self.original_transaction_id
|
||||
provider = self.provider_id
|
||||
provider = self._get_provider_sudo()
|
||||
|
||||
parent_txn_id = orig_tx.poynt_transaction_id
|
||||
try:
|
||||
@@ -346,7 +355,7 @@ class PoyntRefundWizard(models.TransientModel):
|
||||
"The customer's card must be present on the device."
|
||||
))
|
||||
|
||||
provider = self.provider_id
|
||||
provider = self._get_provider_sudo()
|
||||
orig_tx = self.original_transaction_id
|
||||
minor_amount = poynt_utils.format_poynt_amount(
|
||||
self.amount, self.currency_id,
|
||||
|
||||
Reference in New Issue
Block a user