Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][MIG] account_invoice_report_due_list: Migration to 16.0 #301

Merged
Merged
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
5927047
[ADD] account_invoice_report_due_list: New module
carlosdauden Mar 16, 2018
e6312c9
[IMP] account_invoice_report_due_list: Add tests
cubells Dec 3, 2018
b3a8f39
[UPD] Update account_invoice_report_due_list.pot
oca-travis Dec 10, 2018
1e99c97
[FIX] account_invoice_report_due_list: Limit invoice views
pedrobaeza Jan 4, 2019
9cce2c9
[MIG] account_invoice_report_due_list: migration to 12.0
cubells Feb 18, 2019
edb2acf
[UPD] README.rst
OCA-git-bot Mar 7, 2019
febdbf2
[UPD] Update account_invoice_report_due_list.pot
oca-travis Mar 7, 2019
6007f17
Update translation files
oca-transbot Mar 17, 2019
f6616a0
[UPD] README.rst
OCA-git-bot Jul 29, 2019
ef1e343
Added translation using Weblate (German)
marylla Jan 9, 2020
6dd063f
Translated using Weblate (German)
marylla Jan 9, 2020
17ebabb
[IMP] account_invoice_report_due_list: allways print the same way
chienandalu Jan 29, 2020
3d08adb
account_invoice_report_due_list 12.0.1.1.0
OCA-git-bot Jan 29, 2020
0720c7b
[FIX] account_invoice_report_due_list: empty table
chienandalu Feb 18, 2020
656374f
account_invoice_report_due_list 12.0.1.2.0
OCA-git-bot Feb 18, 2020
99e4f71
Added translation using Weblate (Portuguese)
pedrocs-exo Feb 29, 2020
a765980
Translated using Weblate (Portuguese)
pedrocs-exo Feb 29, 2020
03309a9
Added translation using Weblate (Croatian)
badbole Mar 5, 2020
a0a4e21
Translated using Weblate (Croatian)
badbole Mar 5, 2020
bd11a8e
[FIX] account_invoice_report_due_list: avoid breaking due list block
chienandalu Apr 21, 2020
0376d90
account_invoice_report_due_list 12.0.1.3.0
OCA-git-bot Apr 21, 2020
5bf083b
[FIX] account_invoice_report_due_list: Report date format
Tardo Dec 14, 2020
9de2b96
account_invoice_report_due_list 12.0.1.4.0
OCA-git-bot Dec 14, 2020
6dcf007
[IMP] account_invoice_report_due_list: black, isort, prettier
victoralmau Dec 22, 2020
9bf9dbe
[MIG] account_invoice_report_due_list: Migration to 13.0
victoralmau Dec 22, 2020
1cdfde4
[UPD] Update account_invoice_report_due_list.pot
oca-travis Jan 5, 2021
df5bb66
[UPD] README.rst
OCA-git-bot Jan 5, 2021
34319f3
[MIG] account_invoice_report_due_list: Migration to 14.0
victoralmau Feb 23, 2021
9af4627
[UPD] Update account_invoice_report_due_list.pot
oca-travis Mar 4, 2021
e004bfa
[UPD] README.rst
OCA-git-bot Mar 4, 2021
fec8eb0
[FIX] account_invoice_report_due_list: Error creating a new journal e…
carlosdauden Mar 5, 2021
4cc2926
[UPD] Update account_invoice_report_due_list.pot
oca-travis Mar 8, 2021
404a182
account_invoice_report_due_list 14.0.1.1.0
OCA-git-bot Mar 8, 2021
0175e66
Update translation files
oca-transbot Mar 8, 2021
75ac070
Added translation using Weblate (French)
Yvesldff Mar 25, 2021
3b8b5b5
Translated using Weblate (French)
Yvesldff Mar 25, 2021
88dc1d0
Added translation using Weblate (French (France))
Yvesldff Apr 10, 2021
b58b3a9
Translated using Weblate (French (France))
Yvesldff Apr 10, 2021
6eb73ad
Added translation using Weblate (Italian)
primes2h Jul 27, 2021
45922d3
Translated using Weblate (Italian)
primes2h Jul 27, 2021
4f78433
Translated using Weblate (Italian)
francesco-ooops Jan 26, 2022
34d71ef
[FIX] account_invoice_report_due_list: refund invoices header
chienandalu Jul 16, 2021
46bc47c
account_invoice_report_due_list 14.0.1.2.0
OCA-git-bot Feb 8, 2022
5d2c554
Translated using Weblate (German)
marylla May 11, 2022
45d37e2
[MIG] account_invoice_report_due_list: Migration to 15.0
Aug 2, 2022
98473c4
[UPD] Update account_invoice_report_due_list.pot
Aug 5, 2022
5add645
[UPD] README.rst
OCA-git-bot Aug 5, 2022
c0aeb81
[IMP] account_invoice_report_due_list: added outstanding amounts
dalonsod Sep 10, 2022
f0d7e0e
[UPD] Update account_invoice_report_due_list.pot
Sep 22, 2022
8d32341
[UPD] README.rst
OCA-git-bot Sep 22, 2022
af62eea
account_invoice_report_due_list 15.0.2.0.0
OCA-git-bot Sep 22, 2022
9206029
Update translation files
oca-transbot Sep 22, 2022
a9c81a5
Translated using Weblate (Spanish)
dalonsod Sep 23, 2022
e21b881
[FIX] account_invoice_report_due_list: Change SavepointCase to Transa…
victoralmau Nov 15, 2022
8640767
account_invoice_report_due_list 15.0.2.0.1
OCA-git-bot Nov 15, 2022
70aabdf
Added translation using Weblate (Catalan (ca_ES))
jabelchi Jan 17, 2023
f5c0ea3
[IMP] account_invoice_report_due_list: pre-commit stuff
dsolanki-initos Jul 7, 2023
f285e62
[MIG] account_invoice_report_due_list: Migration to 16.0
dsolanki-initos Jul 7, 2023
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
Prev Previous commit
Next Next commit
[MIG] account_invoice_report_due_list: Migration to 13.0
victoralmau authored and dsolanki-initos committed Jul 7, 2023
commit 9bf9dbefb214c05296df59b39cfe993e23999af8
9 changes: 5 additions & 4 deletions account_invoice_report_due_list/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Copyright 2018 Carlos Dauden - Tecnativa <carlos.dauden@tecnativa.com>
# Copyright 2018 Tecnativa - Carlos Dauden
# Copyright 2020 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Account Invoice Report Due List",
"summary": "Show multiple due data in invoice",
"version": "12.0.1.4.0",
"version": "13.0.1.0.0",
"category": "Accounting",
"website": "https://github.com/OCA/account-invoice-reporting",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"depends": ["account",],
"data": ["views/account_invoice_view.xml", "views/report_invoice.xml",],
"depends": ["account"],
"data": ["views/account_invoice_view.xml", "views/report_invoice.xml"],
}
2 changes: 1 addition & 1 deletion account_invoice_report_due_list/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from . import account_invoice
from . import account_move
52 changes: 0 additions & 52 deletions account_invoice_report_due_list/models/account_invoice.py

