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] sale_invoice_plan, standard migration to 16.0 #2988

Merged
merged 64 commits into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
cd6d496
[ADD][12.0] sale_invoice_plan
kittiu Mar 8, 2019
e4f41d3
[UPD] Update sale_invoice_plan.pot
oca-travis Aug 30, 2019
c0de84e
[UPD] README.rst
OCA-git-bot Aug 30, 2019
c99f295
Added translation using Weblate (Chinese (Simplified))
liweijie0812 Sep 1, 2019
500bbed
Translated using Weblate (Chinese (Simplified))
liweijie0812 Sep 1, 2019
32adafc
[UPD] README.rst
OCA-git-bot Sep 5, 2019
460aceb
Added translation using Weblate (Dutch)
Oct 7, 2019
ce76d9a
Translated using Weblate (Dutch)
Oct 7, 2019
8e3cb35
[12.0][IMP] sale_invoice_plan improvements
kittiu Oct 16, 2019
d357990
Added translation using Weblate (French)
Martronic-SA Feb 26, 2020
447b172
Translated using Weblate (French)
Martronic-SA Feb 26, 2020
54b5244
[UPD] Update sale_invoice_plan.pot
oca-travis Mar 12, 2020
ebf163f
sale_invoice_plan 12.0.2.0.0
OCA-git-bot Mar 12, 2020
5ecb7fe
Update translation files
oca-transbot Mar 12, 2020
470f669
[IMP] : black, isort, prettier
kittiu Sep 3, 2020
a1710ec
[13.0][MIG] sale_invoice_plan
kittiu Sep 3, 2020
cd10921
[UPD] Update sale_invoice_plan.pot
oca-travis Oct 1, 2020
5c9b9a1
[UPD] README.rst
OCA-git-bot Oct 1, 2020
f13bdf4
sale_invoice_plan 13.0.1.0.1
OCA-git-bot Oct 1, 2020
1765a25
Update translation files
oca-transbot Oct 1, 2020
952a461
Added translation using Weblate (Spanish)
danimv5 Oct 26, 2020
41c617b
Translated using Weblate (Spanish)
danimv5 Oct 26, 2020
f330cfc
[FIX] sale_invoice_plan: fix development_status value in manifest
Nov 2, 2020
6a632cd
sale_invoice_plan 13.0.1.0.2
OCA-git-bot Nov 4, 2020
69c061d
Update translation files
oca-transbot Nov 22, 2020
87c9da4
[IMP] sale_invoice_plan: black, isort, prettier
Sep 6, 2021
7b8ee98
[MIG] sale_invoice_plan: Migration to 14.0
Sep 7, 2021
49d4eaa
Fix _create_invoice function signature
TDu Dec 3, 2021
172ab53
sale_invoice_plan 14.0.1.0.1
OCA-git-bot Dec 3, 2021
dfd5616
[MIG] sale_invoice_plan: Migration to 15.0
Camille0907 Jan 18, 2022
b77bc98
[FIX] sale_invoice_plan: fix _create_invoice to update due_date accor…
Camille0907 Jan 18, 2022
e6c48fc
[UPD] Update sale_invoice_plan.pot
Feb 18, 2022
f9722c5
[UPD] README.rst
OCA-git-bot Feb 18, 2022
9e799d7
add post install to the tests
JoanMForgeFlow May 9, 2022
c795f54
sale_invoice_plan 15.0.1.0.1
OCA-git-bot May 9, 2022
3d92609
[IMP] sale_invoice_plan: remove dependency
gurneyalex Apr 12, 2022
72347ad
[UPD] README.rst
OCA-git-bot May 10, 2022
239f80f
sale_invoice_plan 15.0.1.1.0
OCA-git-bot May 10, 2022
aa0a4e0
[14.0][FIX] sale_invoice_plan, force recompute dr/cr
kittiu May 17, 2022
6a3da06
sale_invoice_plan 15.0.1.1.1
OCA-git-bot May 17, 2022
8e09d10
[UPD] README.rst
OCA-git-bot Jun 2, 2022
39d2f12
[UPD] README.rst
OCA-git-bot Jun 2, 2022
0b61cb4
[FIX] sale_invoice_plan: adding fully-qualified external id
cesar-tecnativa Jun 29, 2022
f24ffda
sale_invoice_plan 15.0.1.2.0
OCA-git-bot Jun 29, 2022
ff5a21a
[IMP] sale_invoice_plan: similar improvements introduced in `purchase…
yankinmax Jun 17, 2022
05b2b7a
[IMP] sale_invoice_plan: Error on tests
CarlosRoca13 Aug 9, 2022
15b3460
[IMP] sale_invoice_plan: enable more than one invoice
marcelsavegnago Sep 5, 2022
64f8649
[UPD] Update sale_invoice_plan.pot
Sep 5, 2022
bc74c8e
sale_invoice_plan 15.0.1.3.0
OCA-git-bot Sep 5, 2022
fc9221a
[FIX] sale_invoice_plan: rounds the value to the rounding precision o…
marcelsavegnago Sep 3, 2022
3b4a25f
sale_invoice_plan 15.0.1.3.1
OCA-git-bot Sep 20, 2022
66f3cd8
sale_invoice_plan 15.0.1.3.2
OCA-git-bot Sep 29, 2022
a925f09
[FIX] sale_invoice_plan: hide create invoice button
ps-tubtim Mar 8, 2023
64da6d5
sale_invoice_plan 15.0.1.4.0
OCA-git-bot Jul 12, 2023
9da3fea
Translated using Weblate (Spanish)
Ivorra78 Jul 25, 2023
f1fd6db
[UPD] README.rst
OCA-git-bot Sep 3, 2023
069ac98
[FIX] sale_invoice_plan: recompute invoice plan table
ps-tubtim Jun 2, 2023
b2053c3
[UPD] Update sale_invoice_plan.pot
Dec 20, 2023
d96cc4b
[BOT] post-merge updates
OCA-git-bot Dec 20, 2023
2a904b7
Update translation files
weblate Dec 20, 2023
6982f83
[FIX] sale_invoice_plan: add permission menu invoice plan
Saran440 Feb 6, 2024
65ace39
[BOT] post-merge updates
OCA-git-bot Feb 11, 2024
65f797c
[IMP] sale_invoice_plan: pre-commit stuff
TheerayutEncoder Dec 6, 2024
bebe744
[MIG] sale_invoice_plan: Migration to 16.0
TheerayutEncoder Dec 6, 2024
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
10 changes: 5 additions & 5 deletions sale_invoice_plan/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Sales Invoice Plan
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/sale-workflow/tree/15.0/sale_invoice_plan
:target: https://github.com/OCA/sale-workflow/tree/16.0/sale_invoice_plan
:alt: OCA/sale-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/sale-workflow-15-0/sale-workflow-15-0-sale_invoice_plan
:target: https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sale_invoice_plan
: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/sale-workflow&target_branch=15.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -80,7 +80,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/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/sale-workflow/issues/new?body=module:%20sale_invoice_plan%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_invoice_plan%0Aversion:%2016.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.

Expand Down Expand Up @@ -126,6 +126,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-kittiu|

This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/15.0/sale_invoice_plan>`_ project on GitHub.
This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/16.0/sale_invoice_plan>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion sale_invoice_plan/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "Sales Invoice Plan",
"summary": "Add to sales order, ability to manage future invoice plan",
"version": "15.0.1.4.2",
"version": "16.0.1.0.0",
"author": "Ecosoft,Odoo Community Association (OCA)",
"license": "AGPL-3",
"website": "https://github.com/OCA/sale-workflow",
Expand Down
17 changes: 8 additions & 9 deletions sale_invoice_plan/models/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,13 @@
for rec in self:
has_invoice_plan = rec.use_invoice_plan and rec.invoice_plan_ids
to_invoice = rec.invoice_plan_ids.filtered(lambda l: not l.invoiced)
if rec.state == "sale" and has_invoice_plan and to_invoice:
if rec.invoice_status == "to invoice" or (
rec.invoice_status == "no"
and "advance" in to_invoice.mapped("invoice_type")
):
rec.invoice_plan_process = True
continue
rec.invoice_plan_process = False
inv_or_adv = rec.invoice_status == "to invoice" or (
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dreispt just FYI, I saw this part of code that you try to refactor on your code is incorrect. This might be the reason that advance is not working?
I try to refactor here too, this will remain the same logic and it works for me.

rec.invoice_status == "no"
and "advance" in to_invoice.mapped("invoice_type")
)
rec.invoice_plan_process = (
rec.state == "sale" and has_invoice_plan and to_invoice and inv_or_adv
)

