commit
acb99e6146
|
|
@ -0,0 +1,4 @@
|
|||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
|
@ -0,0 +1 @@
|
|||
from . import models
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
# 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).
|
||||
{
|
||||
'name': 'Point of Sale - Custom Bill by Environment',
|
||||
'summary': "Custom messages on the bill depending on the environment",
|
||||
'version': '12.0.1.0.0',
|
||||
'category': 'Point of Sale',
|
||||
'author': 'GRAP,Odoo Community Association (OCA)',
|
||||
'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',
|
||||
],
|
||||
'installable': True,
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * pos_environment
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 12.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-07-31 13:08+0000\n"
|
||||
"PO-Revision-Date: 2019-07-31 13:08+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: pos_environment
|
||||
#: model_terms:ir.ui.view,arch_db:pos_environment.view_pos_config_form
|
||||
msgid "Environment Settings"
|
||||
msgstr "Paramétrages liés à l'environnement"
|
||||
|
||||
#. module: pos_environment
|
||||
#: model:ir.model,name:pos_environment.model_pos_config
|
||||
msgid "Point of Sale Configuration"
|
||||
msgstr "Paramétrage du point de vente"
|
||||
|
||||
#. module: pos_environment
|
||||
#: model:ir.model.fields,field_description:pos_environment.field_pos_config__receipt_environment_footer
|
||||
msgid "Receipt Environment Footer"
|
||||
msgstr "Pied du ticket (selon environnement)"
|
||||
|
||||
#. module: pos_environment
|
||||
#: model:ir.model.fields,field_description:pos_environment.field_pos_config__receipt_environment_header
|
||||
msgid "Receipt Environment Header"
|
||||
msgstr "Entête du ticket (selon environnement)"
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
from . import pos_config
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
# Copyright (C) 2018 - 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 api, fields, models
|
||||
from odoo.addons.server_environment import serv_config
|
||||
|
||||
|
||||
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('footer')
|
||||
|
||||
@api.model
|
||||
def _get_receipt_environment_part(self, part):
|
||||
section_name = 'pos_environment_%s' % part
|
||||
line_list = []
|
||||
if serv_config.has_section(section_name):
|
||||
# Parse each line
|
||||
for item in serv_config.items(section_name):
|
||||
if '__' not in item[0]:
|
||||
# Universal line
|
||||
line_list.append(item[1])
|
||||
elif '__%s' % (self.env.user.lang) in item[0]:
|
||||
# depend of the language
|
||||
line_list.append(item[1])
|
||||
return '\n'.join(line_list)
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
* Open your module ``server_environment_files``
|
||||
|
||||
* In each environment folder, create a new file named ``pos_environment.conf``
|
||||
(for exemple)
|
||||
|
||||
* In each file, write a section like this one, depending on your environment
|
||||
|
||||
.. code-block::
|
||||
|
||||
[pos_environment_header]
|
||||
line_1 = ===============================
|
||||
line_2 = TICKET EDITED ON A TEST
|
||||
line_3 = ENVIRONMENT
|
||||
line_4 = ===============================
|
||||
|
||||
[pos_environment_footer]
|
||||
line_1 = ===============================
|
||||
line_2 = THIS TICKET HAS BEEN EDITED
|
||||
line_3 = ON A TEST ENVIRONMENT
|
||||
line_4 = -------------------------------
|
||||
line_5 = IT CAN NOT BE CONSIDERED
|
||||
line_6 = AS A PROOF OF PURCHASE
|
||||
line_7 = ===============================
|
||||
|
||||
**Internationalisation**
|
||||
|
||||
If you deploy Odoo in a multi languages context, you can add a suffix
|
||||
``__xx_xx`` in the name of each line, where ``xx_xx`` is the language.
|
||||
The text will be displayed on the bill, depending of the language of the
|
||||
current user. Sample :
|
||||
|
||||
.. code-block::
|
||||
|
||||
line_1 = ===============================
|
||||
line_2__en_US = TICKET EDITED ON A TEST SERVER
|
||||
line_2__fr_FR = TICKET EDITE SUR SERVEUR DE TEST
|
||||
line_3 = -------------------------------
|
||||
|
||||
**Note**
|
||||
|
||||
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
|
||||
|
|
@ -0,0 +1 @@
|
|||
* Sylvain LE GAL (https://www.twitter.com/legalsylvain)
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
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...)
|
||||
|
||||
This module is based on the mechanism introduced by the ``server_environment``
|
||||
module.
|
||||
|
||||
**Note**
|
||||
|
||||
This module works with or without IoT Box.
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
* 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.
|
After Width: | Height: | Size: 26 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
|
|
@ -0,0 +1,25 @@
|
|||
/** ****************************************************************************
|
||||
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;
|
||||
console.log(res);
|
||||
return res;
|
||||
},
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
<?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>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?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"></script>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?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>
|
||||
|
||||
<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"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//sheet" position="inside">
|
||||
<h2 name="order">Environment Settings</h2>
|
||||
<div class="row mt16 o_settings_container">
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="receipt_environment_header"/>
|
||||
<div class="text-muted">
|
||||
<field name="receipt_environment_header"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="receipt_environment_footer"/>
|
||||
<div class="text-muted">
|
||||
<field name="receipt_environment_footer"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
[pos_environment_header]
|
||||
line_1 = ===============================
|
||||
line_2 = BILL PRINTED ON
|
||||
line_3 = DEV ENVIRONMNENT
|
||||
line_4 = ===============================
|
||||
|
||||
[pos_environment_footer]
|
||||
line_1 = ===============================
|
||||
line_2 = BILL PRINTED ON
|
||||
line_3 = DEV ENVIRONMNENT
|
||||
line_4 = ===============================
|
||||
line_5 = THIS BILL DOESN't CONSTITUTE
|
||||
line_6 = PROOF OF PURCHASE
|
||||
line_7 = ===============================
|
||||
Loading…
Reference in New Issue