Add module pos_config_single_user
Several usability enhancements in sale, purchase, product and account
This commit is contained in:
3
pos_config_single_user/__init__.py
Normal file
3
pos_config_single_user/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from . import pos
|
||||||
24
pos_config_single_user/__manifest__.py
Normal file
24
pos_config_single_user/__manifest__.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2014-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
{
|
||||||
|
'name': 'POS Config Single User',
|
||||||
|
'version': '10.0.1.0.0',
|
||||||
|
'category': 'Point Of Sale',
|
||||||
|
'license': 'AGPL-3',
|
||||||
|
'summary': 'Configure on each pos.config a single user allowed to start it',
|
||||||
|
'description': """
|
||||||
|
POS Config Single User
|
||||||
|
======================
|
||||||
|
|
||||||
|
New parameter on pos.config: the (only) user allowed to start sessions of this pos.config.
|
||||||
|
|
||||||
|
This module has been written by Alexis de Lattre from Akretion <alexis.delattre@akretion.com>.
|
||||||
|
""",
|
||||||
|
'author': 'Akretion',
|
||||||
|
'website': 'http://www.akretion.com',
|
||||||
|
'depends': ['point_of_sale'],
|
||||||
|
'data': ['pos_view.xml'],
|
||||||
|
'installable': True,
|
||||||
|
}
|
||||||
27
pos_config_single_user/pos.py
Normal file
27
pos_config_single_user/pos.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2014-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from odoo import models, fields, api, _
|
||||||
|
from openerp.exceptions import UserError
|
||||||
|
|
||||||
|
|
||||||
|
class PosConfig(models.Model):
|
||||||
|
_inherit = 'pos.config'
|
||||||
|
|
||||||
|
allowed_user_id = fields.Many2one(
|
||||||
|
'res.users', string="Allowed User",
|
||||||
|
help="If you select a user, only this user will be allowed to start "
|
||||||
|
"sessions for this POS", ondelete='restrict')
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def open_session_cb(self):
|
||||||
|
self.ensure_one()
|
||||||
|
if (
|
||||||
|
self.allowed_user_id and
|
||||||
|
self.allowed_user_id != self.env.user):
|
||||||
|
raise UserError(_(
|
||||||
|
"The POS '%s' can be used only by user '%s'.") % (
|
||||||
|
self.name,
|
||||||
|
self.allowed_user_id.name))
|
||||||
|
return super(PosConfig, self).open_session_cb()
|
||||||
21
pos_config_single_user/pos_view.xml
Normal file
21
pos_config_single_user/pos_view.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
© 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||||
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
-->
|
||||||
|
|
||||||
|
<odoo>
|
||||||
|
|
||||||
|
|
||||||
|
<record id="view_pos_config_form" model="ir.ui.view">
|
||||||
|
<field name="name">pos_config_single_user.pos.config</field>
|
||||||
|
<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="sequence_id" position="after">
|
||||||
|
<field name="allowed_user_id"/>
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</odoo>
|
||||||
BIN
pos_config_single_user/static/description/icon.png
Normal file
BIN
pos_config_single_user/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.5 KiB |
Reference in New Issue
Block a user