diff --git a/payment_lyra/models/payment_provider.py b/payment_lyra/models/payment_provider.py index e2c3129..595e6b0 100644 --- a/payment_lyra/models/payment_provider.py +++ b/payment_lyra/models/payment_provider.py @@ -144,7 +144,7 @@ def _get_compatible_providers(self, *args, currency_id=None, **kwargs): @api.model def multi_add(self, filename, noupdate): if (constants.LYRA_PLUGIN_FEATURES.get('multi') == True): - module_upgrade = request.env['ir.module.module'].search([('state', '=', 'to upgrade'), ('name', '=', 'payment_lyra')]) + module_upgrade = self.env['ir.module.module'].search([('state', '=', 'to upgrade'), ('name', '=', 'payment_lyra')]) file = path.join(path.dirname(path.dirname(path.abspath(__file__)))) + filename mode = 'update' if module_upgrade else 'init' convert_xml_import(self.env, 'payment_lyra', file, None, mode, noupdate) @@ -272,7 +272,7 @@ def lyra_form_generate_values(self, values): return lyra_tx_values def lyra_generate_values_from_order(self, data): - sale_order = request.env['sale.order'].sudo().search([('id', '=', data['order_id'])]).exists() + sale_order = self.env['sale.order'].sudo().search([('id', '=', data['order_id'])]).exists() currency = self._lyra_get_currency(data['currency_id']) amount = float(sale_order.amount_total) @@ -410,7 +410,7 @@ def _lyra_get_embedded_payment_means(self): def _lyra_get_currency(self, currency_id): # Give the iso and the number of decimal toward the smallest monetary unit from the id of the currency. - currency_name = tools.find_currency(self.env['res.currency'].search([('id', '=', currency_id)]).exists().name) + currency_name = tools.find_currency(self.env['res.currency'].search([('id', '=', currency_id)]).exists().name) for currency in constants.LYRA_CURRENCIES: if currency[1] == str(currency_name): return (currency[0], currency[2]) @@ -420,7 +420,7 @@ def _lyra_get_currency(self, currency_id): def _lyra_get_inline_form_values( self, amount, currency, partner_id, is_validation, payment_method_sudo, sale_order_id, **kwargs ): - sale_order = request.env['sale.order'].sudo().search([('id', '=', sale_order_id)]).exists() + sale_order = self.env['sale.order'].sudo().search([('id', '=', sale_order_id)]).exists() values = { "provider_id": self.id, "provider_code" : "lyra", @@ -447,4 +447,4 @@ def _should_build_inline_form(self, is_validation=True): return False - return super()._should_build_inline_form(is_validation=True) \ No newline at end of file + return super()._should_build_inline_form(is_validation=True) diff --git a/payment_lyra/views/payment_lyra_templates.xml b/payment_lyra/views/payment_lyra_templates.xml index bfa05c2..76549d6 100644 --- a/payment_lyra/views/payment_lyra_templates.xml +++ b/payment_lyra/views/payment_lyra_templates.xml @@ -70,7 +70,7 @@ - \ No newline at end of file +