Skip to content

Commit

Permalink
[IMP]sale_line_refund_to_invoice_qty: credit note default
Browse files Browse the repository at this point in the history
add setting for default value in credit note wizard
  • Loading branch information
PicchiSeba committed Jun 27, 2024
1 parent 7ed80ad commit ff3962d
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 5 deletions.
3 changes: 3 additions & 0 deletions sale_line_refund_to_invoice_qty/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ Furthermore, after creating the credit note, you can mark the field "Sale qty
not to reinvoice" to decide the criteria to be used for each specific invoice
line.

Enabling the "Do not reinvoice credit note by default" flag in the Invoice settings, will
disable the "This credit note will be reinvoiced" flag on Credit Notes by default

Bug Tracker
===========

Expand Down
1 change: 1 addition & 0 deletions sale_line_refund_to_invoice_qty/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"depends": ["sale_management"],
"data": [
"views/account_move_views.xml",
"views/res_config_settings_views.xml",
"views/sale_order_views.xml",
"wizards/account_move_reversal_view.xml",
],
Expand Down
2 changes: 2 additions & 0 deletions sale_line_refund_to_invoice_qty/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright 2021 ForgeFlow (http://www.forgeflow.com)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from . import account
from . import res_company
from . import res_config_settings
from . import sale
9 changes: 9 additions & 0 deletions sale_line_refund_to_invoice_qty/models/res_company.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from odoo import fields, models


class ResCompany(models.Model):
_inherit = "res.company"

no_default_reinvoice_credit_note = fields.Boolean(
"Do not reinvoice credit note by default"
)
10 changes: 10 additions & 0 deletions sale_line_refund_to_invoice_qty/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from odoo import fields, models


class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

no_default_reinvoice_credit_note = fields.Boolean(
related="company_id.no_default_reinvoice_credit_note",
readonly=False,
)
3 changes: 3 additions & 0 deletions sale_line_refund_to_invoice_qty/readme/USAGE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ from the quantity invoiced of the related sales order lines.
Furthermore, after creating the credit note, you can mark the field "Sale qty
not to reinvoice" to decide the criteria to be used for each specific invoice
line.

Enabling the "Do not reinvoice credit note by default" flag in the Invoice settings, will
disable the "This credit note will be reinvoiced" flag on Credit Notes by default
13 changes: 9 additions & 4 deletions sale_line_refund_to_invoice_qty/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 @@ -394,6 +395,8 @@ <h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<p>Furthermore, after creating the credit note, you can mark the field “Sale qty
not to reinvoice” to decide the criteria to be used for each specific invoice
line.</p>
<p>Enabling the “Do not reinvoice credit note by default” flag in the Invoice settings, will
disable the “This credit note will be reinvoiced” flag on Credit Notes by default</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
Expand Down Expand Up @@ -421,7 +424,9 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-6">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>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="account.res_config_settings_view_form" />
<field name="arch" type="xml">
<div id="invoicing_settings" position="inside">
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="no_default_reinvoice_credit_note" />
</div>
<div class="o_setting_right_pane">
<label for="no_default_reinvoice_credit_note" />
<div class="text-muted">
Disables the "This credit note will be reinvoiced" flag on Credit Notes by default
</div>
</div>
</div>
</div>
</field>
</record>
</odoo>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class AccountMoveReversal(models.TransientModel):

sale_qty_to_reinvoice = fields.Boolean(
string="This credit note will be reinvoiced",
default="True",
default=lambda self: not self.env.company.no_default_reinvoice_credit_note,
help="Leave it marked if you will reinvoice the same sale order line "
"(standard behaviour)",
)
Expand Down

0 comments on commit ff3962d

Please sign in to comment.