@api.constrains("invoice_plan_ids")
def _check_invoice_plan_total_percent(self):
Expand All @@ -60,7 +59,7 @@
installments = rec.invoice_plan_ids.filtered("installment")
invoice_plan_total_percent = sum(installments.mapped("percent"))
if float_round(invoice_plan_total_percent, 0) > 100:
raise UserError(_("Invoice plan total percentage must not exceed 100%"))

Check warning on line 62 in sale_invoice_plan/models/sale.py

View check run for this annotation

Codecov / codecov/patch

sale_invoice_plan/models/sale.py#L62

Added line #L62 was not covered by tests

@api.constrains("state")
def _check_invoice_plan(self):
Expand Down Expand Up @@ -141,6 +140,6 @@
for move in moves:
plan._compute_new_invoice_quantity(move)
move.invoice_date = plan.plan_date
move._onchange_invoice_date()
move._compute_date()
plan.invoice_move_ids += moves
return moves
12 changes: 8 additions & 4 deletions sale_invoice_plan/models/sale_invoice_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
string="Invoices",
readonly=True,
)
amount_invoiced = fields.Float(compute="_compute_invoiced")
amount_invoiced = fields.Float(compute="_compute_invoiced", store=True)
to_invoice = fields.Boolean(
string="Next Invoice",
compute="_compute_to_invoice",
Expand All @@ -69,6 +69,7 @@
invoiced = fields.Boolean(
string="Invoice Created",
compute="_compute_invoiced",
store=True,
help="If this line already invoiced",
)
no_edit = fields.Boolean(
Expand Down Expand Up @@ -123,7 +124,7 @@
continue
rec.percent = rec.amount / rec.sale_id.amount_untaxed * 100
continue
rec.percent = 0

Check warning on line 127 in sale_invoice_plan/models/sale_invoice_plan.py

View check run for this annotation

Codecov / codecov/patch

sale_invoice_plan/models/sale_invoice_plan.py#L127

Added line #L127 was not covered by tests

def _compute_to_invoice(self):
"""If any invoice is in draft/open/paid do not allow to create inv.
Expand All @@ -133,7 +134,7 @@
rec.to_invoice = False
for rec in self.sorted("installment"):
if rec.state != "sale": # Not confirmed, no to_invoice
continue

Check warning on line 137 in sale_invoice_plan/models/sale_invoice_plan.py

View check run for this annotation

Codecov / codecov/patch

sale_invoice_plan/models/sale_invoice_plan.py#L137

Added line #L137 was not covered by tests
if not rec.invoiced:
rec.to_invoice = True
break
Expand All @@ -153,12 +154,13 @@
amount_invoiced = sum(lines.mapped("price_subtotal"))
return amount_invoiced

@api.depends("invoice_move_ids.state")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kittiu What's the impact of this on existing database in terms of upgrade performance?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really not sure about this. But I doubt that this will be relevant to update the module? Since state is not changing. Do you foresee problem?

def _compute_invoiced(self):
for rec in self:
invoiced = rec.invoice_move_ids.filtered(
lambda l: l.state in ("draft", "posted")
)
rec.invoiced = invoiced and True or False
rec.invoiced = True if invoiced else False
rec.amount_invoiced = (
sum(invoiced.mapped("amount_untaxed"))
if rec.invoice_type == "advance"
Expand All @@ -178,13 +180,15 @@
move = invoice_move.with_context(check_move_validity=False)
for line in move.invoice_line_ids:
self._update_new_quantity(line, percent)
move.line_ids.filtered("exclude_from_invoice_tab").unlink()
move._move_autocomplete_invoice_lines_values() # recompute dr/cr
move.line_ids.filtered(
lambda x: x.display_type
not in ("product", "line_section", "line_note", "payment_term", "tax")
).unlink()

def _update_new_quantity(self, line, percent):
"""Hook function"""
if not len(line.sale_line_ids) >= 0:
raise UserError(_("No matched order line for invoice line"))

Check warning on line 191 in sale_invoice_plan/models/sale_invoice_plan.py

View check run for this annotation

Codecov / codecov/patch

sale_invoice_plan/models/sale_invoice_plan.py#L191

Added line #L191 was not covered by tests
order_line = fields.first(line.sale_line_ids)
if order_line.is_downpayment: # based on 1 unit
line.write({"quantity": -percent / 100})
Expand All @@ -194,7 +198,7 @@
if plan_qty:
plan_qty = float_round(plan_qty, precision_rounding=prec)
if float_compare(abs(plan_qty), abs(line.quantity), prec) == 1:
raise ValidationError(

Check warning on line 201 in sale_invoice_plan/models/sale_invoice_plan.py

View check run for this annotation

Codecov / codecov/patch

sale_invoice_plan/models/sale_invoice_plan.py#L201

Added line #L201 was not covered by tests
_(
"Plan quantity: %(plan_qty)s, exceed invoiceable quantity: "
"%(invoiceable_qty)s"
Expand All @@ -212,8 +216,8 @@
def unlink(self):
lines = self.filtered("no_edit")
if lines:
installments = [str(x) for x in lines.mapped("installment")]
raise UserError(

Check warning on line 220 in sale_invoice_plan/models/sale_invoice_plan.py

View check run for this annotation

Codecov / codecov/patch

sale_invoice_plan/models/sale_invoice_plan.py#L219-L220

Added lines #L219 - L220 were not covered by tests
_(
"Installment %s: already used and not allowed to delete.\n"
"Please discard changes."
Expand Down
17 changes: 10 additions & 7 deletions sale_invoice_plan/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -368,7 +369,7 @@ <h1 class="title">Sales Invoice Plan</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:09c96dddef2659c83a39fc88dc4ff76d555da27304bfcf1e9ba82d7639831bb7
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Alpha" src="https://img.shields.io/badge/maturity-Alpha-red.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/sale-workflow/tree/15.0/sale_invoice_plan"><img alt="OCA/sale-workflow" src="https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/sale-workflow-15-0/sale-workflow-15-0-sale_invoice_plan"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Alpha" src="https://img.shields.io/badge/maturity-Alpha-red.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/sale-workflow/tree/16.0/sale_invoice_plan"><img alt="OCA/sale-workflow" src="https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/sale-workflow-16-0/sale-workflow-16-0-sale_invoice_plan"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>By standard feature, user can gradually create partial invoices, one by one.
This module add ability to create invoices based on the predefined invoice plan,
either all at once, or one by one.
Expand Down Expand Up @@ -435,7 +436,7 @@ <h1><a class="toc-backref" href="#toc-entry-6">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/sale-workflow/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_invoice_plan%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_invoice_plan%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand Down Expand Up @@ -467,13 +468,15 @@ <h2><a class="toc-backref" href="#toc-entry-10">Other credits</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-11">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>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.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/kittiu"><img alt="kittiu" src="https://github.com/kittiu.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/sale-workflow/tree/15.0/sale_invoice_plan">OCA/sale-workflow</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/sale-workflow/tree/16.0/sale_invoice_plan">OCA/sale-workflow</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
17 changes: 8 additions & 9 deletions sale_invoice_plan/tests/test_sale_invoice_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ def setUpClass(cls):
"mail_create_nolog": True,
}

# Create base account to simulate a chart of account
user_type_payable = cls.env.ref("account.data_account_type_payable")
# Create base account to simulate a chart of account for payable account
user_type_payable = cls.company_data["default_account_payable"]
cls.account_payable = cls.env["account.account"].create(
{
"code": "NC1110",
"name": "Test Payable Account",
"user_type_id": user_type_payable.id,
"account_type": user_type_payable.account_type,
"reconcile": True,
}
)
user_type_receivable = cls.env.ref("account.data_account_type_receivable")
# Create base account to simulate a chart of account for receivable account
cls.account_receivable = cls.env["account.account"].create(
{
"code": "NC1111",
"name": "Test Receivable Account",
"user_type_id": user_type_receivable.id,
"account_type": "asset_receivable",
"reconcile": True,
}
)
Expand Down Expand Up @@ -92,12 +92,11 @@ def setUpClass(cls):
@classmethod
def setUpClassicProducts(cls):
# Create an expense journal
user_type_income = cls.env.ref("account.data_account_type_direct_costs")
cls.account_income_product = cls.env["account.account"].create(
{
"code": "INCOME_PROD111",
"name": "Icome - Test Account",
"user_type_id": user_type_income.id,
"code": "4.0.0.0.0",
"name": "Income - Test Account",
"account_type": "income",
}
)
# Create category
Expand Down
28 changes: 21 additions & 7 deletions sale_invoice_plan/views/sale_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -159,34 +159,48 @@
name="sales"
domain="[('state', 'in', ('sale','done'))]"
/>
<filter
string="Not Invoiced"
name="not_invoiced"
domain="[('state', 'in', ('sale','done')), ('invoiced', '=', False)]"
/>
<filter
string="Not Invoiced &amp; Due"
name="over_plan_date"
domain="[
('state', 'in', ('sale','done')),
('invoiced', '=', False),
('plan_date', '&lt;=', context_today().strftime('%Y-%m-%d'))
]"
/>
<group expand="0" string="Group By">
<filter
string="Customer"
name="customer"
name="groupby_customer"
domain="[]"
context="{'group_by':'partner_id'}"
/>
<filter
string="Sales Order"
name="sale"
name="groupby_sale"
domain="[]"
context="{'group_by':'sale_id'}"
/>
<filter
string="Analytic Account"
name="analytic_account_id"
name="groupby_analytic_account_id"
domain="[]"
context="{'group_by':'analytic_account_id'}"
/>
<filter
string="Installment"
name="install"
name="groupby_install"
domain="[]"
context="{'group_by':'installment'}"
/>
<filter
string="Status"
name="state"
name="groupby_state"
domain="[]"
context="{'group_by':'state'}"
/>
Expand Down Expand Up @@ -222,7 +236,7 @@
<field name="search_view_id" ref="view_sale_invoice_plan_filter" />
<field
name="context"
>{'search_default_draft': 1, 'search_default_sale': 1}</field>
>{'search_default_sales': 1, 'search_default_groupby_sale': 1}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
View sales invoice plan lines
Expand All @@ -237,6 +251,6 @@
id="menu_sale_invoice_plan"
parent="sale.sale_order_menu"
groups="sales_team.group_sale_salesman"
sequence="2"
sequence="25"
/>
</odoo>
4 changes: 2 additions & 2 deletions sale_invoice_plan/wizard/sale_make_invoice_advance.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
class SaleAdvancePaymentInv(models.TransientModel):
_inherit = "sale.advance.payment.inv"

def _create_invoice(self, order, so_line, amount):
invoice = super()._create_invoice(order, so_line, amount)
def _create_invoices(self, sale_orders):
invoice = super()._create_invoices(sale_orders)
invoice_plan_id = self._context.get("invoice_plan_id")
if invoice_plan_id:
plan = self.env["sale.invoice.plan"].browse(invoice_plan_id)
Expand Down
Loading