Skip to content
Open
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
96 changes: 96 additions & 0 deletions contract_variable_qty_prorated/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

==============================
Contract Variable Qty Prorated
==============================

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

.. |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/license-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github
:target: https://github.com/OCA/contract/tree/19.0/contract_variable_qty_prorated
:alt: OCA/contract
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/contract-19-0/contract-19-0-contract_variable_qty_prorated
: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/contract&target_branch=19.0
:alt: Try me on Runboat

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

This module adds a formula to compute prorated quantity to invoice as
extension of the module contract_variable_quantity.

**Table of contents**

.. contents::
:local:

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

If this module is installed with product_contract, the quantity field of
sale order lines won't be displayed.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/contract/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/contract/issues/new?body=module:%20contract_variable_qty_prorated%0Aversion:%2019.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
-------

* ACSONE SA/NV

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

- Souheil Bejaoui <souheil.bejaoui@acsone.eu>
- Thomas Binsfeld <thomas.binsfeld@acsone.eu>

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-sbejaoui| image:: https://github.com/sbejaoui.png?size=40px
:target: https://github.com/sbejaoui
:alt: sbejaoui

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

|maintainer-sbejaoui|

This module is part of the `OCA/contract <https://github.com/OCA/contract/tree/19.0/contract_variable_qty_prorated>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions contract_variable_qty_prorated/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions contract_variable_qty_prorated/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2018 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Contract Variable Qty Prorated",
"version": "19.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
"maintainers": ["sbejaoui"],
"website": "https://github.com/OCA/contract",
"depends": ["contract_variable_quantity"],
"data": [
"data/contract_variable_qty_prorated.xml",
"views/contract_template_line.xml",
],
"demo": [],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2018 ACSONE SA/NV
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="contract_variable_qty_prorated" model="contract.line.qty.formula">
<field name='name'>Prorated Quantity</field>
<field name="code">
result = 0
if line:
result = line.quantity * line.compute_prorated(period_first_date, period_last_date, invoice_date)

</field>
</record>
</odoo>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * contract_variable_qty_prorated
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \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: contract_variable_qty_prorated
#: model:ir.model,name:contract_variable_qty_prorated.model_contract_line
msgid "Contract Line"
msgstr ""

#. module: contract_variable_qty_prorated
#: model:contract.line.qty.formula,name:contract_variable_qty_prorated.contract_variable_qty_prorated
msgid "Prorated Quantity"
msgstr ""
28 changes: 28 additions & 0 deletions contract_variable_qty_prorated/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * contract_variable_qty_prorated
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-10-01 09:33+0000\n"
"PO-Revision-Date: 2021-01-04 11:44+0000\n"
"Last-Translator: Rémi <remi@le-filament.com>\n"
"Language-Team: \n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.3.2\n"

#. module: contract_variable_qty_prorated
#: model:ir.model,name:contract_variable_qty_prorated.model_contract_line
msgid "Contract Line"
msgstr "Ligne de Contrat"

#. module: contract_variable_qty_prorated
#: model:contract.line.qty.formula,name:contract_variable_qty_prorated.contract_variable_qty_prorated
msgid "Prorated Quantity"
msgstr "Quantité proratisée"
27 changes: 27 additions & 0 deletions contract_variable_qty_prorated/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * contract_variable_qty_prorated
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2025-07-31 10:25+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.10.4\n"

#. module: contract_variable_qty_prorated
#: model:ir.model,name:contract_variable_qty_prorated.model_contract_line
msgid "Contract Line"
msgstr "Riga contratto"

#. module: contract_variable_qty_prorated
#: model:contract.line.qty.formula,name:contract_variable_qty_prorated.contract_variable_qty_prorated
msgid "Prorated Quantity"
msgstr "Quantità ripartita"
25 changes: 25 additions & 0 deletions contract_variable_qty_prorated/i18n/nl.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * contract_variable_qty_prorated
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: nl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"

#. module: contract_variable_qty_prorated
#: model:ir.model,name:contract_variable_qty_prorated.model_contract_line
msgid "Contract Line"
msgstr ""

#. module: contract_variable_qty_prorated
#: model:contract.line.qty.formula,name:contract_variable_qty_prorated.contract_variable_qty_prorated
msgid "Prorated Quantity"
msgstr ""
27 changes: 27 additions & 0 deletions contract_variable_qty_prorated/i18n/nl_NL.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * contract_variable_qty_prorated
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2025-12-29 10:42+0000\n"
"Last-Translator: Bosd <c5e2fd43-d292-4c90-9d1f-74ff3436329a@anonaddy.me>\n"
"Language-Team: none\n"
"Language: nl_NL\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.10.4\n"

#. module: contract_variable_qty_prorated
#: model:ir.model,name:contract_variable_qty_prorated.model_contract_line
msgid "Contract Line"
msgstr "Contractregel"

#. module: contract_variable_qty_prorated
#: model:contract.line.qty.formula,name:contract_variable_qty_prorated.contract_variable_qty_prorated
msgid "Prorated Quantity"
msgstr "Pro rata hoeveelheid"
27 changes: 27 additions & 0 deletions contract_variable_qty_prorated/i18n/pt_BR.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * contract_variable_qty_prorated
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2020-06-17 01:19+0000\n"
"Last-Translator: Fernando Colus <fcolus1@gmail.com>\n"
"Language-Team: none\n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 3.10\n"

#. module: contract_variable_qty_prorated
#: model:ir.model,name:contract_variable_qty_prorated.model_contract_line
msgid "Contract Line"
msgstr "Linha de Contrato"

#. module: contract_variable_qty_prorated
#: model:contract.line.qty.formula,name:contract_variable_qty_prorated.contract_variable_qty_prorated
msgid "Prorated Quantity"
msgstr "Quantidade Proporcional (Pró-rata)"
25 changes: 25 additions & 0 deletions contract_variable_qty_prorated/i18n/sv.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * contract_variable_qty_prorated
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: sv\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"

#. module: contract_variable_qty_prorated
#: model:ir.model,name:contract_variable_qty_prorated.model_contract_line
msgid "Contract Line"
msgstr ""

#. module: contract_variable_qty_prorated
#: model:contract.line.qty.formula,name:contract_variable_qty_prorated.contract_variable_qty_prorated
msgid "Prorated Quantity"
msgstr ""
1 change: 1 addition & 0 deletions contract_variable_qty_prorated/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import contract_line
53 changes: 53 additions & 0 deletions contract_variable_qty_prorated/models/contract_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Copyright 2018 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, models


class ContractLine(models.Model):
_inherit = "contract.line"

def compute_prorated(self, period_first_date, period_last_date, invoice_date):
self.ensure_one()
return self._compute_prorated(
period_first_date,
period_last_date,
invoice_date,
self.recurring_rule_type,
self.recurring_interval,
self.recurring_invoicing_type,
)

@api.model
def _compute_prorated(
self,
period_first_date,
period_last_date,
invoice_date,
recurring_rule_type,
recurring_interval,
recurring_invoicing_type,
):
def _invoiced_days(next_date, last_date):
return (next_date - last_date).days + 1

relative_delta = self.get_relative_delta(
recurring_rule_type, recurring_interval
)
theoretical_next_date = invoice_date
if (
recurring_rule_type == "monthlylastday"
and recurring_invoicing_type == "post-paid"
):
relative_delta = self.get_relative_delta("monthly", recurring_interval)
theoretical_next_date += self.get_relative_delta("daily", 1)

if recurring_invoicing_type == "pre-paid":
theoretical_next_date += relative_delta
theoretical_last_date = theoretical_next_date - relative_delta
theoretical_next_date -= self.get_relative_delta("daily", 1)
real_last_date = period_first_date
real_next_date = period_last_date
return _invoiced_days(real_next_date, real_last_date) / _invoiced_days(
theoretical_next_date, theoretical_last_date
)
3 changes: 3 additions & 0 deletions contract_variable_qty_prorated/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
2 changes: 2 additions & 0 deletions contract_variable_qty_prorated/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Souheil Bejaoui \<<souheil.bejaoui@acsone.eu>\>
- Thomas Binsfeld \<<thomas.binsfeld@acsone.eu>\>
2 changes: 2 additions & 0 deletions contract_variable_qty_prorated/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module adds a formula to compute prorated quantity to invoice as
extension of the module contract_variable_quantity.
2 changes: 2 additions & 0 deletions contract_variable_qty_prorated/readme/ROADMAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
If this module is installed with product_contract, the quantity field of
sale order lines won't be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading