-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Changes from 1 commit
cd6d496
e4f41d3
c0de84e
c99f295
500bbed
32adafc
460aceb
ce76d9a
8e3cb35
d357990
447b172
54b5244
ebf163f
5ecb7fe
470f669
a1710ec
cd10921
5c9b9a1
f13bdf4
1765a25
952a461
41c617b
f330cfc
6a632cd
69c061d
87c9da4
7b8ee98
49d4eaa
172ab53
dfd5616
b77bc98
e6c48fc
f9722c5
9e799d7
c795f54
3d92609
72347ad
239f80f
aa0a4e0
6a3da06
8e09d10
39d2f12
0b61cb4
f24ffda
ff5a21a
05b2b7a
15b3460
64f8649
bc74c8e
fc9221a
3b4a25f
66f3cd8
a925f09
64da6d5
9da3fea
f1fd6db
069ac98
b2053c3
d96cc4b
2a904b7
6982f83
65ace39
65f797c
bebe744
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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", | ||
|
@@ -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( | ||
|
@@ -123,7 +124,7 @@ | |
continue | ||
rec.percent = rec.amount / rec.sale_id.amount_untaxed * 100 | ||
continue | ||
rec.percent = 0 | ||
|
||
def _compute_to_invoice(self): | ||
"""If any invoice is in draft/open/paid do not allow to create inv. | ||
|
@@ -133,7 +134,7 @@ | |
rec.to_invoice = False | ||
for rec in self.sorted("installment"): | ||
if rec.state != "sale": # Not confirmed, no to_invoice | ||
continue | ||
if not rec.invoiced: | ||
rec.to_invoice = True | ||
break | ||
|
@@ -153,12 +154,13 @@ | |
amount_invoiced = sum(lines.mapped("price_subtotal")) | ||
return amount_invoiced | ||
|
||
@api.depends("invoice_move_ids.state") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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" | ||
|
@@ -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")) | ||
order_line = fields.first(line.sale_line_ids) | ||
if order_line.is_downpayment: # based on 1 unit | ||
line.write({"quantity": -percent / 100}) | ||
|
@@ -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( | ||
_( | ||
"Plan quantity: %(plan_qty)s, exceed invoiceable quantity: " | ||
"%(invoiceable_qty)s" | ||
|
@@ -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( | ||
_( | ||
"Installment %s: already used and not allowed to delete.\n" | ||
"Please discard changes." | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. | ||
|
@@ -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 } | ||
|
@@ -300,7 +301,7 @@ | |
span.pre { | ||
white-space: pre } | ||
|
||
span.problematic { | ||
span.problematic, pre.problematic { | ||
color: red } | ||
|
||
span.section-subtitle { | ||
|
@@ -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&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&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. | ||
|
@@ -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"> | ||
|
@@ -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> | ||
|
There was a problem hiding this comment.
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.