This file was deleted.

46 changes: 46 additions & 0 deletions account_invoice_report_due_list/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright 2018 Tecnativa - Carlos Dauden
# Copyright 2020 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class AccountMove(models.Model):
_inherit = "account.move"

multi_due = fields.Boolean(string="Multiple date due", compute="_compute_multi_due")
multi_date_due = fields.Char(string="Due Dates", compute="_compute_multi_date_due")

@api.depends("invoice_payment_term_id")
def _compute_multi_due(self):
for record in self:
record.multi_due = len(record.invoice_payment_term_id.line_ids) > 1

def _compute_multi_date_due(self):
lang = self.env.context.get("lang") or "en_US"
date_format = self.env["res.lang"]._lang_get(lang).date_format
for record in self:
record.multi_date_due = " ".join(
fields.Date.from_string(due[0]).strftime(date_format)
for due in record.get_multi_due_list()
)

def get_multi_due_list(self):
self.ensure_one()
due_list = []
if self.type in ["in_invoice", "out_refund"]:
due_move_line_ids = self.line_ids.filtered(
lambda ml: ml.account_id.internal_type == "payable"
)
else:
due_move_line_ids = self.line_ids.filtered(
lambda ml: ml.account_id.internal_type == "receivable"
)
if self.currency_id != self.company_id.currency_id:
due_list = [
(ml.date_maturity, ml.amount_currency) for ml in due_move_line_ids
]
else:
due_list = [(ml.date_maturity, ml.balance) for ml in due_move_line_ids]
due_list.sort()
return due_list
5 changes: 3 additions & 2 deletions account_invoice_report_due_list/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
* `Tecnativa <https://www.tecnativa.com>`_:

* Carlos Dauden <carlos.dauden@tecnativa.com>
* Vicent Cubells <vicent.cubells@tecnativa.com>
* Carlos Dauden
* Vicent Cubells
* Víctor Martínez
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2018 Tecnativa - Vicent Cubells <vicent.cubells@tecnativa.com>
# Copyright 2018 Tecnativa - Vicent Cubells
# Copyright 2020 Tecnativa - Víctor Martínez
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from datetime import timedelta
@@ -7,18 +8,21 @@

from odoo import fields
from odoo.tests import common
from odoo.tests.common import Form
from odoo.tools import posix_to_ldml, pycompat


class TestInvoiceReportDueList(common.SavepointCase):
@classmethod
def setUpClass(cls):
super(TestInvoiceReportDueList, cls).setUpClass()

