[IMP] pre-commit: first run on whole repo

This commit is contained in:
Kevin Khao
2021-11-26 18:54:38 +03:00
parent a04b8980e1
commit 167aefee13
289 changed files with 6020 additions and 4170 deletions

View File

@@ -3,12 +3,12 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'POS Config Single User',
'version': '14.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': """
"name": "POS Config Single User",
"version": "14.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
======================
@@ -16,9 +16,9 @@ New parameter on pos.config: the (only) user allowed to start sessions of this p
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,
"author": "Akretion",
"website": "https://github.com/OCA/odoo-usability",
"depends": ["point_of_sale"],
"data": ["pos_view.xml"],
"installable": True,
}

View File

@@ -2,25 +2,26 @@
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models, _
from odoo import _, fields, models
from odoo.exceptions import UserError
class PosConfig(models.Model):
_inherit = 'pos.config'
_inherit = "pos.config"
allowed_user_id = fields.Many2one(
'res.users', string="Allowed User",
"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')
"sessions for this POS",
ondelete="restrict",
)
def open_session_cb(self, check_coa=True):
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.display_name,
self.allowed_user_id.display_name))
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.display_name, self.allowed_user_id.display_name)
)
return super().open_session_cb(check_coa=check_coa)

View File

@@ -1,27 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2016-2020 Akretion France (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="pos_config_view_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.pos_config_view_form"/>
<field name="arch" type="xml">
<field name="inherit_id" ref="point_of_sale.pos_config_view_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='start_category']/../.." position="after">
<div class="col-12 col-lg-6 o_setting_box" id="allowed_user">
<div class="o_setting_right_pane">
<label for="allowed_user_id"/>
<label for="allowed_user_id" />
<div class="text-muted">
If set, only this user will be able to start a session
</div>
<div class="content-group mt16">
<field name="allowed_user_id" options="{'no_create': True}"/>
<field name="allowed_user_id" options="{'no_create': True}" />
</div>
</div>
</div>