Skip to content

Commit

Permalink
[MIG] pos_environment migration to 16.0 (from 12.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
legalsylvain committed Apr 21, 2023
1 parent 71dcade commit 4b1ced4
Show file tree
Hide file tree
Showing 15 changed files with 67 additions and 135 deletions.
14 changes: 8 additions & 6 deletions pos_environment/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,23 @@
{
"name": "Point of Sale - Custom Bill by Environment",
"summary": "Custom messages on the bill depending on the environment",
"version": "12.0.1.0.1",
"version": "16.0.1.0.1",
"category": "Point of Sale",
"author": "GRAP,Odoo Community Association (OCA)",
"maintainers": ["legalsylvain"],
"website": "https://github.com/OCA/server-env",
"license": "AGPL-3",
"depends": [
"point_of_sale",
"server_environment",
],
"data": [
"views/templates.xml",
"views/view_pos_config.xml",
],
"qweb": [
"static/src/xml/pos_environment.xml",
"views/res_config_settings_views.xml",
],
"assets": {
"point_of_sale.assets": [
"pos_environment/static/src/xml/ReceiptScreen.xml",
],
},
"installable": True,
}
1 change: 1 addition & 0 deletions pos_environment/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import pos_config
from . import res_config_settings
5 changes: 0 additions & 5 deletions pos_environment/models/pos_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,20 @@
class PosConfig(models.Model):
_inherit = "pos.config"

# Columns section
receipt_environment_header = fields.Text(
string="Receipt Environment Header",
compute="_compute_receipt_environment_header",
)

receipt_environment_footer = fields.Text(
string="Receipt Environment Footer",
compute="_compute_receipt_environment_footer",
)

@api.multi
def _compute_receipt_environment_header(self):
for config in self:
config.receipt_environment_header = self._get_receipt_environment_part(
"header"
)

@api.multi
def _compute_receipt_environment_footer(self):
for config in self:
config.receipt_environment_footer = self._get_receipt_environment_part(
Expand Down
16 changes: 16 additions & 0 deletions pos_environment/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (C) 2023 - Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models


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

receipt_environment_header = fields.Text(
related="pos_config_id.receipt_environment_header"
)

receipt_environment_footer = fields.Text(
related="pos_config_id.receipt_environment_footer"
)
2 changes: 1 addition & 1 deletion pos_environment/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ To be sure that your server is correctly configured, you can check the settings
in the Point of Sale configuration.


.. figure:: ../static/description/pos_config_form.png
.. figure:: ../static/description/res_config_settings_form.png
8 changes: 7 additions & 1 deletion pos_environment/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ This module extends the Odoo point of sale module to allow administrator
to customize the bill printed by the point of sale, with a text depending
on your environment. (Development, , Pre Production, Production, etc...)

The displayed and printed bill will display the custom message

.. figure:: ../static/description/receipt.png

This module is based on the mechanism introduced by the ``server_environment``
module.

**Note**

This module works with or without IoT Box.
This module provides a feature that is legally required in some countries
(such as France, under the law on accounting certification)
where test and production receipts must be distinguishable.
7 changes: 0 additions & 7 deletions pos_environment/readme/USAGE.rst

This file was deleted.

Binary file not shown.
Binary file modified pos_environment/static/description/receipt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 0 additions & 22 deletions pos_environment/static/src/js/models.js

This file was deleted.

30 changes: 30 additions & 0 deletions pos_environment/static/src/xml/ReceiptScreen.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates id="template" xml:space="preserve">
<t
t-name="OrderReceipt"
t-inherit="point_of_sale.OrderReceipt"
t-inherit-mode="extension"
owl="1"
>

<xpath
expr="//t[@t-if='!receipt.header_html and receipt.header']"
position="after"
>
<t t-if="env.pos.config.receipt_environment_header">
<div style="white-space:pre-line"><t
t-esc="env.pos.config.receipt_environment_header"
/></div>
</t>
</xpath>

<xpath expr="//div[@class='after-footer']" position="before">
<t t-if="env.pos.config.receipt_environment_footer">
<div class="pos-receipt-order-data" style="white-space:pre-line"><t
t-esc="env.pos.config.receipt_environment_footer"
/></div>
</t>
</xpath>

</t>
</templates>
71 changes: 0 additions & 71 deletions pos_environment/static/src/xml/pos_environment.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>

<record id="view_pos_config_form" model="ir.ui.view">
<field name="model">pos.config</field>
<field name="inherit_id" ref="point_of_sale.pos_config_view_form" />
<record id="view_res_config_settings_form" model="ir.ui.view">
<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="//sheet" position="inside">
<xpath expr="//div[@id='pos_technical_section']" position="after">
<h2 name="order">Environment Settings</h2>
<div class="row mt16 o_settings_container">
<div class="col-12 col-lg-6 o_setting_box">
Expand Down
18 changes: 0 additions & 18 deletions pos_environment/views/templates.xml

This file was deleted.

0 comments on commit 4b1ced4

Please sign in to comment.