Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions website_sale_charge_payment_fee/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
=============================
eCommerce: charge payment fee
=============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:3a67cc1583ea293fcac70c6cdcae7551370e3a7669c85ef1dc2b2809983aff5d
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fe--commerce-lightgray.png?logo=github
:target: https://github.com/OCA/e-commerce/tree/18.0/website_sale_charge_payment_fee
:alt: OCA/e-commerce
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/e-commerce-18-0/e-commerce-18-0-website_sale_charge_payment_fee
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/e-commerce&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows to associate generic payment fee to online payment
methods. Thus, when website user select a payment method with additional
fee, an additional sale order line will be added to online order

**Table of contents**

.. contents::
:local:

Configuration
=============

Click

Accounting -> Configuration -> Payments -> Payment Acquirers

open an acquirer and in CHARGE PAYMENT FEE tab, you can set the fee to
be charged to customer.

Known issues / Roadmap
======================

- As for now, this module does not handle express checkout.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/e-commerce/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/e-commerce/issues/new?body=module:%20website_sale_charge_payment_fee%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Agile Business Group
* AITIC S.A.S
* Quartile Limited
* Studio73

Contributors
------------

- Lorenzo Battistini <lorenzo.battistini@agilebg.com>

- AITIC S.A. <info@aitic.com.ar>

- Quartile Limited <info@quartile.co>

- `Studio73 <https://www.studio73.es>`__:

- Miguel Gandia

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-miguel-S73| image:: https://github.com/miguel-S73.png?size=40px
:target: https://github.com/miguel-S73
:alt: miguel-S73

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-miguel-S73|

