mirror of
https://github.com/bringout/oca-technical.git
synced 2026-04-19 11:52:00 +02:00
Initial commit: OCA Technical packages (595 packages)
This commit is contained in:
commit
2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions
|
|
@ -0,0 +1,2 @@
|
|||
from . import pos_config
|
||||
from . import pos_session
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
from odoo import fields, models
|
||||
|
||||
|
||||
class PosConfig(models.Model):
|
||||
_inherit = "pos.config"
|
||||
|
||||
group_negative_qty_id = fields.Many2one(
|
||||
comodel_name="res.groups",
|
||||
compute="_compute_groups",
|
||||
string="Point of Sale - Allow Negative Quantity",
|
||||
help="This field is there to pass the id of the 'PoS - Allow Negative"
|
||||
" Quantity' Group to the Point of Sale Frontend.",
|
||||
)
|
||||
|
||||
group_discount_id = fields.Many2one(
|
||||
comodel_name="res.groups",
|
||||
compute="_compute_groups",
|
||||
string="Point of Sale - Allow Discount",
|
||||
help="This field is there to pass the id of the 'PoS - Allow Discount'"
|
||||
" Group to the Point of Sale Frontend.",
|
||||
)
|
||||
|
||||
group_change_unit_price_id = fields.Many2one(
|
||||
comodel_name="res.groups",
|
||||
compute="_compute_groups",
|
||||
string="Point of Sale - Allow Unit Price Change",
|
||||
help="This field is there to pass the id of the 'PoS - Allow Unit"
|
||||
" Price Change' Group to the Point of Sale Frontend.",
|
||||
)
|
||||
|
||||
group_multi_order_id = fields.Many2one(
|
||||
comodel_name="res.groups",
|
||||
compute="_compute_groups",
|
||||
string="Point of Sale - Many Orders",
|
||||
help="This field is there to pass the id of the 'PoS - Many Orders"
|
||||
" Group to the Point of Sale Frontend.",
|
||||
)
|
||||
|
||||
group_delete_order_id = fields.Many2one(
|
||||
comodel_name="res.groups",
|
||||
compute="_compute_groups",
|
||||
string="Point of Sale - Delete Order",
|
||||
help="This field is there to pass the id of the 'PoS - Delete Order'"
|
||||
" Group to the Point of Sale Frontend.",
|
||||
)
|
||||
|
||||
group_payment_id = fields.Many2one(
|
||||
comodel_name="res.groups",
|
||||
compute="_compute_groups",
|
||||
string="Point of Sale - Payment",
|
||||
help="This field is there to pass the id of the 'PoS - Payment'"
|
||||
" Group to the Point of Sale Frontend.",
|
||||
)
|
||||
|
||||
def _compute_groups(self):
|
||||
self.update(
|
||||
{
|
||||
"group_negative_qty_id": self.env.ref(
|
||||
"pos_access_right.group_negative_qty"
|
||||
).id,
|
||||
"group_discount_id": self.env.ref("pos_access_right.group_discount").id,
|
||||
"group_change_unit_price_id": self.env.ref(
|
||||
"pos_access_right.group_change_unit_price"
|
||||
).id,
|
||||
"group_multi_order_id": self.env.ref(
|
||||
"pos_access_right.group_multi_order"
|
||||
).id,
|
||||
"group_delete_order_id": self.env.ref(
|
||||
"pos_access_right.group_delete_order"
|
||||
).id,
|
||||
"group_payment_id": self.env.ref("pos_access_right.group_payment").id,
|
||||
}
|
||||
)
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
from odoo import models
|
||||
|
||||
|
||||
class PosSession(models.Model):
|
||||
_inherit = "pos.session"
|
||||
|
||||
def _get_pos_ui_res_users(self, params):
|
||||
user_vals = super()._get_pos_ui_res_users(params)
|
||||
user_id = user_vals.get("id")
|
||||
if user_id:
|
||||
user = self.env["res.users"].browse(user_id)
|
||||
groups = user.groups_id
|
||||
config = self.config_id
|
||||
user_vals.update(
|
||||
hasGroupPayment=config.group_payment_id in groups,
|
||||
hasGroupDiscount=config.group_discount_id in groups,
|
||||
hasGroupNegativeQty=config.group_negative_qty_id in groups,
|
||||
hasGroupPriceControl=config.group_change_unit_price_id in groups,
|
||||
hasGroupMultiOrder=config.group_multi_order_id in groups,
|
||||
hasGroupDeleteOrder=config.group_delete_order_id in groups,
|
||||
)
|
||||
return user_vals
|
||||
Loading…
Add table
Add a link
Reference in a new issue