Browse Source

Merge pull request #2 from quentinDupont/12.0-ADD-pos_place_imp

[IMP] Config for each pos
pull/381/head
Sylvain LE GAL 5 years ago
committed by GitHub
parent
commit
5c59455866
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  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/res_groups.xml',
'security/ir.model.access.csv', 'security/ir.model.access.csv',
'views/templates.xml', 'views/templates.xml',
'views/view_pos_config.xml',
'views/view_pos_place.xml', 'views/view_pos_place.xml',
'views/view_pos_order.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." msgid "This field is there to pass the id of the pos place user group to the point of sale client."
msgstr "" 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 #. module: pos_place
#: model:res.groups,name:pos_place.group_pos_place_user #: model:res.groups,name:pos_place.group_pos_place_user
msgid "User" msgid "User"

4
pos_place/models/pos_config.py

@ -7,6 +7,10 @@ from odoo import api, fields, models
class PosConfig(models.Model): class PosConfig(models.Model):
_inherit = 'pos.config' _inherit = 'pos.config'
use_pos_place = fields.Boolean(
string="Use Point of Sale places",
default=False)
group_pos_place_user_id = fields.Many2one( group_pos_place_user_id = fields.Many2one(
'res.groups', string='Point of Sale Place User Group', 'res.groups', string='Point of Sale Place User Group',
compute='_compute_group_pos_place_user_id', 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 () { 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; this.pos.config.group_pos_place_user_id[0]) !== -1;
}, },
get_name: function () { 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