Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
196 commits
Select commit Hold shift + click to select a range
918d2c6
[ADD] product_contract: Create module
Jan 12, 2017
c64c0ac
[FIX] product_contract: Fix mock usage in tests
lasley May 26, 2017
dd84dce
[FIX] contract_sale_generation: it doesn't create sales (#141)
flotho Apr 1, 2018
0bc5c73
[MIG] - Product Contract Migration to 12.0
sbejaoui Oct 31, 2018
4e815cb
[IMP] - Product with is_contract can be only of type service
sbejaoui Oct 31, 2018
1ad3de1
[IMP] - Change dependencies to contract_sale
sbejaoui Oct 31, 2018
2f1f674
[IMP] - Add recurrence fields to product template and sale order line
sbejaoui Oct 31, 2018
8c826fb
[IMP] - Create contract on sale order confirmation
sbejaoui Nov 2, 2018
801d96e
[IMP] - Link contract line to sale order line
sbejaoui Nov 2, 2018
a47a634
[FIX] - Remove recurring_next_date from sale order line
sbejaoui Nov 2, 2018
f1d9b28
[IMP] - Contract product are ignored on invoicing process
sbejaoui Nov 5, 2018
5b45e90
[FIX] - Default value for date_start applied on product change
sbejaoui Nov 5, 2018
830dfff
[ADD] - Add readme directory
sbejaoui Nov 5, 2018
e8b7ad0
[IMP] - Onchange contract product on contract contract and contract t…
sbejaoui Nov 5, 2018
d892adc
[FIX] - Change website to OCA repository url and prefix module name w…
sbejaoui Nov 5, 2018
0d60645
[FIX] - Compute recurring_next_date before create contract line
sbejaoui Nov 5, 2018
11a4b62
[IMP] - Upsell/Downsell contract from sale order
sbejaoui Nov 15, 2018
afa5963
[ADD] - Add renewal process with termination notice
sbejaoui Nov 19, 2018
f4297a7
[IMP] - compute date end onchange date start for auto-renew sale orde…
sbejaoui Nov 19, 2018
3a22224
[IMP] - link contract line and its successor in upsel case
sbejaoui Nov 26, 2018
8b2cbf7
[FIX] - on upsel, contract line should stop day - 1
sbejaoui Nov 28, 2018
b2295bf
[FIX] - fix onchange
sbejaoui Nov 29, 2018
ebfeda1
[IMP] - hide recurring_invoicing_type if recurring_rule_type is month…
sbejaoui Nov 29, 2018
aae410e
[FIX] - include date_end in the period if the product is_autorenew
sbejaoui Nov 30, 2018
941a072
[IMP] - _prepare_contract_value for sale order confirm
sbejaoui Dec 3, 2018
5e1688d
[REM] - Remove unused method
sbejaoui Dec 4, 2018
e322338
[IMP] - get contract user from sale order user
sbejaoui Dec 13, 2018
a98d1f4
[IMP] - show related sale orders in contract form
sbejaoui Dec 14, 2018
d6215e0
[REF] Contract Product: invoice in prepare_invoice_line is optional
ThomasBinsfeld Dec 18, 2018
e2bf0fd
[FIX] - fix flake8
sbejaoui Dec 20, 2018
36638eb
[ADD] Product Contract: payment term
ThomasBinsfeld Dec 21, 2018
8828788
[IMP] - update invoice_line vals only if it is not null
sbejaoui Dec 28, 2018
a8b5e46
[FIX] - fix unit tests
sbejaoui Jan 3, 2019
26db0d3
[IMP] - Add unit test
sbejaoui Jan 10, 2019
8789fc1
[REF] - predecessor_contract_line set in create process
sbejaoui Jan 15, 2019
79ca8a9
[IMP] - Simplify sale order line creation for contract product
sbejaoui Jan 21, 2019
98d1c8a
[ADD] Contract Sale: fiscal position
ThomasBinsfeld Jan 23, 2019
10a91be
[IMP] - auto_renew_rule deducted from recurring_rule_type and product…
sbejaoui Jan 24, 2019
68080c3
[FIX] Product Contract: copy invoicing partner to created contract
ThomasBinsfeld Jan 29, 2019
e79386a
[FIX] - Fix recurring_next_date
sbejaoui Jan 29, 2019
b03fc1e
[FIX] - date_end required only for contract product
sbejaoui Jan 29, 2019
24e9783
[FIX] - Get auto_renew_rule_type based on recurring_rule_type
sbejaoui Feb 1, 2019
5f2097c
[IMP] - cancel contract line if the downsell/upsell comes before
sbejaoui Feb 4, 2019
b8c9d7e
[FIX] - date_end computed only for contract products
sbejaoui Feb 6, 2019
763c7a8
[REF] Contract: set order count to 0 if no access to orders
ThomasBinsfeld Feb 13, 2019
bc149b0
[IMP] - permit contract selection without contract_template_id
sbejaoui Feb 28, 2019
91dc63d
[ADD] Add start_date to contract_line display_name
qgroulard Sep 2, 2019
355ec10
[12.0][IMP] - option to decide if we automaticallt create contract a …
sbejaoui Sep 5, 2019
4e8a841
[FIX] - fix display name compute dependecy
sbejaoui Sep 5, 2019
d14745c
[12.0][FIX] - create contract only on sale and done states
sbejaoui Sep 11, 2019
043857d
[12.0][REF] - Split analytic accouts and contracts
sbejaoui Sep 17, 2019
04cedf2
[12.0][IMP] - Improve unit tests
sbejaoui Sep 30, 2019
5433658
[IMP] - improve is contract visibility in product view
sbejaoui Sep 30, 2019
c60ec78
[12.0][IMP] - sale line linked to contracts must not be invoiced from…
sbejaoui Oct 1, 2019
91a1ca2
[UPD] README.rst
OCA-git-bot Oct 1, 2019
6598fcc
[ADD] icon.png
OCA-git-bot Oct 1, 2019
ded7618
[FIX] - Remove deprecated field
sbejaoui Oct 1, 2019
28b68dd
[UPD] Update product_contract.pot
oca-travis Oct 1, 2019
3fcbbd0
Update translation files
oca-transbot Oct 1, 2019
2a73df9
product_contract 12.0.2.0.1
OCA-git-bot Oct 2, 2019
c0331a4
Translated using Weblate (German)
marylla Oct 9, 2019
7e812ff
Translated using Weblate (Portuguese (Brazil))
britoederr Oct 10, 2019
dea7614
Translated using Weblate (German)
rschnapka Oct 29, 2019
47b3050
[12.0][FIX] - contract company must be the same as the sale order
sbejaoui Oct 28, 2019
b615a61
product_contract 12.0.2.0.2
OCA-git-bot Oct 30, 2019
94d694f
[12.0][FIX] - Run onchange contract_type when changing the contract t…
sbejaoui Nov 26, 2019
afb32b7
Translated using Weblate (Croatian)
badbole Dec 2, 2019
c4a29cd
Translated using Weblate (French)
Martronic-SA Dec 6, 2019
2797ab6
[IMP] contract: support pre-paid for monthlylastday
sbidoul Dec 8, 2019
986813d
[IMP] - Set recurring_invoicing_type for existing products set to mon…
sbejaoui Dec 9, 2019
5b3aa12
product_contract 12.0.3.0.0
OCA-git-bot Dec 12, 2019
5614768
[12.0][FIX] - Set contract line analytic account at contract creation…
sbejaoui Dec 30, 2019
d8285c7
[UPD] Update product_contract.pot
oca-travis Jan 7, 2020
400cba0
product_contract 12.0.3.0.1
OCA-git-bot Jan 7, 2020
484ffd5
Update translation files
oca-transbot Jan 7, 2020
e764239
Translated using Weblate (Spanish)
Jan 17, 2020
dd2f595
product_contract 12.0.3.1.0
OCA-git-bot Jan 17, 2020
3d06cb0
[IMP] contract: remove redundant method
pedrobaeza Jan 8, 2020
45cfc53
product_contract 12.0.3.1.1
OCA-git-bot Jan 30, 2020
da7df03
Translated using Weblate (Italian)
Feb 4, 2020
366af01
Translated using Weblate (Spanish)
Feb 4, 2020
dee66d9
[FIX]contract_count == len(active contracts)
Feb 5, 2020
ceb24c6
Translated using Weblate (Portuguese (Brazil))
marcelsavegnago Feb 12, 2020
51da24c
Translated using Weblate (Portuguese)
pedrocs-exo Feb 17, 2020
7f5380b
Translated using Weblate (Portuguese)
pedrocs-exo Feb 17, 2020
cd80296
Translated using Weblate (Portuguese)
alvarorib Feb 18, 2020
00415f8
[12.0][ADD] - add auto_renew_interval, auto_renew_rule_type fields to…
sbejaoui Feb 17, 2020
3ae1a73
[IMP] - Improve UX, open contract form if the sale order is related t…
sbejaoui Feb 25, 2020
53e22ce
product_contract 12.0.3.1.2
OCA-git-bot Mar 8, 2020
c32b2c9
[FIX] product_contract: set 'Contract template' field company depend
Feb 11, 2020
567460b
[FIX] contract_sale_mandate: use property_contract_template_id
Feb 26, 2020
cecc8ef
[UPD] Update product_contract.pot
oca-travis Mar 9, 2020
652075a
[UPD] README.rst
OCA-git-bot Mar 9, 2020
3d16677
Update translation files
oca-transbot Mar 9, 2020
0808196
[UPD] Update product_contract.pot
oca-travis Mar 9, 2020
30a534e
Update translation files
oca-transbot Mar 9, 2020
c184f11
[IMP] - can't upsell or downsell a resiliated contract
sbejaoui Jan 30, 2020
cfff4b6
[IMP] - use terminate term instead of resiliate
sbejaoui Mar 10, 2020
6c6e06d
[UPD] Update product_contract.pot
oca-travis Mar 11, 2020
2dcea0d
product_contract 12.0.5.0.0
OCA-git-bot Mar 11, 2020
5b376d6
Update translation files
oca-transbot Mar 11, 2020
6e219d1
[UPD] Update product_contract.pot
oca-travis Mar 11, 2020
d28e3a3
Update translation files
oca-transbot Mar 11, 2020
7df20c1
[12.0][IMP] - Add failing test for creating contract grouped by contr…
sbejaoui Mar 17, 2020
d88ac32
[12.0][FIX] - fix contract creation group by contract template
sbejaoui Mar 17, 2020
0f8bc3c
Translated using Weblate (French)
svalaeys Mar 17, 2020
169f13c
[UPD] Update product_contract.pot
oca-travis Mar 17, 2020
c332b73
product_contract 12.0.5.0.1
OCA-git-bot Mar 17, 2020
9cc61fd
Update translation files
oca-transbot Mar 17, 2020
348ce36
[UPD] Update product_contract.pot
oca-travis Mar 17, 2020
36deaaf
Update translation files
oca-transbot Mar 17, 2020
b31d14f
product_contract 12.0.5.0.2
OCA-git-bot Mar 18, 2020
22c4764
[FIX] migration from 11.0
sergiocorato Mar 24, 2020
e774d71
Translated using Weblate (Spanish)
Mar 25, 2020
2f6c235
[UPD] README.rst
OCA-git-bot Mar 25, 2020
2cc67b2
[UPD] README.rst
OCA-git-bot Mar 25, 2020
bf112a8
product_contract 12.0.5.0.3
OCA-git-bot Mar 30, 2020
a21a42e
[UPD] Update product_contract.pot
oca-travis Apr 6, 2020
3522871
product_contract 12.0.5.0.4
OCA-git-bot Apr 6, 2020
d557485
Update translation files
oca-transbot Apr 6, 2020
ac1490c
[UPD] Update product_contract.pot
oca-travis Apr 6, 2020
5f4b407
Update translation files
oca-transbot Apr 6, 2020
6adfe9f
Translated using Weblate (Portuguese (Brazil))
eduaparicio May 13, 2020
ad558dd
[IMP] - Contract: add new recurring_rule_type quarterly and semesterly
sbejaoui Apr 14, 2020
b93897b
[UPD] Update product_contract.pot
oca-travis May 18, 2020
f076eb1
product_contract 12.0.5.1.0
OCA-git-bot May 18, 2020
ea90f47
Update translation files
oca-transbot May 18, 2020
1c09744
[UPD] Update product_contract.pot
oca-travis May 18, 2020
0003da2
Update translation files
oca-transbot May 18, 2020
eab9beb
Translated using Weblate (Portuguese (Brazil))
fcolus Jun 16, 2020
232f3d9
Translated using Weblate (Spanish)
pedrobaeza Jun 17, 2020
0cbd7b1
Translated using Weblate (Portuguese (Brazil))
fcolus Jun 17, 2020
ea71650
Translated using Weblate (Portuguese (Brazil))
fcolus Aug 10, 2020
ab619fd
Update translation files
oca-transbot Aug 16, 2020
a5f833a
Translated using Weblate (French)
gregory-moka Aug 17, 2020
2970d8d
[13.0][MIG] - migration product_contract
sbejaoui Oct 24, 2020
c3f7b62
[IMP] product_contract: black, isort, prettier
mourad-ehm Nov 12, 2021
545f4e1
[MIG] product_contract: Migration to 14.0
mourad-ehm Mar 9, 2021
e11c39f
[IMP] product_contract: use _compute_display_name. Moved it to contra…
ilyasProgrammer Mar 21, 2023
26e048b
[IMP] product_contract: code improvements
ilyasProgrammer Mar 22, 2023
d3d0564
[UPD] Update product_contract.pot
Apr 12, 2023
bccf29e
[UPD] README.rst
OCA-git-bot Apr 12, 2023
d47d16b
product_contract 14.0.1.0.1
OCA-git-bot Apr 12, 2023
a3d0410
Translated using Weblate (Italian)
francesco-ooops Apr 13, 2023
9e1c2b0
Translated using Weblate (Italian)
mymage Apr 18, 2023
649645a
Translated using Weblate (Italian)
francesco-ooops Apr 18, 2023
cd1fe33
[IMP] product_contract: pre-commit stuff
Rad0van Apr 29, 2023
1de3566
[MIG] product_contract: Migration to 16.0
Rad0van Jun 8, 2023
9a804ac
analytic_distribution
Rad0van Feb 10, 2024
58b773d
analytic_account_id
Rad0van Feb 10, 2024
b516c1a
[IMP] product_contract: pre-commit auto fixes
jaenbox May 7, 2024
26b64c8
[MIG] product_contract: Migration to 17.0
jaenbox May 7, 2024
9c041fe
[IMP] product_contract: contract quantity same quantity of order
jaenbox May 8, 2024
bec3337
[UPD] Update product_contract.pot
Jun 4, 2024
e8d2a35
[BOT] post-merge updates
OCA-git-bot Jun 4, 2024
b1bcf01
Update translation files
weblate Jun 4, 2024
c8b4534
Translated using Weblate (Italian)
mymage Jun 5, 2024
d19d475
Translated using Weblate (Italian)
mymage Aug 1, 2024
4250797
[IMP] product_contract: Add contract configurator instead of making t…
CarlosRoca13 Aug 26, 2024
fc64653
Translated using Weblate (Italian)
mymage Aug 29, 2024
3710c65
[IMP] product_contract: Add posibility to compute date_start of line …
CarlosRoca13 Aug 29, 2024
7ba62d8
[UPD] Update product_contract.pot
Sep 2, 2024
b9bb281
[BOT] post-merge updates
OCA-git-bot Sep 2, 2024
f843686
Update translation files
weblate Sep 2, 2024
ad51df5
Translated using Weblate (Italian)
mymage Sep 3, 2024
34141c2
[18.0][MIG] product_contract
sbejaoui Nov 4, 2024
eb5e5a3
[IMP] product_contract: add contract duraction to contract product se…
sbejaoui Nov 15, 2024
4e331b9
[IMP][REF] product_contract: rename product contract default_qty fiel…
sbejaoui Apr 21, 2025
298f41c
[IMP] product_contract: clean UI & improve UX
sbejaoui Apr 21, 2025
b3537d2
[REF] product_contract: refactor ProductContractConfigurator for bett…
sbejaoui Apr 21, 2025
465d145
[UPD] Update product_contract.pot
Jun 4, 2025
bcfe72b
[BOT] post-merge updates
OCA-git-bot Jun 4, 2025
7820f30
[IMP] contract and product_contract: pre-commit auto fixes
Anxo82 Jun 16, 2025
e5d5f77
[BOT] post-merge updates
OCA-git-bot Jun 30, 2025
fc4f362
Translated using Weblate (Italian)
mymage Jul 1, 2025
af3c350
[18.0][FIX] product_contract: add missing fields to JS
tobiaszehntner Jul 3, 2025
97f3214
[BOT] post-merge updates
OCA-git-bot Jul 4, 2025
56f36a7
Translated using Weblate (Turkish)
bo-eska Jul 11, 2025
da1e548
[IMP] product_contract - non contract sale order lines should not hav…
baimont Jul 18, 2025
42085c6
Added translation using Weblate (Swedish)
jakobkrabbe Aug 5, 2025
fbcb3ee
Translated using Weblate (Swedish)
jakobkrabbe Aug 5, 2025
b99fa7f
[FIX] product_contract: divide contract configuration button
bo-eska Aug 14, 2025
82b8c08
[IMP] product_contract:seperate function for line name formatting
bjouini-acsone Aug 13, 2025
6389c58
[UPD] Update product_contract.pot
Aug 18, 2025
cd155ed
[BOT] post-merge updates
OCA-git-bot Aug 18, 2025
bda7d73
Update translation files
weblate Aug 18, 2025
2206cee
[UPD] Update product_contract.pot
Aug 18, 2025
52ce8bc
[BOT] post-merge updates
OCA-git-bot Aug 18, 2025
c50b937
Update translation files
weblate Aug 18, 2025
64c58aa
Translated using Weblate (Italian)
mymage Aug 20, 2025
b9e7bff
[FIX] product_contract: set contract_type for contracts created from …
sbejaoui Sep 23, 2025
1797f90
[BOT] post-merge updates
OCA-git-bot Sep 23, 2025
6c157ac
Translated using Weblate (Turkish)
bo-eska Sep 24, 2025
2649f96
[OU-ADD] product_contract: Migration scripts
victoralmau Oct 27, 2025
20ab136
[IMP] product_contract: pre-commit stuff
Wodran14 Nov 4, 2025
e12050d
[MIG] product_contract: Migration to 19.0
Wodran14 Nov 4, 2025
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
180 changes: 180 additions & 0 deletions contract/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

