Browse Source

Mar 24 : [UPDT] Bug Fixed 'hide_menu_user'

pull/275/head
AjmalCybro 2 years ago
parent
commit
7a0c1d2484
  1. 2
      hide_menu_user/__manifest__.py
  2. 10
      hide_menu_user/models/res_user.py
  3. 4
      pos_product_creation/controllers/main.py
  4. 7
      pos_product_creation/static/src/js/product_create_button.js
  5. 3
      pos_product_creation/static/src/js/product_create_popup.js
  6. 9
      pos_product_creation/static/src/xml/product_create_popup.xml

2
hide_menu_user/__manifest__.py

@ -22,7 +22,7 @@
{ {
'name': 'Hide Any Menu User Wise', 'name': 'Hide Any Menu User Wise',
'version': '14.0.1.0.0', 'version': '14.0.1.0.1',
'summary': 'Hide Any Menu Item User Wise', 'summary': 'Hide Any Menu Item User Wise',
'description': 'Hide Any Menu Item User Wise, Hide Menu Items, Hide Menu', 'description': 'Hide Any Menu Item User Wise, Hide Menu Items, Hide Menu',
'author': 'Cybrosys Techno Solutions', 'author': 'Cybrosys Techno Solutions',

10
hide_menu_user/models/res_user.py

@ -22,16 +22,16 @@
from odoo import models, fields, api from odoo import models, fields, api
class HideMenuUser(models.Model): class HideMenuUser(models.Model):
_inherit = 'res.users' _inherit = 'res.users'
@api.model @api.model_create_multi
def create(self, vals): def create(self, vals_list):
""" """
Else the menu will be still hidden even after removing from the list Else the menu will be still hidden even after removing from the list
""" """
self.clear_caches() for vals in vals_list:
self.clear_caches()
return super(HideMenuUser, self).create(vals) return super(HideMenuUser, self).create(vals)
def write(self, vals): def write(self, vals):
@ -43,6 +43,7 @@ class HideMenuUser(models.Model):
menu.write({ menu.write({
'restrict_user_ids': [(4, self.id)] 'restrict_user_ids': [(4, self.id)]
}) })
print(res,'resssssssssss')
self.clear_caches() self.clear_caches()
return res return res
@ -61,7 +62,6 @@ class HideMenuUser(models.Model):
'hidden to this user ') 'hidden to this user ')
is_admin = fields.Boolean(compute=_get_is_admin) is_admin = fields.Boolean(compute=_get_is_admin)
class RestrictMenu(models.Model): class RestrictMenu(models.Model):
_inherit = 'ir.ui.menu' _inherit = 'ir.ui.menu'

4
pos_product_creation/controllers/main.py

@ -27,7 +27,8 @@ from odoo.http import request
class PosProductCreation(http.Controller): class PosProductCreation(http.Controller):
@http.route('/create_product', type="json", auth="none") @http.route('/create_product', type="json", auth="none")
def create_product(self, category, name, price, product_reference, unit_measure, product_categories, **kwargs): def create_product(self, category, name, price, product_reference,
unit_measure, product_categories, barcode, **kwargs):
product_category = '' product_category = ''
if category == 'Consumable': if category == 'Consumable':
product_category = 'consu' product_category = 'consu'
@ -46,4 +47,5 @@ class PosProductCreation(http.Controller):
'uom_po_id': int(unit_measure), 'uom_po_id': int(unit_measure),
'categ_id': int(product_categories), 'categ_id': int(product_categories),
'available_in_pos': True, 'available_in_pos': True,
'barcode': barcode,
}) })

7
pos_product_creation/static/src/js/product_create_button.js

@ -30,11 +30,7 @@ odoo.define('owl_tutorials.product_create_button', function(require) {
var product_price = payload[3]; var product_price = payload[3];
var unit_measure = payload[4]; var unit_measure = payload[4];
var product_categories = payload[5]; var product_categories = payload[5];
console.log(product_category, 'product_category') var barcode = payload[6];
console.log(product_name, 'product_name')
console.log(product_reference, 'product_reference')
console.log(product_price, 'product_price')
console.log(unit_measure, 'unit_measure')
if (!product_name){ if (!product_name){
return this.showPopup('ErrorPopup', { return this.showPopup('ErrorPopup', {
title: _('A Unit Of Measure Is Required'), title: _('A Unit Of Measure Is Required'),
@ -52,6 +48,7 @@ odoo.define('owl_tutorials.product_create_button', function(require) {
'product_reference': product_reference, 'product_reference': product_reference,
'unit_measure': unit_measure, 'unit_measure': unit_measure,
'product_categories': product_categories, 'product_categories': product_categories,
'barcode': barcode,
}).then(function(response) {}); }).then(function(response) {});
} }
} }

3
pos_product_creation/static/src/js/product_create_popup.js

@ -11,7 +11,6 @@ odoo.define('pos_product_creation.product_create_popup', function(require) {
class ProductCreatePopup extends AbstractAwaitablePopup { class ProductCreatePopup extends AbstractAwaitablePopup {
constructor() { constructor() {
super(...arguments); super(...arguments);
console.log(this.env.pos, '<<<<<<<<<<<<<<<')
this.state = useState({ this.state = useState({
typeValue: this.props.startingValue, typeValue: this.props.startingValue,
productValue: this.props.startingValue, productValue: this.props.startingValue,
@ -27,12 +26,14 @@ odoo.define('pos_product_creation.product_create_popup', function(require) {
var price = this.state.priceValue; var price = this.state.priceValue;
var unit = this.state.unitValue; var unit = this.state.unitValue;
var product_category = this.state.categoryValue; var product_category = this.state.categoryValue;
var barcode = this.state.barcodeValue;
selected_vals.push(category); selected_vals.push(category);
selected_vals.push(product); selected_vals.push(product);
selected_vals.push(product_reference); selected_vals.push(product_reference);
selected_vals.push(price); selected_vals.push(price);
selected_vals.push(unit); selected_vals.push(unit);
selected_vals.push(product_category); selected_vals.push(product_category);
selected_vals.push(barcode);
return selected_vals return selected_vals
} }
} }

9
pos_product_creation/static/src/xml/product_create_popup.xml

@ -75,6 +75,15 @@
</select> </select>
</div> </div>
</div> </div>
<br/>
<div class="row">
<div>
<span>Barcode</span>
</div>
<div style="margin-top: 10px;">
<input class="barcode" type="text" t-model="state.barcodeValue"/>
</div>
</div>
</main> </main>
<footer class="footer"> <footer class="footer">
<div style="color: white;background: #6EC89B;border-color: transparent;" class="button confirm" <div style="color: white;background: #6EC89B;border-color: transparent;" class="button confirm"

Loading…
Cancel
Save