Skip to content

Commit cc7a907

Browse files
committed
[MIG] pos_auto_invoice: Migration to 18.0
1 parent 1536481 commit cc7a907

7 files changed

Lines changed: 46 additions & 41 deletions

File tree

pos_auto_invoice/README.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,16 @@ Contributors
7070
- Carmen Bianca Bakker
7171
- hugues de keyzer
7272

73+
- `Trobz <https://trobz.com>`__:
74+
75+
- Tris Doan
76+
77+
Other credits
78+
-------------
79+
80+
The migration of this module from 16.0 to 18.0 was financially supported
81+
by Camptocamp.
82+
7383
Maintainers
7484
-----------
7585

pos_auto_invoice/__manifest__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{
55
"name": "Point of Sale Automatically Invoice",
66
"summary": "Allow to set POS orders as to-invoice by default",
7-
"version": "16.0.1.0.0",
7+
"version": "18.0.1.0.0",
88
"category": "Point of Sale",
99
"website": "https://github.com/OCA/pos",
1010
"author": "Coop IT Easy SC, Odoo Community Association (OCA)",
@@ -16,8 +16,6 @@
1616
"views/res_config_settings_view.xml",
1717
],
1818
"assets": {
19-
"point_of_sale.assets": [
20-
"pos_auto_invoice/static/src/js/*.js",
21-
]
19+
"point_of_sale._assets_pos": ["pos_auto_invoice/static/src/**/*"],
2220
},
2321
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
- [Coop IT Easy SC](https://coopiteasy.be):
22
- Carmen Bianca Bakker
33
- hugues de keyzer
4+
- [Trobz](https://trobz.com):
5+
- Tris Doan

pos_auto_invoice/readme/CREDITS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The migration of this module from 16.0 to 18.0 was financially supported by Camptocamp.

pos_auto_invoice/static/description/index.html

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,8 @@ <h1 class="title">Point of Sale Automatically Invoice</h1>
379379
<li><a class="reference internal" href="#credits" id="toc-entry-3">Credits</a><ul>
380380
<li><a class="reference internal" href="#authors" id="toc-entry-4">Authors</a></li>
381381
<li><a class="reference internal" href="#contributors" id="toc-entry-5">Contributors</a></li>
382-
<li><a class="reference internal" href="#maintainers" id="toc-entry-6">Maintainers</a></li>
382+
<li><a class="reference internal" href="#other-credits" id="toc-entry-6">Other credits</a></li>
383+
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
383384
</ul>
384385
</li>
385386
</ul>
@@ -415,10 +416,19 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
415416
<li>hugues de keyzer</li>
416417
</ul>
417418
</li>
419+
<li><a class="reference external" href="https://trobz.com">Trobz</a>:<ul>
420+
<li>Tris Doan</li>
418421
</ul>
422+
</li>
423+
</ul>
424+
</div>
425+
<div class="section" id="other-credits">
426+
<h2><a class="toc-backref" href="#toc-entry-6">Other credits</a></h2>
427+
<p>The migration of this module from 16.0 to 18.0 was financially supported
428+
by Camptocamp.</p>
419429
</div>
420430
<div class="section" id="maintainers">
421-
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
431+
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
422432
<p>This module is maintained by the OCA.</p>
423433
<a class="reference external image-reference" href="https://odoo-community.org">
424434
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,12 @@
1-
/** @odoo-module **/
2-
3-
import {Order} from "point_of_sale.models";
4-
import Registries from "point_of_sale.Registries";
5-
6-
const AutoInvoiceOrder = (OriginalOrder) =>
7-
class extends OriginalOrder {
8-
constructor(obj, options) {
9-
super(...arguments);
10-
if (!options.json && this.pos.config.invoice_by_default) {
11-
this.to_invoice = true;
12-
}
1+
import {PosOrder} from "@point_of_sale/app/models/pos_order";
2+
import {patch} from "@web/core/utils/patch";
3+
4+
patch(PosOrder.prototype, {
5+
is_to_invoice() {
6+
const invoice_by_default = this.config.invoice_by_default;
7+
if (invoice_by_default) {
8+
return true;
139
}
14-
15-
init_from_JSON(json) {
16-
super.init_from_JSON(...arguments);
17-
// This should be done in the original method, but curiously
18-
// it is not (to_invoice is always set to false).
19-
this.to_invoice = json.to_invoice;
20-
}
21-
};
22-
23-
Registries.Model.extend(Order, AutoInvoiceOrder);
10+
return super.is_to_invoice(...arguments);
11+
},
12+
});

pos_auto_invoice/views/res_config_settings_view.xml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,14 @@ SPDX-License-Identifier: AGPL-3.0-or-later
1010
<field name="model">res.config.settings</field>
1111
<field name="inherit_id" ref="point_of_sale.res_config_settings_view_form" />
1212
<field name="arch" type="xml">
13-
<xpath expr="//div[@id='pos_accounting_section']" position="inside">
14-
<div class="col-12 col-lg-6 o_setting_box">
15-
<div class="o_setting_left_pane">
16-
<field name="pos_invoice_by_default" />
17-
</div>
18-
<div class="o_setting_right_pane">
19-
<label for="pos_invoice_by_default" />
20-
<div class="text-muted">
21-
Set orders as to-invoice by default
22-
</div>
23-
</div>
24-
</div>
25-
</xpath>
13+
<block id="pos_accounting_section" position="inside">
14+
<setting
15+
help="Set orders as to-invoice by default"
16+
id="invoice_by_default"
17+
>
18+
<field name="pos_invoice_by_default" />
19+
</setting>
20+
</block>
2621
</field>
2722
</record>
2823
</odoo>

0 commit comments

Comments
 (0)