Skip to content

Commit

Permalink
[IMP] add invoice by default pos setting
Browse files Browse the repository at this point in the history
  • Loading branch information
huguesdk committed Oct 30, 2024
1 parent 818ff47 commit 32900a4
Show file tree
Hide file tree
Showing 12 changed files with 111 additions and 16 deletions.
12 changes: 11 additions & 1 deletion pos_auto_invoice/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,22 @@ Point of Sale Automatically Invoice

|badge1| |badge2| |badge3| |badge4| |badge5|

In the POS, set orders as to-invoice by default.
Allow to set point-of-sale orders as to-invoice by default.

**Table of contents**

.. contents::
:local:

Configuration
=============

This module adds an “Invoice By Default” option to the Accounting section of
the Point of Sale settings.

To set orders as to-invoice by default, check the “Invoice By Default”
checkbox.

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

Expand All @@ -59,6 +68,7 @@ Contributors
* `Coop IT Easy SC <https://coopiteasy.be>`_:

* Carmen Bianca Bakker
* hugues de keyzer

Maintainers
~~~~~~~~~~~
Expand Down
5 changes: 5 additions & 0 deletions pos_auto_invoice/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: 2024 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

from . import models
6 changes: 4 additions & 2 deletions pos_auto_invoice/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

{
"name": "Point of Sale Automatically Invoice",
"summary": """
In the POS, set orders as to-invoice by default.""",
"summary": "Allow to set POS orders as to-invoice by default",
"version": "16.0.1.0.0",
"category": "Point of Sale",
"website": "https://github.com/OCA/pos",
Expand All @@ -13,6 +12,9 @@
"depends": [
"point_of_sale",
],
"data": [
"views/res_config_settings_view.xml",
],
"assets": {
"point_of_sale.assets": [
"pos_auto_invoice/static/src/js/*.js",
Expand Down
6 changes: 6 additions & 0 deletions pos_auto_invoice/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-FileCopyrightText: 2024 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

from . import pos_config
from . import res_config_settings
11 changes: 11 additions & 0 deletions pos_auto_invoice/models/pos_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SPDX-FileCopyrightText: 2024 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

from odoo import fields, models


class PosConfig(models.Model):
_inherit = "pos.config"

invoice_by_default = fields.Boolean()
14 changes: 14 additions & 0 deletions pos_auto_invoice/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# SPDX-FileCopyrightText: 2024 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

from odoo import fields, models


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

pos_invoice_by_default = fields.Boolean(
related="pos_config_id.invoice_by_default",
readonly=False,
)
5 changes: 5 additions & 0 deletions pos_auto_invoice/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This module adds an “Invoice By Default” option to the Accounting section of
the Point of Sale settings.

To set orders as to-invoice by default, check the “Invoice By Default”
checkbox.
1 change: 1 addition & 0 deletions pos_auto_invoice/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
* `Coop IT Easy SC <https://coopiteasy.be>`_:

* Carmen Bianca Bakker
* hugues de keyzer
2 changes: 1 addition & 1 deletion pos_auto_invoice/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
In the POS, set orders as to-invoice by default.
Allow to set point-of-sale orders as to-invoice by default.
31 changes: 20 additions & 11 deletions pos_auto_invoice/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,46 +369,55 @@ <h1 class="title">Point of Sale Automatically Invoice</h1>
!! source digest: sha256:2886f37cd3bd20fc08a85145afe135699467c5b843c9e82d99d523c3a34b5d6c
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.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/pos/tree/16.0/pos_auto_invoice"><img alt="OCA/pos" src="https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/pos-16-0/pos-16-0-pos_auto_invoice"><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/pos&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>In the POS, set orders as to-invoice by default.</p>
<p>Allow to set point-of-sale orders as to-invoice by default.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-4">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-5">Maintainers</a></li>
<li><a class="reference internal" href="#configuration" id="toc-entry-1">Configuration</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-2">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-5">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-6">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="configuration">
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<p>This module adds an “Invoice By Default” option to the Accounting section of
the Point of Sale settings.</p>
<p>To set orders as to-invoice by default, check the “Invoice By Default”
checkbox.</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/pos/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/pos/issues/new?body=module:%20pos_auto_invoice%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">
<h1><a class="toc-backref" href="#toc-entry-2">Credits</a></h1>
<h1><a class="toc-backref" href="#toc-entry-3">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
<ul class="simple">
<li>Coop IT Easy SC</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<ul class="simple">
<li><a class="reference external" href="https://coopiteasy.be">Coop IT Easy SC</a>:<ul>
<li>Carmen Bianca Bakker</li>
<li>hugues de keyzer</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h2>
<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>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
Expand Down
4 changes: 3 additions & 1 deletion pos_auto_invoice/static/src/js/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ odoo.define("pos_auto_invoice.models", function (require) {
class AutoInvoiceOrder extends Order {
constructor() {
super(...arguments);
this.to_invoice = true;
if (this.pos.config.invoice_by_default) {
this.to_invoice = true;
}
}
};

Expand Down
30 changes: 30 additions & 0 deletions pos_auto_invoice/views/res_config_settings_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
SPDX-FileCopyrightText: 2024 Coop IT Easy SC
SPDX-License-Identifier: AGPL-3.0-or-later
-->
<odoo>

<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="point_of_sale.res_config_settings_view_form" />
<field name="arch" type="xml">
<xpath expr="//div[@id='pos_accounting_section']" position="inside">
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="pos_invoice_by_default" />
</div>
<div class="o_setting_right_pane">
<label for="pos_invoice_by_default" />
<div class="text-muted">
Set orders as to-invoice by default
</div>
</div>
</div>
</xpath>
</field>
</record>

</odoo>

0 comments on commit 32900a4

Please sign in to comment.