mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
Merge branch 'fix/15.0/h14427_website_sale_signifyd__browser_ip' into '15.0-test'
fix/15.0/h14427_website_sale_signifyd__browser_ip into 15.0-test See merge request hibou-io/hibou-odoo/suite!1718
This commit is contained in:
@@ -8,15 +8,16 @@ from odoo.http import request
|
|||||||
class SaleOrder(models.Model):
|
class SaleOrder(models.Model):
|
||||||
_inherit = 'sale.order'
|
_inherit = 'sale.order'
|
||||||
|
|
||||||
|
# Source IP for case creation - determination attempted at order creation and if necessary at confirmation
|
||||||
def _get_source_ip(self):
|
def _get_source_ip(self):
|
||||||
if request and request.env.user._is_public():
|
if request:
|
||||||
return request.httprequest.environ['REMOTE_ADDR']
|
return request.httprequest.environ['REMOTE_ADDR']
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
signifyd_case_id = fields.Many2one('signifyd.case', readonly=1, copy=False)
|
signifyd_case_id = fields.Many2one('signifyd.case', readonly=1, copy=False)
|
||||||
singifyd_score = fields.Float(related='signifyd_case_id.score')
|
singifyd_score = fields.Float(related='signifyd_case_id.score')
|
||||||
signifyd_checkpoint_action = fields.Selection(string='Signifyd Action', related='signifyd_case_id.checkpoint_action')
|
signifyd_checkpoint_action = fields.Selection(string='Signifyd Action', related='signifyd_case_id.checkpoint_action')
|
||||||
source_ip = fields.Char(default=_get_source_ip)
|
source_ip = fields.Char(default=_get_source_ip, help='IP address of the customer, used for signifyd case creation.')
|
||||||
|
|
||||||
def action_view_signifyd_case(self):
|
def action_view_signifyd_case(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
@@ -109,6 +110,7 @@ class SaleOrder(models.Model):
|
|||||||
"orderSessionId": order_session_id,
|
"orderSessionId": order_session_id,
|
||||||
"orderId": self.id,
|
"orderId": self.id,
|
||||||
"checkoutToken": checkout_token,
|
"checkoutToken": checkout_token,
|
||||||
|
"browserIpAddress": browser_ip_address,
|
||||||
"currency": self.partner_id.currency_id.name,
|
"currency": self.partner_id.currency_id.name,
|
||||||
"orderChannel": "WEB",
|
"orderChannel": "WEB",
|
||||||
"totalPrice": self.amount_total,
|
"totalPrice": self.amount_total,
|
||||||
@@ -178,7 +180,4 @@ class SaleOrder(models.Model):
|
|||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
if browser_ip_address:
|
|
||||||
new_case_vals['purchase']['browserIpAddress'] = browser_ip_address
|
|
||||||
|
|
||||||
return new_case_vals
|
return new_case_vals
|
||||||
|
|||||||
Reference in New Issue
Block a user