[IMP] pos_environment: black, isort, prettier
This commit is contained in:
parent
e2ebd44de8
commit
ed4cb66cae
|
|
@ -2,23 +2,23 @@
|
|||
# @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.1',
|
||||
'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',
|
||||
"name": "Point of Sale - Custom Bill by Environment",
|
||||
"summary": "Custom messages on the bill depending on the environment",
|
||||
"version": "12.0.1.0.1",
|
||||
"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',
|
||||
"data": [
|
||||
"views/templates.xml",
|
||||
"views/view_pos_config.xml",
|
||||
],
|
||||
'qweb': [
|
||||
'static/src/xml/pos_environment.xml',
|
||||
"qweb": [
|
||||
"static/src/xml/pos_environment.xml",
|
||||
],
|
||||
'installable': True,
|
||||
"installable": True,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,44 +2,49 @@
|
|||
# @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'
|
||||
_inherit = "pos.config"
|
||||
|
||||
# Columns section
|
||||
receipt_environment_header = fields.Text(
|
||||
string='Receipt Environment Header',
|
||||
compute='_compute_receipt_environment_header')
|
||||
string="Receipt Environment Header",
|
||||
compute="_compute_receipt_environment_header",
|
||||
)
|
||||
|
||||
receipt_environment_footer = fields.Text(
|
||||
string='Receipt Environment Footer',
|
||||
compute='_compute_receipt_environment_footer')
|
||||
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')
|
||||
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')
|
||||
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
|
||||
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]:
|
||||
if "__" not in item[0]:
|
||||
# Universal line
|
||||
line_list.append(item[1])
|
||||
elif '__%s' % (self.env.user.lang) in item[0]:
|
||||
elif "__%s" % (self.env.user.lang) in item[0]:
|
||||
# depend of the language
|
||||
line_list.append(item[1])
|
||||
return '\n'.join(line_list)
|
||||
return "\n".join(line_list)
|
||||
|
|
|
|||
|
|
@ -4,20 +4,18 @@
|
|||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
*****************************************************************************/
|
||||
|
||||
odoo.define('pos_environment.models', function (require) {
|
||||
'use strict';
|
||||
odoo.define("pos_environment.models", function (require) {
|
||||
"use strict";
|
||||
|
||||
var models = require('point_of_sale.models');
|
||||
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;
|
||||
res.receipt_environment_header = this.pos.config.receipt_environment_header;
|
||||
res.receipt_environment_footer = this.pos.config.receipt_environment_footer;
|
||||
return res;
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<template>
|
||||
|
||||
<!-- Non Proxy Bill -->
|
||||
|
|
@ -7,8 +7,11 @@
|
|||
<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"/>
|
||||
<t
|
||||
t-foreach="widget.pos.config.receipt_environment_header.split('\n')"
|
||||
t-as="line"
|
||||
>
|
||||
<t t-esc="line" />
|
||||
<br />
|
||||
</t>
|
||||
</div>
|
||||
|
|
@ -19,8 +22,11 @@
|
|||
<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"/>
|
||||
<t
|
||||
t-foreach="widget.pos.config.receipt_environment_footer.split('\n')"
|
||||
t-as="line"
|
||||
>
|
||||
<t t-esc="line" />
|
||||
<br />
|
||||
</t>
|
||||
</div>
|
||||
|
|
@ -35,8 +41,11 @@
|
|||
<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"/>
|
||||
<t
|
||||
t-foreach="widget.pos.config.receipt_environment_header.split('\n')"
|
||||
t-as="line"
|
||||
>
|
||||
<t t-esc="line" />
|
||||
<br />
|
||||
</t>
|
||||
</div>
|
||||
|
|
@ -47,8 +56,11 @@
|
|||
<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"/>
|
||||
<t
|
||||
t-foreach="widget.pos.config.receipt_environment_footer.split('\n')"
|
||||
t-as="line"
|
||||
>
|
||||
<t t-esc="line" />
|
||||
<br />
|
||||
</t>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,15 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?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>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="/pos_environment/static/src/js/models.js"
|
||||
/>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!--
|
||||
Copyright (C) 2013 - Today: GRAP (http://www.grap.coop)
|
||||
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
|
||||
|
|
@ -6,26 +6,26 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
|||
-->
|
||||
<odoo>
|
||||
|
||||
<record id="view_pos_config_form" model="ir.ui.view">
|
||||
<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="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"/>
|
||||
<label for="receipt_environment_header" />
|
||||
<div class="text-muted">
|
||||
<field name="receipt_environment_header"/>
|
||||
<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"/>
|
||||
<label for="receipt_environment_footer" />
|
||||
<div class="text-muted">
|
||||
<field name="receipt_environment_footer"/>
|
||||
<field name="receipt_environment_footer" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
../../../../pos_environment
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
import setuptools
|
||||
|
||||
setuptools.setup(
|
||||
setup_requires=['setuptools-odoo'],
|
||||
odoo_addon=True,
|
||||
)
|
||||
Loading…
Reference in New Issue