-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NEW] lcc_credit_requests_from_contracts: create add-on
- Loading branch information
Stéphan Sainléger
committed
Jan 15, 2024
1 parent
ef0b282
commit e0c4fe4
Showing
10 changed files
with
858 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.*~ | ||
*pyc |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
================================== | ||
lcc_credit_requests_from_contracts | ||
================================== | ||
|
||
Generate lcc credit requests from contracts | ||
|
||
Installation | ||
============ | ||
|
||
Use Odoo normal module installation procedure to install | ||
``lcc_credit_requests_from_contracts``. | ||
|
||
Known issues / Roadmap | ||
====================== | ||
|
||
None yet. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `our issues website <https://github.com/elabore-coop/lcc_credit_requests_from_contracts/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 | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Stéphan Sainléger - `Email<mailto:stephan.sainleger@elabore.coop>` - `Github<https://github.com/stephansainleger>` | ||
|
||
Funders | ||
------- | ||
|
||
The development of this module has been financially supported by: | ||
* Elabore (https://elabore.coop) | ||
* Lokavaluto (https://lokavaluto.fr) | ||
|
||
|
||
Maintainer | ||
---------- | ||
|
||
This module is maintained by Elabore. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Copyright 2024 Elabore | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "lcc_credit_requests_from_contracts", | ||
"version": "12.0.1.0.0", | ||
"author": "Elabore", | ||
"website": "https://elabore.coop", | ||
"maintainer": "Stéphan Sainléger", | ||
"license": "AGPL-3", | ||
"category": "Tools", | ||
"summary": "Generate lcc credit requests from contracts", | ||
# any module necessary for this one to work correctly | ||
"depends": [ | ||
"base", | ||
"contract", | ||
"lcc_lokavaluto_app_connection", | ||
], | ||
"qweb": [], | ||
"external_dependencies": { | ||
"python": [], | ||
}, | ||
# always loaded | ||
"data": [ | ||
"views/contract.xml", | ||
], | ||
# only loaded in demonstration mode | ||
"demo": [], | ||
"js": [], | ||
"css": [], | ||
"installable": True, | ||
# Install this module automatically if all dependency have been previously | ||
# and independently installed. Used for synergetic or glue modules. | ||
"auto_install": False, | ||
"application": False, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * lcc_credit_requests_from_contracts | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 12.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-01-15 12:29+0000\n" | ||
"PO-Revision-Date: 2024-01-15 12:29+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: lcc_credit_requests_from_contracts | ||
#: model:ir.model,name:lcc_credit_requests_from_contracts.model_contract_contract | ||
msgid "Contract" | ||
msgstr "Contrat" | ||
|
||
#. module: lcc_credit_requests_from_contracts | ||
#: model:ir.model.fields,field_description:lcc_credit_requests_from_contracts.field_contract_contract__create_credit_requests | ||
msgid "Create Credit Requests" | ||
msgstr "Créer des demandes de chargement" | ||
|
||
#. module: lcc_credit_requests_from_contracts | ||
#: model:ir.model.fields,field_description:lcc_credit_requests_from_contracts.field_contract_contract__wallet_id | ||
msgid "Wallet to credit" | ||
msgstr "Portefeuille" | ||
|
32 changes: 32 additions & 0 deletions
32
lcc_credit_requests_from_contracts/i18n/lcc_credit_requests_from_contracts.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * lcc_credit_requests_from_contracts | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 12.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-01-15 12:29+0000\n" | ||
"PO-Revision-Date: 2024-01-15 12:29+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: lcc_credit_requests_from_contracts | ||
#: model:ir.model,name:lcc_credit_requests_from_contracts.model_contract_contract | ||
msgid "Contract" | ||
msgstr "" | ||
|
||
#. module: lcc_credit_requests_from_contracts | ||
#: model:ir.model.fields,field_description:lcc_credit_requests_from_contracts.field_contract_contract__create_credit_requests | ||
msgid "Create Credit Requests" | ||
msgstr "" | ||
|
||
#. module: lcc_credit_requests_from_contracts | ||
#: model:ir.model.fields,field_description:lcc_credit_requests_from_contracts.field_contract_contract__wallet_id | ||
msgid "Wallet to credit" | ||
msgstr "" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import contract |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from odoo import fields, models | ||
|
||
|
||
class ContractContract(models.Model): | ||
_inherit = 'contract.contract' | ||
|
||
create_credit_requests = fields.Boolean('Create Credit Requests') | ||
wallet_id = fields.Many2one('res.partner.backend', string='Wallet to credit') | ||
|
||
def _prepare_credit_request_values(self, invoice): | ||
values = { | ||
"amount" : invoice.amount_total, | ||
"partner_id": invoice.partner_id.id, | ||
"wallet_id": self.wallet_id.id, | ||
"invoice_id": invoice.id, | ||
"create_order": False | ||
} | ||
return values | ||
|
||
def _recurring_create_invoice(self, date_ref=False): | ||
invoices = super()._recurring_create_invoice(date_ref) | ||
if not (self.create_credit_requests and self.wallet_id): | ||
return invoices | ||
for invoice in invoices: | ||
if invoice.has_numeric_lcc_products: | ||
values = self._prepare_credit_request_values(invoice) | ||
self.env["credit.request"].create(values) | ||
return invoices |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<odoo> | ||
<data> | ||
<record id="contract_contract_form_view_inherit_credit_request" model="ir.ui.view"> | ||
<field name="name">contract.view.form.inherit.credit.request</field> | ||
<field name="model">contract.contract</field> | ||
<field name="inherit_id" ref="contract.contract_contract_form_view" /> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//group[@name='recurring_invoices']" position="inside"> | ||
<group name="credit_requests"> | ||
<field name="partner_id" invisible="1" /> | ||
<field name="create_credit_requests" /> | ||
<field name="wallet_id" domain="[('partner_id','=', partner_id)]" | ||
attrs="{'invisible': [('create_credit_requests','=',False)]}" /> | ||
</group> | ||
</xpath> | ||
</field> | ||
</record> | ||
</data> | ||
</odoo> |