mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[MIG] account_loan: Migration to 12.0
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
{
|
||||
"name": "Account Loan management",
|
||||
"version": "11.0.1.1.1",
|
||||
"version": "12.0.1.0.0",
|
||||
"author": "Creu Blanca,Odoo Community Association (OCA)",
|
||||
"website": "http://github.com/OCA/account-financial-tools",
|
||||
"license": "AGPL-3",
|
||||
|
||||
@@ -353,7 +353,7 @@ class AccountLoan(models.Model):
|
||||
def post(self):
|
||||
self.ensure_one()
|
||||
if not self.start_date:
|
||||
self.start_date = fields.Datetime.now()
|
||||
self.start_date = fields.Date.today()
|
||||
self.compute_draft_lines()
|
||||
self.write({'state': 'posted'})
|
||||
|
||||
@@ -422,7 +422,7 @@ class AccountLoan(models.Model):
|
||||
self.line_ids.unlink()
|
||||
amount = self.loan_amount
|
||||
if self.start_date:
|
||||
date = datetime.strptime(self.start_date, DF).date()
|
||||
date = self.start_date
|
||||
else:
|
||||
date = datetime.today().date()
|
||||
delta = relativedelta(months=self.method_period)
|
||||
@@ -470,8 +470,7 @@ class AccountLoan(models.Model):
|
||||
('is_leasing', '=', False)
|
||||
]):
|
||||
lines = record.line_ids.filtered(
|
||||
lambda r: datetime.strptime(
|
||||
r.date, DF).date() <= date and not r.move_ids
|
||||
lambda r: r.date <= date and not r.move_ids
|
||||
)
|
||||
res += lines.generate_move()
|
||||
return res
|
||||
@@ -484,7 +483,6 @@ class AccountLoan(models.Model):
|
||||
('is_leasing', '=', True)
|
||||
]):
|
||||
res += record.line_ids.filtered(
|
||||
lambda r: datetime.strptime(
|
||||
r.date, DF).date() <= date and not r.invoice_ids
|
||||
lambda r: r.date <= date and not r.invoice_ids
|
||||
).generate_invoice()
|
||||
return res
|
||||
|
||||
3
account_loan/readme/CONTRIBUTORS.rst
Normal file
3
account_loan/readme/CONTRIBUTORS.rst
Normal file
@@ -0,0 +1,3 @@
|
||||
* Enric Tobella <etobella@creublanca.es>
|
||||
* Bhavesh Odedra <bodedra@opensourceintegrators.com>
|
||||
* Alberto Martín Cortada <alberto.martin@guadaltech.es>
|
||||
12
account_loan/readme/DESCRIPTION.rst
Normal file
12
account_loan/readme/DESCRIPTION.rst
Normal file
@@ -0,0 +1,12 @@
|
||||
This module extends the functionality of accounting to support loans.
|
||||
It will create automatically moves or invoices for loans.
|
||||
Moreover, you can check the pending amount to be paid and reduce the debt.
|
||||
|
||||
It currently supports two kinds of debts:
|
||||
|
||||
* Loans: a standard debt with banks, that only creates account moves.
|
||||
Loan types info:
|
||||
`APR <https://en.wikipedia.org/wiki/Annual_percentage_rate>`_,
|
||||
`EAR <https://en.wikipedia.org/wiki/Effective_interest_rate>`_,
|
||||
`Real Rate <https://en.wikipedia.org/wiki/Real_interest_rate>`_.
|
||||
* Leases: a debt with a bank where purchase invoices are necessary
|
||||
18
account_loan/readme/USAGE.rst
Normal file
18
account_loan/readme/USAGE.rst
Normal file
@@ -0,0 +1,18 @@
|
||||
To use this module, you need to:
|
||||
|
||||
#. Go to `Invoicing / Accounting > Adviser > Loans`
|
||||
#. Configure a loan selecting the company, loan type, amount, rate and accounts
|
||||
#. Post the loan, it will automatically create an account move with the
|
||||
expected amounts
|
||||
#. Create automatically the account moves / invoices related to loans and
|
||||
leases before a selected date
|
||||
|
||||
On a posted loan you can:
|
||||
|
||||
* Create moves or invoices (according to the configuration)
|
||||
* Modify rates when needed (only unposted lines will be modified)
|
||||
* Reduce or cancel the debt of a loan / lease
|
||||
|
||||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
||||
:alt: Try me on Runbot
|
||||
:target: https://runbot.odoo-community.org/runbot/92/11.0
|
||||
@@ -35,8 +35,7 @@ class AccountLoanGenerateWizard(models.TransientModel):
|
||||
return result
|
||||
|
||||
def run_loan(self):
|
||||
created_ids = self.env['account.loan'].generate_loan_entries(
|
||||
datetime.strptime(self.date, DF).date())
|
||||
created_ids = self.env['account.loan'].generate_loan_entries(self.date)
|
||||
action = self.env.ref('account.action_move_line_form')
|
||||
result = action.read()[0]
|
||||
if len(created_ids) == 0:
|
||||
|
||||
Reference in New Issue
Block a user