Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
odoo
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cooperatic-foodcoops
odoo
Commits
b705e2e6
Commit
b705e2e6
authored
May 11, 2023
by
François C.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#4665 Clear payment lines if return to POS products screen
parent
3d3c67e2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
2 deletions
+59
-2
__openerp__.py
lacagette_addons/lacagette_custom_pos/__openerp__.py
+1
-1
backend.js
...ette_addons/lacagette_custom_pos/static/src/js/backend.js
+38
-1
qweb.xml
...gette_addons/lacagette_custom_pos/static/src/xml/qweb.xml
+20
-0
No files found.
lacagette_addons/lacagette_custom_pos/__openerp__.py
View file @
b705e2e6
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
# Check https://github.com/odoo/odoo/blob/master/openerp/addons/base/module/module_data.xml
# Check https://github.com/odoo/odoo/blob/master/openerp/addons/base/module/module_data.xml
# for the full list
# for the full list
'category'
:
'POS'
,
'category'
:
'POS'
,
'version'
:
'0.0.
1
'
,
'version'
:
'0.0.
2
'
,
# any module necessary for this one to work correctly
# any module necessary for this one to work correctly
'depends'
:
[
'base'
,
'point_of_sale'
],
'depends'
:
[
'base'
,
'point_of_sale'
],
...
...
lacagette_addons/lacagette_custom_pos/static/src/js/backend.js
View file @
b705e2e6
...
@@ -40,9 +40,21 @@ odoo.define('lacagette_custom_pos.DB', function(require) {
...
@@ -40,9 +40,21 @@ odoo.define('lacagette_custom_pos.DB', function(require) {
}
}
});
});
/* Custom behavior on barcode error */
/* Custom behavior on barcode error
and return to products
*/
var
popups
=
require
(
'point_of_sale.popups'
);
var
popups
=
require
(
'point_of_sale.popups'
);
var
gui
=
require
(
'point_of_sale.gui'
);
var
gui
=
require
(
'point_of_sale.gui'
);
let
payment_this
=
null
;
let
empty_payments_lines
=
function
(
self
)
{
// Every payment line is removed (partially taken from odoo/addons/point_of_sale/static/src/js/screens.js)
// payment_this is initialized during screens.PaymentScreenWidget.start()
var
lines
=
payment_this
.
pos
.
get_order
().
get_paymentlines
();
for
(
var
i
=
0
;
i
<
lines
.
length
;
i
++
)
{
payment_this
.
pos
.
get_order
().
remove_paymentline
(
lines
[
i
]);
payment_this
.
reset_input
();
payment_this
.
render_paymentlines
();
}
}
// Custom popup definition
// Custom popup definition
var
CustomErrorBarcodePopupWidget
=
popups
.
extend
({
var
CustomErrorBarcodePopupWidget
=
popups
.
extend
({
...
@@ -64,6 +76,18 @@ odoo.define('lacagette_custom_pos.DB', function(require) {
...
@@ -64,6 +76,18 @@ odoo.define('lacagette_custom_pos.DB', function(require) {
});
});
gui
.
define_popup
({
name
:
'custom-error-barcode'
,
widget
:
CustomErrorBarcodePopupWidget
});
gui
.
define_popup
({
name
:
'custom-error-barcode'
,
widget
:
CustomErrorBarcodePopupWidget
});
var
CustomReturnToOrderMessageWidget
=
popups
.
extend
({
template
:
'CustomReturnToOrderMessageWidget'
,
show
:
function
(
options
)
{
var
self
=
this
;
this
.
_super
(
options
);
this
.
$
(
'.return-to-order'
).
off
(
'click'
).
click
(
function
(){
empty_payments_lines
()
self
.
gui
.
show_screen
(
"products"
);
});
}
});
gui
.
define_popup
({
name
:
'custom-return-to-order'
,
widget
:
CustomReturnToOrderMessageWidget
});
var
screens
=
require
(
'point_of_sale.screens'
);
var
screens
=
require
(
'point_of_sale.screens'
);
...
@@ -113,6 +137,19 @@ odoo.define('lacagette_custom_pos.DB', function(require) {
...
@@ -113,6 +137,19 @@ odoo.define('lacagette_custom_pos.DB', function(require) {
}
}
})
})
/** Init payment screen **/
screens
.
PaymentScreenWidget
.
include
({
start
:
function
()
{
var
self
=
this
;
payment_this
=
self
;
$
(
'.payment-screen .top-content .back'
).
off
();
$
(
document
).
on
(
'click'
,
'.payment-screen .top-content .back'
,
function
(
event
){
self
.
gui
.
show_popup
(
'custom-return-to-order'
);
});
empty_payments_lines
();
}
})
/* Make search input loose focus after 5s without a key press */
/* Make search input loose focus after 5s without a key press */
screens
.
ProductCategoriesWidget
.
include
({
screens
.
ProductCategoriesWidget
.
include
({
// Redefine init function of the widget handling research
// Redefine init function of the widget handling research
...
...
lacagette_addons/lacagette_custom_pos/static/src/xml/qweb.xml
View file @
b705e2e6
...
@@ -25,4 +25,24 @@
...
@@ -25,4 +25,24 @@
</div>
</div>
</div>
</div>
</div>
</div>
<div
t-name=
"CustomReturnToOrderMessageWidget"
>
<div
class=
"modal-dialog"
>
<div
class=
"popup popup-return-warning"
>
<p
class=
"title"
>
Attention !
</p>
<p
class=
"body"
>
Les paiements seront réinitialisés si vous retournez au panier.
</p>
<div
class=
"footer"
>
<div
class=
"button cancel"
>
Annuler
</div>
<div
class=
"button return-to-order"
>
Retour au panier
</div>
</div>
</div>
</div>
</div>
</template>
</template>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment