@ -1,15 +1,19 @@ |
|||||
<?xml version="1.0" encoding="UTF-8" ?> |
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<odoo> |
<odoo> |
||||
|
<!-- Record for Refund in model pos.button--> |
||||
<record id="refund_pos_buttons" model="pos.buttons"> |
<record id="refund_pos_buttons" model="pos.buttons"> |
||||
<field name="name">Refund</field> |
<field name="name">Refund</field> |
||||
</record> |
</record> |
||||
|
<!-- Record for Price in model pos.button--> |
||||
<record id="pos_price_buttons" model="pos.buttons"> |
<record id="pos_price_buttons" model="pos.buttons"> |
||||
<field name="name">Price</field> |
<field name="name">Price</field> |
||||
</record> |
</record> |
||||
|
<!-- Record for Discount in model pos.button--> |
||||
<record id="pos_discount_buttons" model="pos.buttons"> |
<record id="pos_discount_buttons" model="pos.buttons"> |
||||
<field name="name">Discount</field> |
<field name="name">Discount</field> |
||||
</record> |
</record> |
||||
|
<!-- Record for Reward in model pos.button--> |
||||
<record id="pos_reward_buttons" model="pos.buttons"> |
<record id="pos_reward_buttons" model="pos.buttons"> |
||||
<field name="name">Reward</field> |
<field name="name">Reward</field> |
||||
</record> |
</record> |
||||
</odoo> |
</odoo> |
|
Before Width: | Height: | Size: 1.3 MiB |
Before Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 84 KiB |
Before Width: | Height: | Size: 81 KiB |
Before Width: | Height: | Size: 83 KiB |
After Width: | Height: | Size: 72 KiB |
After Width: | Height: | Size: 78 KiB |
After Width: | Height: | Size: 82 KiB |
After Width: | Height: | Size: 91 KiB |
After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 83 KiB |
Before Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 102 KiB |
Before Width: | Height: | Size: 87 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 1.4 KiB |
@ -0,0 +1,54 @@ |
|||||
|
odoo.define('pos_button_visibility.RefundButton', function (require) { |
||||
|
'use strict'; |
||||
|
const Registries = require('point_of_sale.Registries'); |
||||
|
const RefundButton = require('point_of_sale.RefundButton'); |
||||
|
var rpc = require('web.rpc'); |
||||
|
var { PosGlobalState } = require('point_of_sale.models'); |
||||
|
/** Extends PosGlobalState to load model to pos **/ |
||||
|
const PosSessionGlobalState = (PosGlobalState) => class PosSessionGlobalState extends PosGlobalState { |
||||
|
async _processData(loadedData) { |
||||
|
await super._processData(loadedData); |
||||
|
this.res_user = loadedData['res.users']; |
||||
|
this.user_session = loadedData['user_session_ids']; |
||||
|
this.buttons_pos = loadedData['buttons_pos_ids'] |
||||
|
} |
||||
|
} |
||||
|
Registries.Model.extend(PosGlobalState, PosSessionGlobalState); |
||||
|
/** Extend RefundButton to add function **/ |
||||
|
const PosButton = (RefundButton) => |
||||
|
class extends RefundButton { |
||||
|
/** To set up the RefundButton **/ |
||||
|
setup() { |
||||
|
super.setup(...arguments); |
||||
|
this.env.pos.user_session = [] |
||||
|
this.env.pos.button =[] |
||||
|
this.userItem() |
||||
|
} |
||||
|
/** This is used to get the sessions and buttons**/ |
||||
|
async userItem(){ |
||||
|
var session; |
||||
|
if (this.env.pos.res_user.length !== 0) |
||||
|
{ |
||||
|
var session = this.env.pos.res_user.user_session_ids;} |
||||
|
else{ |
||||
|
session = false |
||||
|
} |
||||
|
var buttons; |
||||
|
if (this.env.pos.res_user.length !== 0) |
||||
|
{ |
||||
|
var buttons = this.env.pos.res_user.buttons_pos_ids;} |
||||
|
else{ |
||||
|
buttons = false |
||||
|
} |
||||
|
var def = await rpc.query({ |
||||
|
model: 'res.users', |
||||
|
method: 'pos_button_visibility', |
||||
|
args: [,buttons] |
||||
|
}) |
||||
|
this.env.pos.user_session = session |
||||
|
this.env.pos.button = def |
||||
|
} |
||||
|
}; |
||||
|
Registries.Component.extend(RefundButton, PosButton) |
||||
|
return RefundButton |
||||
|
}); |
@ -1,52 +0,0 @@ |
|||||
odoo.define('pos_all_in_one.refund', function (require) { |
|
||||
'use strict'; |
|
||||
const Registries = require('point_of_sale.Registries'); |
|
||||
const RefundButton = require('point_of_sale.RefundButton'); |
|
||||
var rpc = require('web.rpc'); |
|
||||
var { PosGlobalState } = require('point_of_sale.models'); |
|
||||
const PosSessionGlobalState = (PosGlobalState) => class PosSessionGlobalState extends PosGlobalState { |
|
||||
//@override
|
|
||||
async _processData(loadedData) { |
|
||||
await super._processData(loadedData); |
|
||||
this.res_user = loadedData['res.users']; |
|
||||
this.user_session = loadedData['user_session_ids']; |
|
||||
this.buttons_pos = loadedData['buttons_pos_ids'] |
|
||||
} |
|
||||
} |
|
||||
Registries.Model.extend(PosGlobalState, PosSessionGlobalState); |
|
||||
const PosButton = (RefundButton) => |
|
||||
class extends RefundButton { |
|
||||
setup() { |
|
||||
super.setup(...arguments); |
|
||||
this.env.pos.user_session = [] |
|
||||
this.env.pos.button =[] |
|
||||
this.userItem() |
|
||||
} |
|
||||
//This is used to get the sessions and buttons
|
|
||||
async userItem(){ |
|
||||
var session; |
|
||||
if (this.env.pos.res_user.length !== 0) |
|
||||
{ |
|
||||
var session = this.env.pos.res_user.user_session_ids;} |
|
||||
else{ |
|
||||
session = false |
|
||||
} |
|
||||
var buttons; |
|
||||
if (this.env.pos.res_user.length !== 0) |
|
||||
{ |
|
||||
var buttons = this.env.pos.res_user.buttons_pos_ids;} |
|
||||
else{ |
|
||||
buttons = false |
|
||||
} |
|
||||
var def = await rpc.query({ |
|
||||
model: 'res.users', |
|
||||
method: 'pos_button_visibility', |
|
||||
args: [,buttons] |
|
||||
}) |
|
||||
this.env.pos.user_session = session |
|
||||
this.env.pos.button = def |
|
||||
} |
|
||||
}; |
|
||||
Registries.Component.extend(RefundButton, PosButton) |
|
||||
return RefundButton |
|
||||
}); |
|
@ -1,6 +1,6 @@ |
|||||
<?xml version="1.0" encoding="UTF-8" ?> |
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<templates id="template" xml:space="preserve"> |
<templates id="template" xml:space="preserve"> |
||||
<!-- This is used to restrict the REFUND button if it is restricted --> |
<!-- This is used to restrict the reward button if it is restricted --> |
||||
<t t-name="DisableReward" t-inherit="pos_loyalty.RewardButton" |
<t t-name="DisableReward" t-inherit="pos_loyalty.RewardButton" |
||||
t-inherit-mode="extension" owl="1"> |
t-inherit-mode="extension" owl="1"> |
||||
<xpath expr="//span" position="replace"> |
<xpath expr="//span" position="replace"> |