================================
Recurring - Contracts Management
================================

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

.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Production/Stable
.. |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
: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
: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 enables contracts management with recurring invoicing
functions. Also you can print and send by email contract report.

It works for customer contract and supplier contracts.

Contracts are shown in portal.

**Table of contents**

.. contents::
:local:

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

To view discount field in contract line, you need to set *Discount on
lines* in user access rights.

Contracts can be viewed on the portal (list and detail) if the user
logged into the portal is a follower of the contract.

Usage
=====

1. Contracts are in Invoicing -> Customers -> Customer and Invoicing ->
Vendors -> Supplier Contracts
2. When creating a contract, fill fields for selecting the invoicing
parameters:

- a journal
- a price list (optional)

3. And add the lines to be invoiced with:

- the product with a description, a quantity and a price
- the recurrence parameters: interval (days, weeks, months, months
last day or years), start date, date of next invoice
(automatically computed, can be modified) and end date (optional)
- auto-price, for having a price automatically obtained from the
price list
- #START# - #END# or #INVOICEMONTHNAME# in the description field to
display the start/end date or the start month of the invoiced
period in the invoice line description
- pre-paid (invoice at period start) or post-paid (invoice at start
of next period)

4. The "Generate Recurring Invoices from Contracts" cron runs daily to
generate the invoices. If you are in debug mode, you can click on the
invoice creation button.
5. The *Show recurring invoices* shortcut on contracts shows all
invoices created from the contract.
6. The contract report can be printed from the Print menu
7. The contract can be sent by email with the *Send by Email* button
8. Contract templates can be created from the Configuration -> Contracts
-> Contract Templates menu. They allow to define default journal,
price list and lines when creating a contract. To use it, just select
the template on the contract and fields will be filled automatically.

