Browse Source

[IMP] Config for each pos

pull/381/head
Quentin Dupont 5 years ago
parent
commit
a68d150e99
  1. 1
      pos_place/__manifest__.py
  2. 5
      pos_place/i18n/fr.po
  3. 4
      pos_place/models/pos_config.py
  4. 3
      pos_place/static/src/js/widget.js
  5. 26
      pos_place/views/view_pos_config.xml

1
pos_place/__manifest__.py

@ -18,6 +18,7 @@
'security/res_groups.xml',
'security/ir.model.access.csv',
'views/templates.xml',
'views/view_pos_config.xml',
'views/view_pos_place.xml',
'views/view_pos_order.xml',
],

5
pos_place/i18n/fr.po

@ -142,6 +142,11 @@ msgstr "Choisir un emplacement"
msgid "This field is there to pass the id of the pos place user group to the point of sale client."
msgstr ""
#. module: pos_place
#: model:ir.model.fields,field_description:pos_place.field_pos_config__use_pos_place
msgid "Use Point of Sale places"
msgstr "Utiliser les emplacements"
#. module: pos_place
#: model:res.groups,name:pos_place.group_pos_place_user
msgid "User"

4
pos_place/models/pos_config.py

@ -7,6 +7,10 @@ from odoo import api, fields, models
class PosConfig(models.Model):
_inherit = 'pos.config'
use_pos_place = fields.Boolean(
string="Use Point of Sale places",
default=False)
group_pos_place_user_id = fields.Many2one(
'res.groups', string='Point of Sale Place User Group',
compute='_compute_group_pos_place_user_id',

3
pos_place/static/src/js/widget.js

@ -29,7 +29,8 @@ odoo.define('pos_place.widgets', function (require) {
});
},
is_visible: function () {
return this.pos.user.groups_id.indexOf(
return this.pos.config.use_pos_place &&
this.pos.user.groups_id.indexOf(
this.pos.config.group_pos_place_user_id[0]) !== -1;
},
get_name: function () {

26
pos_place/views/view_pos_config.xml

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2013 - Today: GRAP (http://www.grap.coop)
@author: Quentin DUPONT (https://twitter.com/pondupont)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>
<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="arch" type="xml">
<xpath expr="//field[@name='module_pos_restaurant']/../.." position="after">
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="use_pos_place" groups="pos_place.group_pos_place_manager"/>
</div>
<div class="o_setting_right_pane">
<label for="use_pos_place" groups="pos_place.group_pos_place_manager"/>
</div>
</div>
</xpath>
</field>
</record>
</odoo>
Loading…
Cancel
Save