changes
This commit is contained in:
@@ -1091,6 +1091,23 @@ class SaleOrder(models.Model):
|
||||
"Card reauthorization form sent to customer."
|
||||
))
|
||||
|
||||
def action_open_card_authorization(self):
|
||||
"""Open the card authorization form in the browser for phone authorization."""
|
||||
self.ensure_one()
|
||||
self.rental_agreement_token = uuid.uuid4().hex
|
||||
base_url = self.env['ir.config_parameter'].sudo().get_param(
|
||||
'web.base.url', '',
|
||||
)
|
||||
url = (
|
||||
f"{base_url}/rental/reauthorize/"
|
||||
f"{self.id}/{self.rental_agreement_token}"
|
||||
)
|
||||
return {
|
||||
'type': 'ir.actions.act_url',
|
||||
'url': url,
|
||||
'target': 'new',
|
||||
}
|
||||
|
||||
def _process_post_signing_payments(self):
|
||||
"""Auto-collect payments after the customer signs the agreement.
|
||||
|
||||
|
||||
@@ -122,18 +122,26 @@
|
||||
</group>
|
||||
<group string="Payment">
|
||||
<field name="rental_payment_token_id"/>
|
||||
<div invisible="not is_rental_order or state != 'sale' or rental_closed">
|
||||
<button name="action_send_card_reauthorization"
|
||||
type="object"
|
||||
class="btn btn-outline-secondary btn-sm"
|
||||
string="Reauthorize Card"
|
||||
icon="fa-credit-card"
|
||||
confirm="This will send a card authorization form to the customer. Continue?"/>
|
||||
</div>
|
||||
<field name="rental_charges_invoice_id"
|
||||
invisible="not rental_charges_invoice_id" readonly="1"/>
|
||||
<field name="rental_deposit_invoice_id"
|
||||
invisible="not rental_deposit_invoice_id" readonly="1"/>
|
||||
<div invisible="not is_rental_order or state != 'sale' or rental_closed"
|
||||
class="mt-3" colspan="2">
|
||||
<div class="d-grid gap-2" style="max-width:280px;">
|
||||
<button name="action_open_card_authorization"
|
||||
type="object"
|
||||
class="btn btn-primary btn-sm"
|
||||
string="Authorize Card by Phone"
|
||||
icon="fa-phone"/>
|
||||
<button name="action_send_card_reauthorization"
|
||||
type="object"
|
||||
class="btn btn-outline-secondary btn-sm"
|
||||
string="Send Authorization Link to Customer"
|
||||
icon="fa-envelope"
|
||||
confirm="This will send a card authorization form to the customer. Continue?"/>
|
||||
</div>
|
||||
</div>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user