[WIP] Add pos_environment from v8.0 (grap / grap-odoo-incubator) repository
This commit is contained in:
parent
f4d02d6c92
commit
44f9af530f
|
|
@ -0,0 +1,117 @@
|
|||
==========================================
|
||||
Point of Sale - Custom Bill by Environment
|
||||
==========================================
|
||||
|
||||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
||||
:target: https://odoo-community.org/page/development-status
|
||||
:alt: Beta
|
||||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
|
||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||
:alt: License: AGPL-3
|
||||
.. |badge3| image:: https://img.shields.io/badge/github-grap%2Fgrap--odoo--incubator-lightgray.png?logo=github
|
||||
:target: https://github.com/grap/grap-odoo-incubator/tree/8.0/pos_environment
|
||||
:alt: grap/grap-odoo-incubator
|
||||
|
||||
|badge1| |badge2| |badge3|
|
||||
|
||||
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.
|
||||
|
||||
**Table of contents**
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
* 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
|
||||
|
||||
::
|
||||
|
||||
[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 = ===============================
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
* Open Your Point of Sale
|
||||
|
||||
* Realize a sale
|
||||
|
||||
* The printed bill will display the custom message
|
||||
|
||||
.. figure:: https://raw.githubusercontent.com/grap/grap-odoo-incubator/8.0/pos_environment/static/description/receipt.png
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
|
||||
* make this module working in a multi localization context (many languages),
|
||||
inserting a pattern in the key of each lines. sample:
|
||||
|
||||
::
|
||||
|
||||
[pos_environment_header]
|
||||
line_1 = ================================
|
||||
line_2_en_US = TICKET EDITED ON A TEST ENV
|
||||
line_2_fr_FR = TICKET EDITE SUR SERVEUR DE TEST
|
||||
line_3 = ================================
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
Bugs are tracked on `GitHub Issues <https://github.com/grap/grap-odoo-incubator/issues>`_.
|
||||
In case of trouble, please check there if your issue has already been reported.
|
||||
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||
`feedback <https://github.com/grap/grap-odoo-incubator/issues/new?body=module:%20pos_environment%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
|
||||
Do not contact contributors directly about support or help with technical issues.
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Authors
|
||||
~~~~~~~
|
||||
|
||||
* GRAP
|
||||
|
||||
Contributors
|
||||
~~~~~~~~~~~~
|
||||
|
||||
* Sylvain LE GAL (https://www.twitter.com/legalsylvain)
|
||||
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
|
||||
|
||||
|
||||
This module is part of the `grap/grap-odoo-incubator <https://github.com/grap/grap-odoo-incubator/tree/8.0/pos_environment>`_ project on GitHub.
|
||||
|
||||
|
||||
You are welcome to contribute.
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
# coding: utf-8
|
||||
from . import models
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
# coding: utf-8
|
||||
# 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': '8.0.1.0.0',
|
||||
'category': 'Point of Sale',
|
||||
'author': 'GRAP',
|
||||
'website': 'http://www.grap.coop',
|
||||
'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',
|
||||
],
|
||||
'images': [
|
||||
],
|
||||
'installable': False,
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * pos_environment
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 8.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-02-07 14:53+0000\n"
|
||||
"PO-Revision-Date: 2019-02-07 14:53+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
|
||||
#: field:pos.config,receipt_environment_footer:0
|
||||
msgid "Receipt Environment Footer"
|
||||
msgstr "Pied du ticket (selon environnement)"
|
||||
|
||||
#. module: pos_environment
|
||||
#: field:pos.config,receipt_environment_header:0
|
||||
msgid "Receipt Environment Header"
|
||||
msgstr "En-tête du ticket (selon environnement)"
|
||||
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
# coding: utf-8
|
||||
from . import pos_config
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
# coding: utf-8
|
||||
# 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 openerp import api, fields, models
|
||||
from openerp.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
|
||||
if serv_config.has_section(section_name):
|
||||
return '\n'.join(
|
||||
[x[1] for x in serv_config.items(section_name)])
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
* 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
|
||||
|
||||
::
|
||||
|
||||
[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 = ===============================
|
||||
|
|
@ -0,0 +1 @@
|
|||
* Sylvain LE GAL (https://www.twitter.com/legalsylvain)
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
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.
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
* make this module working in a multi localization context (many languages),
|
||||
inserting a pattern in the key of each lines. sample:
|
||||
|
||||
::
|
||||
|
||||
[pos_environment_header]
|
||||
line_1 = ================================
|
||||
line_2_en_US = TICKET EDITED ON A TEST ENV
|
||||
line_2_fr_FR = TICKET EDITE SUR SERVEUR DE TEST
|
||||
line_3 = ================================
|
||||
|
|
@ -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: 35 KiB |
|
|
@ -0,0 +1,29 @@
|
|||
/******************************************************************************
|
||||
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).
|
||||
*****************************************************************************/
|
||||
'use strict';
|
||||
|
||||
openerp.pos_environment = function(instance, local) {
|
||||
|
||||
var module = instance.point_of_sale;
|
||||
|
||||
/*************************************************************************
|
||||
Extend module.Order:
|
||||
add environment header and footer in export_for_printing
|
||||
to make print via proxy working
|
||||
*/
|
||||
var moduleOrderParent = module.Order;
|
||||
module.Order = module.Order.extend({
|
||||
|
||||
export_for_printing: function(attributes){
|
||||
var order = moduleOrderParent.prototype.export_for_printing.apply(this, arguments);
|
||||
order.receipt_environment_header = this.pos.config.receipt_environment_header;
|
||||
order.receipt_environment_footer = this.pos.config.receipt_environment_footer;
|
||||
return order;
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<template>
|
||||
|
||||
<!-- Non Proxy Bill -->
|
||||
<t t-extend="PosTicket">
|
||||
<t t-jquery="[t-if='widget.pos.config.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='widget.pos.config.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']" 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']" 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).
|
||||
-->
|
||||
|
||||
<openerp><data>
|
||||
|
||||
<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>
|
||||
|
||||
</data></openerp>
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
<?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).
|
||||
-->
|
||||
<openerp><data>
|
||||
|
||||
<record id="view_pos_config_form" model="ir.ui.view">
|
||||
<field name="model">pos.config</field>
|
||||
<field name="inherit_id" ref="point_of_sale.view_pos_config_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="receipt_footer" position="after">
|
||||
<field name="receipt_environment_header"/>
|
||||
<field name="receipt_environment_footer"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data></openerp>
|
||||
Loading…
Reference in New Issue