- Contracts appear in portal to following users in every contract:

|image|

|image1|

|image2|

.. |image| image:: https://raw.githubusercontent.com/OCA/contract/19.0/contract/static/src/screenshots/portal-my.png
.. |image1| image:: https://raw.githubusercontent.com/OCA/contract/19.0/contract/static/src/screenshots/portal-list.png
.. |image2| image:: https://raw.githubusercontent.com/OCA/contract/19.0/contract/static/src/screenshots/portal-detail.png

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

- Recover states and others functional fields in Contracts.
- Add recurrence flag at template level.

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%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
-------

* Tecnativa
* ACSONE SA/NV

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

- Angel Moya <angel.moya@domatix.com>

- Dave Lasley <dave@laslabs.com>

- Miquel Raïch <miquel.raich@eficent.com>

- Souheil Bejaoui <souheil.bejaoui@acsone.eu>

- Thomas Binsfeld <thomas.binsfeld@acsone.eu>

- Guillaume Vandamme <guillaume.vandamme@acsone.eu>

- Raphaël Reverdy <raphael.reverdy@akretion.com>

- `Tecnativa <https://www.tecnativa.com>`__:

- Pedro M. Baeza
- Carlos Dauden
- Vicent Cubells
- Rafael Blasco
- Víctor Martínez