This module is part of the `OCA/e-commerce <https://github.com/OCA/e-commerce/tree/18.0/website_sale_charge_payment_fee>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions website_sale_charge_payment_fee/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import controllers
31 changes: 31 additions & 0 deletions website_sale_charge_payment_fee/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2018 Lorenzo Battistini - Agile Business Group
# Copyright 2020 AITIC S.A.S
# Copyright 2020 Quartile Limited
# Copyright 2024 Miguel Gandia - Studio73
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
{
"name": "eCommerce: charge payment fee",
"summary": "Payment fee charged to customer",
"version": "18.0.1.0.0",
"category": "Website",
"website": "https://github.com/OCA/e-commerce",
"maintainers": ["miguel-S73"],
"author": "Agile Business Group, "
"AITIC S.A.S, "
"Quartile Limited, "
"Studio73, "
"Odoo Community Association (OCA)",
"license": "LGPL-3",
"application": False,
"installable": True,
"depends": ["payment", "website_sale"],
"data": ["views/payment_provider_views.xml", "views/website_sale_templates.xml"],
"assets": {
"web.assets_frontend": [
"website_sale_charge_payment_fee/static/src/js/website_sale_fee.esm.js",
],
"web.assets_tests": [
"website_sale_charge_payment_fee/static/tests/tours/website_sale_fee_tour.esm.js",
],
},
}
1 change: 1 addition & 0 deletions website_sale_charge_payment_fee/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import main
43 changes: 43 additions & 0 deletions website_sale_charge_payment_fee/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2018 Lorenzo Battistini - Agile Business Group
# Copyright 2020 AITIC S.A.S
# Copyright 2020 Quartile Limited
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).

from odoo import http
from odoo.http import request

from odoo.addons.website_sale.controllers.main import WebsiteSale


class WebsiteSaleFee(WebsiteSale):
@http.route(
"/shop/payment", type="http", auth="public", website=True, sitemap=False
)
def shop_payment(self, **post):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class PaymentPortal, doesn’t have the shop_payment function in the payment module. This method is added in the website_sale module. Why did you change the class to inherit from it instead of inheriting from the WebsiteSale class?

order = request.website.sudo().sale_get_order()
render_values = self._get_shop_payment_values(order, **post)
provider_id = post.get("provider_id")
payment_option_id = post.get("payment_option_id")
payment_methods_sudo = render_values.get("payment_methods_sudo")
providers_sudo = render_values.get("providers_sudo")
selected_provider = False
if provider_id or providers_sudo:
if provider_id:
selected_provider = request.env["payment.provider"].browse(
int(provider_id)
)
else:
_selected_provider = [
provider_sudo
for provider_sudo in payment_methods_sudo.provider_ids
if provider_sudo in providers_sudo
][:1]
if len(_selected_provider) > 0:
selected_provider = _selected_provider[0]
order.sudo().update_fee_line(selected_provider.sudo())
res = super().shop_payment(**post)
if payment_option_id:
res.qcontext["selected_payment_method"] = int(payment_option_id)
if selected_provider:
res.qcontext["selected_provider"] = selected_provider
return res
111 changes: 111 additions & 0 deletions website_sale_charge_payment_fee/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_charge_payment_fee
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-04-17 16:07+0000\n"
"PO-Revision-Date: 2025-04-17 16:07+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: website_sale_charge_payment_fee
#: model_terms:ir.ui.view,arch_db:website_sale_charge_payment_fee.method_form_fee
msgid "(Fee:"
msgstr "(Tasa:"

#. module: website_sale_charge_payment_fee
#: model:ir.model.fields,help:website_sale_charge_payment_fee.field_payment_provider__charge_fee
msgid ""
"An extra fee line will be added to online order when using this payment "
"method"
msgstr ""
"Se añadirá una línea de tarifa adicional al pedido en línea cuando se "
"utilice este método de pago"

#. module: website_sale_charge_payment_fee
#: model_terms:ir.ui.view,arch_db:website_sale_charge_payment_fee.provider_form_fee_inherit
msgid "Charge payment fee"
msgstr "Cargo por pago"

#. module: website_sale_charge_payment_fee
#: model:ir.model.fields,field_description:website_sale_charge_payment_fee.field_payment_provider__charge_fee_type
msgid "Computation type"
msgstr "Tipo de computación"

#. module: website_sale_charge_payment_fee
#: model:ir.model.fields,field_description:website_sale_charge_payment_fee.field_payment_provider__charge_fee_currency_id
msgid "Fee Currency"
msgstr "Divisa de la Tasa"

#. module: website_sale_charge_payment_fee
#: model:ir.model.fields,field_description:website_sale_charge_payment_fee.field_payment_provider__charge_fee_description
msgid "Fee Description"
msgstr "Descripción de Tasa"

#. module: website_sale_charge_payment_fee
#: model:ir.model.fields,field_description:website_sale_charge_payment_fee.field_payment_provider__charge_fee_product_id
msgid "Fee Product"
msgstr "Producto de tarifa"

#. module: website_sale_charge_payment_fee
#: model:ir.model.fields,field_description:website_sale_charge_payment_fee.field_payment_provider__charge_fee
msgid "Fee charged to customer"
msgstr "Tarifa cobrada al cliente"

#. module: website_sale_charge_payment_fee
#: model:ir.model.fields.selection,name:website_sale_charge_payment_fee.selection__payment_provider__charge_fee_type__fixed
msgid "Fixed"
msgstr "Fijo"

#. module: website_sale_charge_payment_fee
#: model:ir.model.fields,field_description:website_sale_charge_payment_fee.field_payment_provider__charge_fee_fixed_price
msgid "Fixed Price"
msgstr "Precio Fijo"

#. module: website_sale_charge_payment_fee
#: model_terms:ir.ui.view,arch_db:website_sale_charge_payment_fee.payment_fee
msgid "Payment Fee"
msgstr "Cuota de pago:"

#. module: website_sale_charge_payment_fee
#: model:ir.model.fields,field_description:website_sale_charge_payment_fee.field_sale_order__amount_payment_fee
msgid "Payment Fee Amount"
msgstr "Importe de la tarifa de pago"

#. module: website_sale_charge_payment_fee
#: model:ir.model,name:website_sale_charge_payment_fee.model_payment_provider
msgid "Payment Provider"
msgstr "Proveedor de pago"

#. module: website_sale_charge_payment_fee
#: model:ir.model.fields,field_description:website_sale_charge_payment_fee.field_sale_order_line__payment_fee_line
msgid "Payment fee line"
msgstr "Línea de cuota pago"

#. module: website_sale_charge_payment_fee
#: model:ir.model.fields,field_description:website_sale_charge_payment_fee.field_payment_provider__charge_fee_percentage
#: model:ir.model.fields.selection,name:website_sale_charge_payment_fee.selection__payment_provider__charge_fee_type__percentage
msgid "Percentage"
msgstr "Porcentaje"

#. module: website_sale_charge_payment_fee
#: model:ir.model.fields,help:website_sale_charge_payment_fee.field_payment_provider__charge_fee_percentage
msgid "Percentage applied to order total"
msgstr "Porcentaje aplicado al total del pedido"

#. module: website_sale_charge_payment_fee
#: model:ir.model,name:website_sale_charge_payment_fee.model_sale_order
msgid "Sales Order"
msgstr "Pedido de venta"

#. module: website_sale_charge_payment_fee
#: model:ir.model,name:website_sale_charge_payment_fee.model_sale_order_line
msgid "Sales Order Line"
msgstr "Línea de pedido de venta"
Loading