File tree 7 files changed +127
-0
lines changed
pos_require_product_quantity
7 files changed +127
-0
lines changed Original file line number Diff line number Diff line change
1
+ from . import models
Original file line number Diff line number Diff line change
1
+ # coding: utf-8
2
+ # Copyright 2019 Coop IT Easy SCRLfs
3
+ # Robin Keunen <[email protected] >
4
+ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
5
+ {
6
+ "name" : "Require Product Quantity in POS" ,
7
+ "version" : "9.0.0.1.0" ,
8
+ "author" : "Coop IT Easy SCRLfs, Odoo Community Association (OCA)" ,
9
+ "website" : "www.coopiteasy.be" ,
10
+ "license" : "AGPL-3" ,
11
+ "category" : "Point of Sale" ,
12
+ "summary" : """
13
+ A popup is shown if product quantity is set to 0 for one or more order
14
+ lines when clicking on "Payment" button.
15
+ """ ,
16
+ "depends" : [
17
+ 'point_of_sale' ,
18
+ ],
19
+ 'data' : [
20
+ 'views/pos_config.xml' ,
21
+ 'static/src/xml/templates.xml' ,
22
+ ],
23
+ 'installable' : True ,
24
+ }
Original file line number Diff line number Diff line change
1
+ from . import pos_config
Original file line number Diff line number Diff line change
1
+ # -*- coding: utf-8 -*-
2
+ # © 2016 Robin Keunen, Coop IT Easy SCRL fs
3
+ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
4
+
5
+
6
+ from openerp import models , fields
7
+
8
+
9
+ class PosConfig (models .Model ):
10
+ _inherit = 'pos.config'
11
+
12
+ require_product_quantity = fields .Boolean (
13
+ string = 'Require product quantity in POS' ,
14
+ default = False ,
15
+ )
Original file line number Diff line number Diff line change
1
+ /*
2
+ Copyright 2019 Coop IT Easy SCRLfs
3
+
4
+ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
5
+ */
6
+
7
+ odoo . define (
8
+
9
+ 'pos_require_product_quantity.pos_require_product_quantity' ,
10
+ function ( require ) {
11
+ "use strict" ;
12
+
13
+ var core = require ( 'web.core' ) ;
14
+ var screens = require ( "point_of_sale.screens" ) ;
15
+
16
+ var _t = core . _t ;
17
+
18
+ screens . ActionpadWidget = screens . ActionpadWidget . include ( {
19
+ renderElement : function ( ) {
20
+ var self = this ;
21
+ this . _super ( ) ;
22
+
23
+ this . $ ( '.pay' ) . click ( function ( ) {
24
+
25
+ if ( self . pos . config . require_product_quantity ) {
26
+
27
+ var orderlines = self . pos . get_order ( ) . orderlines ;
28
+ var qty_unset_list = [ ] ;
29
+
30
+ for ( var i = 0 ; i < orderlines . length ; i ++ ) {
31
+ var line = orderlines . models [ i ] ;
32
+ if ( line . quantity === 0 ) {
33
+ qty_unset_list . push ( line ) ;
34
+ }
35
+ }
36
+ if ( qty_unset_list . length > 0 ) {
37
+ self . gui . back ( ) ;
38
+ var body = _t ( 'No quantity set for products:' ) ;
39
+ for ( var j = 0 ; j < qty_unset_list . length ; j ++ ) {
40
+ body = (
41
+ body
42
+ + ' - '
43
+ + qty_unset_list [ j ] . product . display_name
44
+ ) ;
45
+ }
46
+ self . gui . show_popup (
47
+ 'alert' ,
48
+ {
49
+ 'title' : _t ( 'Missing quantities' ) ,
50
+ 'body' : body ,
51
+ } ,
52
+ ) ;
53
+ }
54
+ }
55
+ } ) ;
56
+ }
57
+ } )
58
+ }
59
+ ) ;
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" utf-8" ?>
2
+ <odoo >
3
+ <data >
4
+ <template id =" assets_backend" name =" pos_require_product_quantity_extension_assets" inherit_id =" web.assets_backend" >
5
+ <xpath expr =" ." position =" inside" >
6
+ <script type =" text/javascript"
7
+ src =" /pos_require_product_quantity/static/src/js/pos.js" >
8
+ </script >
9
+ </xpath >
10
+ </template >
11
+ </data >
12
+ </odoo >
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" ?>
2
+ <odoo >
3
+
4
+ <record id =" view_pos_config_form" model =" ir.ui.view" >
5
+ <field name =" name" >pos.config.form.view.inherit</field >
6
+ <field name =" model" >pos.config</field >
7
+ <field name =" inherit_id" ref =" point_of_sale.view_pos_config_form" />
8
+ <field name =" arch" type =" xml" >
9
+ <field name =" tip_product_id" position =" after" >
10
+ <field name =" require_product_quantity" />
11
+ </field >
12
+ </field >
13
+ </record >
14
+
15
+ </odoo >
You can’t perform that action at this time.
0 commit comments