[MIG] pos_environment migration to 16.0 (from 12.0)
This commit is contained in:
parent
71dcade8bb
commit
4b1ced480c
|
|
@ -4,9 +4,10 @@
|
||||||
{
|
{
|
||||||
"name": "Point of Sale - Custom Bill by Environment",
|
"name": "Point of Sale - Custom Bill by Environment",
|
||||||
"summary": "Custom messages on the bill depending on the 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",
|
"category": "Point of Sale",
|
||||||
"author": "GRAP,Odoo Community Association (OCA)",
|
"author": "GRAP,Odoo Community Association (OCA)",
|
||||||
|
"maintainers": ["legalsylvain"],
|
||||||
"website": "https://github.com/OCA/server-env",
|
"website": "https://github.com/OCA/server-env",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"depends": [
|
"depends": [
|
||||||
|
|
@ -14,11 +15,12 @@
|
||||||
"server_environment",
|
"server_environment",
|
||||||
],
|
],
|
||||||
"data": [
|
"data": [
|
||||||
"views/templates.xml",
|
"views/res_config_settings_views.xml",
|
||||||
"views/view_pos_config.xml",
|
|
||||||
],
|
|
||||||
"qweb": [
|
|
||||||
"static/src/xml/pos_environment.xml",
|
|
||||||
],
|
],
|
||||||
|
"assets": {
|
||||||
|
"point_of_sale.assets": [
|
||||||
|
"pos_environment/static/src/xml/ReceiptScreen.xml",
|
||||||
|
],
|
||||||
|
},
|
||||||
"installable": True,
|
"installable": True,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1 +1,2 @@
|
||||||
from . import pos_config
|
from . import pos_config
|
||||||
|
from . import res_config_settings
|
||||||
|
|
|
||||||
|
|
@ -9,25 +9,20 @@ from odoo.addons.server_environment import serv_config
|
||||||
class PosConfig(models.Model):
|
class PosConfig(models.Model):
|
||||||
_inherit = "pos.config"
|
_inherit = "pos.config"
|
||||||
|
|
||||||
# Columns section
|
|
||||||
receipt_environment_header = fields.Text(
|
receipt_environment_header = fields.Text(
|
||||||
string="Receipt Environment Header",
|
|
||||||
compute="_compute_receipt_environment_header",
|
compute="_compute_receipt_environment_header",
|
||||||
)
|
)
|
||||||
|
|
||||||
receipt_environment_footer = fields.Text(
|
receipt_environment_footer = fields.Text(
|
||||||
string="Receipt Environment Footer",
|
|
||||||
compute="_compute_receipt_environment_footer",
|
compute="_compute_receipt_environment_footer",
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def _compute_receipt_environment_header(self):
|
def _compute_receipt_environment_header(self):
|
||||||
for config in self:
|
for config in self:
|
||||||
config.receipt_environment_header = self._get_receipt_environment_part(
|
config.receipt_environment_header = self._get_receipt_environment_part(
|
||||||
"header"
|
"header"
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def _compute_receipt_environment_footer(self):
|
def _compute_receipt_environment_footer(self):
|
||||||
for config in self:
|
for config in self:
|
||||||
config.receipt_environment_footer = self._get_receipt_environment_part(
|
config.receipt_environment_footer = self._get_receipt_environment_part(
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
)
|
||||||
|
|
@ -42,4 +42,4 @@ To be sure that your server is correctly configured, you can check the settings
|
||||||
in the Point of Sale configuration.
|
in the Point of Sale configuration.
|
||||||
|
|
||||||
|
|
||||||
.. figure:: ../static/description/pos_config_form.png
|
.. figure:: ../static/description/res_config_settings_form.png
|
||||||
|
|
|
||||||
|
|
@ -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
|
to customize the bill printed by the point of sale, with a text depending
|
||||||
on your environment. (Development, , Pre Production, Production, etc...)
|
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``
|
This module is based on the mechanism introduced by the ``server_environment``
|
||||||
module.
|
module.
|
||||||
|
|
||||||
**Note**
|
**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.
|
||||||
|
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
* Open Your Point of Sale
|
|
||||||
|
|
||||||
* Realize a sale
|
|
||||||
|
|
||||||
* The printed bill will display the custom message
|
|
||||||
|
|
||||||
.. figure:: ../static/description/receipt.png
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 26 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 32 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
|
|
@ -1,22 +0,0 @@
|
||||||
/** ****************************************************************************
|
|
||||||
Copyright (C) 2019 - 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).
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
odoo.define("pos_environment.models", function (require) {
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var models = require("point_of_sale.models");
|
|
||||||
|
|
||||||
var order_super = models.Order.prototype;
|
|
||||||
|
|
||||||
models.Order = models.Order.extend({
|
|
||||||
export_for_printing: function () {
|
|
||||||
var res = order_super.export_for_printing.apply(this, arguments);
|
|
||||||
res.receipt_environment_header = this.pos.config.receipt_environment_header;
|
|
||||||
res.receipt_environment_footer = this.pos.config.receipt_environment_footer;
|
|
||||||
return res;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
@ -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>
|
||||||
|
|
@ -1,71 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<template>
|
|
||||||
|
|
||||||
<!-- Non Proxy Bill -->
|
|
||||||
<t t-extend="PosTicket">
|
|
||||||
<t t-jquery="[t-if='receipt.header']" t-operation="before">
|
|
||||||
<t t-if="widget.pos.config.receipt_environment_header">
|
|
||||||
<br />
|
|
||||||
<div style='text-align:center'>
|
|
||||||
<t
|
|
||||||
t-foreach="widget.pos.config.receipt_environment_header.split('\n')"
|
|
||||||
t-as="line"
|
|
||||||
>
|
|
||||||
<t t-esc="line" />
|
|
||||||
<br />
|
|
||||||
</t>
|
|
||||||
</div>
|
|
||||||
</t>
|
|
||||||
</t>
|
|
||||||
|
|
||||||
<t t-jquery="[t-if='receipt.footer']" t-operation="after">
|
|
||||||
<t t-if="widget.pos.config.receipt_environment_footer">
|
|
||||||
<br />
|
|
||||||
<div style='text-align:center'>
|
|
||||||
<t
|
|
||||||
t-foreach="widget.pos.config.receipt_environment_footer.split('\n')"
|
|
||||||
t-as="line"
|
|
||||||
>
|
|
||||||
<t t-esc="line" />
|
|
||||||
<br />
|
|
||||||
</t>
|
|
||||||
</div>
|
|
||||||
</t>
|
|
||||||
</t>
|
|
||||||
</t>
|
|
||||||
|
|
||||||
<!-- Proxy Bill -->
|
|
||||||
<t t-extend="XmlReceipt">
|
|
||||||
<t t-jquery="[t-if='receipt.header_xml']" t-operation="after">
|
|
||||||
|
|
||||||
<t t-if="widget.pos.config.receipt_environment_header">
|
|
||||||
<br />
|
|
||||||
<div style='text-align:center'>
|
|
||||||
<t
|
|
||||||
t-foreach="widget.pos.config.receipt_environment_header.split('\n')"
|
|
||||||
t-as="line"
|
|
||||||
>
|
|
||||||
<t t-esc="line" />
|
|
||||||
<br />
|
|
||||||
</t>
|
|
||||||
</div>
|
|
||||||
</t>
|
|
||||||
</t>
|
|
||||||
|
|
||||||
<t t-jquery="[t-if='receipt.footer_xml']" t-operation="after">
|
|
||||||
<t t-if="widget.pos.config.receipt_environment_footer">
|
|
||||||
<br />
|
|
||||||
<div style='text-align:center'>
|
|
||||||
<t
|
|
||||||
t-foreach="widget.pos.config.receipt_environment_footer.split('\n')"
|
|
||||||
t-as="line"
|
|
||||||
>
|
|
||||||
<t t-esc="line" />
|
|
||||||
<br />
|
|
||||||
</t>
|
|
||||||
</div>
|
|
||||||
</t>
|
|
||||||
</t>
|
|
||||||
</t>
|
|
||||||
|
|
||||||
</template>
|
|
||||||
|
|
@ -6,11 +6,11 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
-->
|
-->
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<record id="view_pos_config_form" model="ir.ui.view">
|
<record id="view_res_config_settings_form" model="ir.ui.view">
|
||||||
<field name="model">pos.config</field>
|
<field name="model">res.config.settings</field>
|
||||||
<field name="inherit_id" ref="point_of_sale.pos_config_view_form" />
|
<field name="inherit_id" ref="point_of_sale.res_config_settings_view_form" />
|
||||||
<field name="arch" type="xml">
|
<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>
|
<h2 name="order">Environment Settings</h2>
|
||||||
<div class="row mt16 o_settings_container">
|
<div class="row mt16 o_settings_container">
|
||||||
<div class="col-12 col-lg-6 o_setting_box">
|
<div class="col-12 col-lg-6 o_setting_box">
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<!--
|
|
||||||
Copyright (C) 2013 - 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).
|
|
||||||
-->
|
|
||||||
<odoo>
|
|
||||||
|
|
||||||
<template id="point_of_sale_assets" inherit_id="point_of_sale.index">
|
|
||||||
<xpath expr="." position="inside">
|
|
||||||
<script
|
|
||||||
type="text/javascript"
|
|
||||||
src="/pos_environment/static/src/js/models.js"
|
|
||||||
/>
|
|
||||||
</xpath>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
</odoo>
|
|
||||||
Loading…
Reference in New Issue