super().setUpClass()
cls.account_tax = cls.env["account.tax"].create(
{"name": "0%", "amount_type": "fixed", "type_tax_use": "sale", "amount": 0}
)
cls.payment_term_normal = cls.env["account.payment.term"].create(
{
"name": "One Time Payment Term",
"line_ids": [(0, 0, {"value": "balance", "days": 30,})],
"line_ids": [(0, 0, {"value": "balance", "days": 30})],
}
)
cls.payment_term_multi = cls.env["account.payment.term"].create(
@@ -35,12 +39,14 @@ def setUpClass(cls):
"sequence": 10,
},
),
(0, 0, {"value": "balance", "days": 60, "sequence": 20,}),
(0, 0, {"value": "balance", "days": 60, "sequence": 20}),
],
}
)
cls.partner = cls.env["res.partner"].create({"name": "Partner test",})
cls.product_id = cls.env["product.product"].create({"name": "Product Test",})
cls.partner = cls.env["res.partner"].create({"name": "Partner test"})
cls.product_id = cls.env["product.product"].create(
{"name": "Product Test", "taxes_id": [(6, 0, [cls.account_tax.id])]}
)
cls.account = cls.env["account.account"].create(
{
"name": "Test Account",
@@ -60,31 +66,17 @@ def setUpClass(cls):
}
)

def test_due_list(self):
invoice = self.env["account.invoice"].create(
{
"partner_id": self.partner.id,
"payment_term_id": self.payment_term_normal.id,
"type": "out_invoice",
"account_id": self.account.id,
"invoice_line_ids": [
(
0,
0,
{
"product_id": self.product_id.id,
"price_unit": 100.0,
"account_id": self.other_account.id,
"name": self.product_id.name,
},
)
],
}
)
def test_due_list(self, move_type="out_invoice"):
move_form = Form(self.env["account.move"].with_context(default_type=move_type))
move_form.partner_id = self.partner
move_form.invoice_payment_term_id = self.payment_term_normal
with move_form.invoice_line_ids.new() as line_form:
line_form.product_id = self.product_id
line_form.price_unit = 100.0
invoice = move_form.save()
self.assertFalse(invoice.multi_due)
invoice.payment_term_id = self.payment_term_multi.id
invoice._onchange_payment_term_date_invoice()
invoice.action_invoice_open()
invoice.invoice_payment_term_id = self.payment_term_multi
invoice.action_post()
self.assertTrue(invoice.multi_due)
self.assertEqual(len(invoice.multi_date_due.split()), 2)
due_date = fields.date.today() + timedelta(days=60)
37 changes: 6 additions & 31 deletions account_invoice_report_due_list/views/account_invoice_view.xml
Original file line number Diff line number Diff line change
@@ -1,46 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2018 Carlos Dauden - Tecnativa <carlos.dauden@tecnativa.com>
<!-- Copyright 2018 Tecnativa - Carlos Dauden
Copyright 2018 Tecnativa - Pedro M. Baeza
Copyright 2020 Tecnativa - Víctor Martínez
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="invoice_supplier_form" model="ir.ui.view">
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_supplier_form" />
<record id="view_move_form" model="ir.ui.view">
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form" />
<field name="groups_id" eval="[(4, ref('account.group_account_invoice'))]" />
<field name="arch" type="xml">
<field name="date_due" position="before">
<field name="invoice_date_due" position="before">
<field name="multi_due" invisible="1" />
<field
name="multi_date_due"
attrs="{'invisible': [('multi_due', '=', False)]}"
/>
</field>
<field name="date_due" position="attributes">
<attribute
name="attrs"
>{'invisible': [('multi_due', '=', True)]}</attribute>
<attribute name="groups" />
</field>
</field>
</record>
<record id="invoice_form" model="ir.ui.view">
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form" />
<field name="groups_id" eval="[(4, ref('account.group_account_invoice'))]" />
<field name="arch" type="xml">
<field name="date_due" position="before">
<field name="multi_due" invisible="1" />
<field
name="multi_date_due"
attrs="{'invisible': [('multi_due', '=', False)]}"
/>
</field>
<field name="date_due" position="attributes">
<attribute
name="attrs"
>{'invisible': [('multi_due', '=', True)]}</attribute>
<attribute name="groups" />
</field>
</field>
</record>
</odoo>
10 changes: 7 additions & 3 deletions account_invoice_report_due_list/views/report_invoice.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2018 Carlos Dauden - Tecnativa <carlos.dauden@tecnativa.com>
<!-- Copyright 2018 Tecnativa - Carlos Dauden
Copyright 2020 Tecnativa - Víctor Martínez
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<template id="report_invoice_document" inherit_id="account.report_invoice_document">
<xpath expr="//p[@t-field='o.date_due']/.." position="attributes">
<xpath expr="//p[@t-field='o.invoice_date_due']/.." position="attributes">
<attribute name="t-att-class">'hidden'</attribute>
</xpath>
<xpath expr="//span[@t-field='o.payment_term_id.note']" position="after">
<xpath
expr="//span[@t-field='o.invoice_payment_term_id.note']"
position="after"
>
<t t-set="due_list" t-value="o.get_multi_due_list()" />
<div class="row" t-if="due_list" style="page-break-inside: avoid;">
<div class="col-4">