- Iván Antón <ozono@ozonomultimedia.com>

- `APSL <https://www.apsl.tech>`__:

- Antoni Marroig <amarroig@apsl.net>

- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`__

- Bhavesh Heliconia

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.

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions contract/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import controllers
from . import models
from . import wizards
48 changes: 48 additions & 0 deletions contract/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright 2004-2010 OpenERP SA
# Copyright 2014-2018 Tecnativa - Pedro M. Baeza
# Copyright 2015 Domatix
# Copyright 2016-2018 Tecnativa - Carlos Dauden
# Copyright 2017 Tecnativa - Vicent Cubells
# Copyright 2016-2017 LasLabs Inc.
# Copyright 2018-2019 ACSONE SA/NV
# Copyright 2020-2021 Tecnativa - Pedro M. Baeza
# Copyright 2020 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).


{
"name": "Recurring - Contracts Management",
"version": "19.0.1.0.0",
"category": "Contract Management",
"license": "AGPL-3",
"author": "Tecnativa, ACSONE SA/NV, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/contract",
"depends": ["base", "account", "product", "portal"],
"development_status": "Production/Stable",
"data": [
"security/contract_tag.xml",
"security/ir.model.access.csv",
"security/contract_security.xml",
"report/report_contract.xml",
"report/contract_views.xml",
"data/contract_cron.xml",
"data/mail_template.xml",
"data/template_mail_notification.xml",
"data/mail_message_subtype.xml",
"data/ir_ui_menu.xml",
"views/contract_tag.xml",
"views/contract_template.xml",
"views/contract_template_line.xml",
"views/contract.xml",
"views/contract_line.xml",
"views/res_partner_view.xml",
"views/res_config_settings.xml",
"views/contract_portal_templates.xml",
"wizards/contract_manually_create_invoice.xml",
],
"assets": {
"web.assets_frontend": ["contract/static/src/scss/frontend.scss"],
"web.assets_tests": ["contract/static/src/js/contract_portal_tour.esm.js"],
},
"installable": True,
}
3 changes: 3 additions & 0 deletions contract/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import main
103 changes: 103 additions & 0 deletions contract/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Copyright 2020-2022 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import http
from odoo.exceptions import AccessError, MissingError
from odoo.http import request

from odoo.addons.portal.controllers.portal import CustomerPortal
from odoo.addons.portal.controllers.portal import pager as portal_pager


class PortalContract(CustomerPortal):
def _prepare_home_portal_values(self, counters):
values = super()._prepare_home_portal_values(counters)
if "contract_count" in counters:
contract_model = request.env["contract.contract"]
contract_count = contract_model.search_count([])
values["contract_count"] = contract_count
return values

def _contract_get_page_view_values(self, contract, access_token, **kwargs):
values = {
"page_name": "Contracts",
"contract": contract,
}
return self._get_page_view_values(
contract, access_token, values, "my_contracts_history", False, **kwargs
)

def _get_filter_domain(self, kw):
return []

@http.route(
["/my/contracts", "/my/contracts/page/<int:page>"],
type="http",
auth="user",
website=True,
)
def portal_my_contracts(
self, page=1, date_begin=None, date_end=None, sortby=None, **kw
):
values = self._prepare_portal_layout_values()
contract_obj = request.env["contract.contract"]
domain = self._get_filter_domain(kw)
searchbar_sortings = {
"date": {
"label": request.env._("Date"),
"order": "recurring_next_date desc",
},
"name": {"label": request.env._("Name"), "order": "name desc"},
"code": {"label": request.env._("Reference"), "order": "code desc"},
}
# default sort by order
if not sortby:
sortby = "date"
order = searchbar_sortings[sortby]["order"]
# count for pager
contract_count = contract_obj.search_count(domain)
# pager
pager = portal_pager(
url="/my/contracts",
url_args={
"date_begin": date_begin,
"date_end": date_end,
"sortby": sortby,
},
total=contract_count,
page=page,
step=self._items_per_page,
)
# content according to pager and archive selected
contracts = contract_obj.search(
domain, order=order, limit=self._items_per_page, offset=pager["offset"]
)
request.session["my_contracts_history"] = contracts.ids[:100]
values.update(
{
"date": date_begin,
"contracts": contracts,
"page_name": "Contracts",
"pager": pager,
"default_url": "/my/contracts",
"searchbar_sortings": searchbar_sortings,
"sortby": sortby,
}
)
return request.render("contract.portal_my_contracts", values)

@http.route(
["/my/contracts/<int:contract_contract_id>"],
type="http",
auth="public",
website=True,
)
def portal_my_contract_detail(self, contract_contract_id, access_token=None, **kw):
try:
contract_sudo = self._document_check_access(
"contract.contract", contract_contract_id, access_token
)
except (AccessError, MissingError):
return request.redirect("/my")
values = self._contract_get_page_view_values(contract_sudo, access_token, **kw)
return request.render("contract.portal_contract_page", values)
12 changes: 12 additions & 0 deletions contract/data/contract_cron.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record model="ir.cron" id="contract_cron_for_invoice">
<field name="name">Generate Recurring Invoices from Contracts</field>
<field name="model_id" ref="model_contract_contract" />
<field name="state">code</field>
<field name="code">model.cron_recurring_create_invoice()</field>
<field name="user_id" ref="base.user_root" />
<field name="interval_number">1</field>
<field name="interval_type">days</field>
</record>
</odoo>
9 changes: 9 additions & 0 deletions contract/data/ir_ui_menu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<menuitem
id="menu_config_contract"
name="Contracts"
sequence="1"
parent="account.menu_finance_configuration"
/>
</odoo>
15 changes: 15 additions & 0 deletions contract/data/mail_message_subtype.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="mail_message_subtype_invoice_created" model="mail.message.subtype">
<field name="name">Invoice created</field>
<field name="res_model">contract.contract</field>
</record>
<record
id="mail_message_subtype_contract_modification"
model="mail.message.subtype"
>
<field name="name">Contract modifications</field>
<field name="res_model">contract.contract</field>
<field name="default" eval="False" />
</record>
</odoo>
Loading
Loading