39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
# 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)])
|