Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
73 changes: 73 additions & 0 deletions website_sale_installment_plans/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
.. |company| replace:: ADHOC SA

.. |company_logo| image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-logo.png
:alt: ADHOC SA
:target: https://www.adhoc.com.ar

.. |icon| image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-icon.png

.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: https://www.gnu.org/licenses/agpl
:alt: License: AGPL-3

==============================
Website Sale Installment Plans
==============================

This module adds a feature in card installment to show installment plans on the website.

Installation
============

To install this module, you need to:

#. Just install ...

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

To configure this module, you need to:

#. Go to Card installment.
#. Choose a Card installment plan.
#. Set the installment plan to be shown on the website.

Usage
=====

To use this module, you need to:


.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: http://runbot.adhoc.com.ar/

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

Bugs are tracked on `GitHub Issues
<https://github.com/ingadhoc/website/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.

Credits
=======

Images
------

.. image:: https://github.com/ingadhoc/website/raw/16.0/website_sale_installment_plans/static/description/feature_img.png

* |company| |icon|

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

Maintainer
----------

|company_logo|

This module is maintained by the |company|.

To contribute to this module, please visit https://www.adhoc.com.ar.
1 change: 1 addition & 0 deletions website_sale_installment_plans/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
18 changes: 18 additions & 0 deletions website_sale_installment_plans/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "Website Sale Installment Plan",
"category": "Website/Website",
"version": "17.0.1.0.0",
"author": "ADHOC SA",
"website": "www.adhoc.com.ar",
"license": "AGPL-3",
"depends": [
"product",
"website_sale",
"card_installment",
],
"data": [
"views/account_card_installment_views.xml",
"views/website_templates.xml",
],
"installable": True,
}
70 changes: 70 additions & 0 deletions website_sale_installment_plans/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_installment_plans
#
# Translators:
# Juan José Scarafía <scarafia.juanjose@gmail.com>, 2025
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-08-20 21:21+0000\n"
"PO-Revision-Date: 2025-08-20 21:21+0000\n"
"Last-Translator: Juan José Scarafía <scarafia.juanjose@gmail.com>, 2025\n"
"Language-Team: Spanish (https://app.transifex.com/adhoc/teams/46451/es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: es\n"
"Plural-Forms: nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n"

#. module: website_sale_installment_plans
#: model:ir.model.fields,field_description:website_sale_installment_plans.field_account_card_installment__can_publish
msgid "Can Publish"
msgstr ""

#. module: website_sale_installment_plans
#: model:ir.model.fields,field_description:website_sale_installment_plans.field_account_card_installment__is_published
msgid "Is Published"
msgstr "Publicado"

#. module: website_sale_installment_plans
#: model:ir.model.fields,help:website_sale_installment_plans.field_account_card_installment__message
msgid "Mensaje que se muestra al final de la leyenda de cuotas"
msgstr "Message shown at the end of installments text"

#. module: website_sale_installment_plans
#: model:ir.model.fields,field_description:website_sale_installment_plans.field_account_card_installment__message
msgid "Message"
msgstr "Mensaje"

#. module: website_sale_installment_plans
#: model:ir.model,name:website_sale_installment_plans.model_product_template
msgid "Product"
msgstr "Producto"

#. module: website_sale_installment_plans
#: model_terms:ir.ui.view,arch_db:website_sale_installment_plans.account_card_form_installment_plan
msgid "Published in website"
msgstr "Publicado en website"

#. module: website_sale_installment_plans
#: model:ir.model.fields,help:website_sale_installment_plans.field_account_card_installment__website_url
msgid "The full URL to access the document through the website."
msgstr "URL completa para acceder al documento a través del sitio web"

#. module: website_sale_installment_plans
#: model:ir.model.fields,field_description:website_sale_installment_plans.field_account_card_installment__website_published
msgid "Visible on current website"
msgstr "Visible en el website actual"

#. module: website_sale_installment_plans
#: model:ir.model.fields,field_description:website_sale_installment_plans.field_account_card_installment__website_url
msgid "Website URL"
msgstr "URL del Sitio Web"

#. module: website_sale_installment_plans
#: model:ir.model,name:website_sale_installment_plans.model_account_card_installment
msgid "amount to add for collection in installments"
msgstr "Cantidad a añadir para cobro en cuotas"
2 changes: 2 additions & 0 deletions website_sale_installment_plans/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import account_card_installment
from . import product_template
30 changes: 30 additions & 0 deletions website_sale_installment_plans/models/account_card_installment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from odoo import fields, models


class AccountCardInstallment(models.Model):
_name = "account.card.installment"
_inherit = ["account.card.installment", "website.published.mixin"]

message = fields.Char(help="Mensaje que se muestra al final de la leyenda de cuotas")

def map_installment_values(self, amount_total):
self.ensure_one()

result = super().map_installment_values(amount_total)

divisor = self.divisor if self.divisor else 1
installment = self.installment if self.installment else 1
amount = result["amount"]
description = (
"En %s cuota de $%.2f" % (divisor, amount)
if divisor == 1
else "En %s cuotas de $%.2f (Total $%.2f)" % (installment, amount / installment, amount)
)

result.update(
{
"description": description,
}
)

return result
43 changes: 43 additions & 0 deletions website_sale_installment_plans/models/product_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
from odoo import models


class ProductTemplate(models.Model):
_inherit = "product.template"

def _get_published_installments(self):
return self.env["account.card.installment"].sudo().search([("is_published", "=", True)])

def _get_installment_plans(self, price):
plans = []
for cuota in self._get_published_installments():
values = cuota.map_installment_values(price)
plans.append(
{
"installments": cuota.installment,
"description": values["description"],
"message": cuota.message or "",
}
)
return plans

def _get_combination_info(
self, combination=False, product_id=False, add_qty=1, parent_combination=False, only_template=False
):
combination_info = super()._get_combination_info(
combination=combination,
product_id=product_id,
add_qty=add_qty,
parent_combination=parent_combination,
only_template=only_template,
)

product_price = combination_info.get("price", 0)
installment_plans = self._get_installment_plans(product_price)
combination_info.update({"installment_plans": installment_plans})

return combination_info

def _get_card_installments_for_shop(self, context_price):
installment_plans = self._get_installment_plans(context_price)

return installment_plans
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<odoo>
<record id="account_card_form_installment_plan" model="ir.ui.view">
<field name="name">account_card.form.view.installment.plan</field>
<field name="model">account.card</field>
<field name="inherit_id" ref="card_installment.account_card_form"/>
<field name="arch" type="xml">
<field name="installment" position="after">
<field name="is_published" string="Published in website"/>
</field>
<field name="installment" position="before">
<field name="message"/>
</field>
</field>
</record>
</odoo>
39 changes: 39 additions & 0 deletions website_sale_installment_plans/views/website_templates.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0"?>
<data>
<template id="product_page_card_installment_plan" inherit_id="website_sale.product_price">
<xpath expr="//div[@id='product_unavailable']" position="before">
<div class="installment-plans">
<t t-foreach="combination_info.get('installment_plans', [])" t-as="installment">
<p style="font-size: 12px; color: #666; margin: 5px 0;">
<i class="fa fa-credit-card" aria-hidden="true" style="color:#000000;font-size:14px;margin-right:5px;"/>
<span style="color: black; font-weight: bold;">
<span t-esc="installment['description']"/>
</span>
<span t-if="installment['message']" style="font-size: 11px; color: #999; margin-left: 5px;">
<span t-esc="installment['message']"/>
</span>
</p>
</t>
</div>
</xpath>
</template>

<template id="product_template_products_item_installment_plan" inherit_id="website_sale.products_item">
<xpath expr="//span[@t-esc='website.currency_id.name']" position="after">
<div class="installment-plans">
<t t-set="cuotas" t-value="product._get_card_installments_for_shop(template_price_vals.get('price_reduce', []))"/>
<t t-foreach="cuotas" t-as="installment">
<p style="font-size: 12px; color: #666; margin: 5px 0;">
<i class="fa fa-credit-card" aria-hidden="true" style="color:#000000;font-size:14px;margin-right:5px;"/>
<span style="color: black; font-weight: bold;">
<span t-esc="installment['description']"/>
</span>
<span t-if="installment['message']" style="font-size: 11px; color: #999; margin-left: 5px;">
<span t-esc="installment['message']"/>
</span>
</p>
</t>
</div>
</xpath>
</template>
</data>