Adil Houmadi
10 years ago
8 changed files with 382 additions and 30 deletions
-
5pos_pricelist/__openerp__.py
-
95pos_pricelist/demo/pos_pricelist_demo.yml
-
46pos_pricelist/static/src/css/style.css
-
2pos_pricelist/static/src/js/db.js
-
63pos_pricelist/static/src/js/models.js
-
164pos_pricelist/static/src/js/tests.js
-
27pos_pricelist/test/test.py
-
6pos_pricelist/views/pos_pricelist_template.xml
@ -0,0 +1,95 @@ |
|||
- |
|||
This product will have two rule (min_qty:3 => 10%, min_qty:5 => 30%) |
|||
- |
|||
!record {model: product.product, id: pos_product_product_1}: |
|||
default_code: ABC123 |
|||
name: POS Product 1 |
|||
type: product |
|||
categ_id: product.product_category_1 |
|||
list_price: 100.0 |
|||
standard_price: 50.0 |
|||
uom_id: product.product_uom_unit |
|||
uom_po_id: product.product_uom_unit |
|||
available_in_pos: True |
|||
|
|||
- |
|||
This product will have one rule (min_qty:2 => 10%) |
|||
- |
|||
!record {model: product.product, id: pos_product_product_2}: |
|||
default_code: ABC124 |
|||
name: POS Product 2 |
|||
type: product |
|||
categ_id: product.product_category_1 |
|||
list_price: 100.0 |
|||
standard_price: 100.0 |
|||
uom_id: product.product_uom_unit |
|||
uom_po_id: product.product_uom_unit |
|||
available_in_pos: True |
|||
|
|||
- |
|||
This product will have a rule that (based on supplier discount) |
|||
- |
|||
!record {model: product.product, id: pos_product_product_3}: |
|||
default_code: ABC125 |
|||
name: POS Product 3 |
|||
type: product |
|||
categ_id: product.product_category_1 |
|||
list_price: 100.0 |
|||
standard_price: 50.0 |
|||
uom_id: product.product_uom_unit |
|||
uom_po_id: product.product_uom_unit |
|||
available_in_pos: True |
|||
seller_ids: |
|||
- delay: 1 |
|||
name: base.res_partner_3 |
|||
pricelist_ids: |
|||
- min_quantity : 2.0 |
|||
price : 80 |
|||
|
|||
- |
|||
This product belgon to computer category (5% dicount) |
|||
- |
|||
!record {model: product.product, id: pos_product_product_4}: |
|||
default_code: ABC125 |
|||
name: POS Product 4 |
|||
type: product |
|||
categ_id: product.product_category_4 |
|||
list_price: 100.0 |
|||
standard_price: 50.0 |
|||
uom_id: product.product_uom_unit |
|||
uom_po_id: product.product_uom_unit |
|||
available_in_pos: True |
|||
- |
|||
Prepare pricelist items |
|||
- |
|||
!record {model: product.pricelist.version, id: product.ver0}: |
|||
items_id: |
|||
- name: 10% Discount on POS Product 1 (Qty 3) |
|||
sequence: 2 |
|||
product_id: pos_product_product_1 |
|||
base: 1 |
|||
price_discount: -0.10 |
|||
min_quantity: 3 |
|||
- name: 30% Discount on POS Product 1 (Qty 5) |
|||
sequence: 1 |
|||
product_id: pos_product_product_1 |
|||
min_quantity: 5 |
|||
base: 1 |
|||
price_discount: -0.30 |
|||
- name: 10% Discount (POS Product 2) |
|||
sequence: 1 |
|||
product_id: pos_product_product_2 |
|||
base: 2 |
|||
price_discount: -0.10 |
|||
min_quantity: 2 |
|||
- name: 20% Discount given by supplier |
|||
sequence: 1 |
|||
min_quantity: 2 |
|||
product_id: pos_product_product_3 |
|||
base: -2 |
|||
- name: 5% Discount on all Computer related products (Qty 2) |
|||
sequence: 1 |
|||
min_quantity: 2 |
|||
base: 1 |
|||
categ_id: product.product_category_4 |
|||
price_discount: -0.05 |
@ -0,0 +1,46 @@ |
|||
/****************************************************************************** |
|||
* Point Of Sale - Pricelist for POS Odoo |
|||
* Copyright (C) 2014 Taktik (http://www.taktik.be) |
|||
* @author Adil Houmadi <ah@taktik.be> |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU Affero General Public License as |
|||
* published by the Free Software Foundation, either version 3 of the |
|||
* License, or (at your option) any later version. |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU Affero General Public License for more details. |
|||
* You should have received a copy of the GNU Affero General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
* |
|||
******************************************************************************/ |
|||
.popover { |
|||
position: absolute; |
|||
top: 0; |
|||
left: 0; |
|||
z-index: 1060; |
|||
display: none; |
|||
max-width: 276px; |
|||
padding: 1px; |
|||
text-align: left; |
|||
white-space: normal; |
|||
background-color: #fff; |
|||
-webkit-background-clip: padding-box; |
|||
background-clip: padding-box; |
|||
border: 1px solid #ccc; |
|||
border: 1px solid rgba(0, 0, 0, .2); |
|||
border-radius: 6px; |
|||
-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, .2); |
|||
box-shadow: 0 5px 10px rgba(0, 0, 0, .2); |
|||
} |
|||
.popover-title { |
|||
padding: 8px 14px; |
|||
margin: 0; |
|||
font-size: 14px; |
|||
font-weight: normal; |
|||
line-height: 18px; |
|||
background-color: #f7f7f7; |
|||
border-bottom: 1px solid #ebebeb; |
|||
border-radius: 5px 5px 0 0; |
|||
} |
@ -0,0 +1,164 @@ |
|||
/****************************************************************************** |
|||
* Point Of Sale - Pricelist for POS Odoo |
|||
* Copyright (C) 2014 Taktik (http://www.taktik.be)
|
|||
* @author Adil Houmadi <ah@taktik.be> |
|||
* |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU Affero General Public License as |
|||
* published by the Free Software Foundation, either version 3 of the |
|||
* License, or (at your option) any later version. |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU Affero General Public License for more details. |
|||
* You should have received a copy of the GNU Affero General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
* |
|||
******************************************************************************/ |
|||
(function () { |
|||
'use strict'; |
|||
|
|||
openerp.Tour.register({ |
|||
id: 'pos_pricelist_order', |
|||
name: 'Complete a order trough the Front-End using POS Pricelist', |
|||
path: '/web#model=pos.session.opening&action=point_of_sale.action_pos_session_opening', |
|||
mode: 'test', |
|||
steps: [ |
|||
{ |
|||
wait: 2000, |
|||
title: 'Wait for screen to be ready' |
|||
}, |
|||
{ |
|||
wait: 2000, |
|||
title: 'Load the Session', |
|||
waitNot: '.oe_loading:visible', |
|||
element: 'span:contains("Resume Session"),span:contains("Start Session")' |
|||
}, |
|||
{ |
|||
title: 'Loading Screen', |
|||
waitFor: '.loader' |
|||
}, |
|||
{ |
|||
wait: 2000, |
|||
title: 'The Point of Sale', |
|||
waitFor: '.pos' |
|||
}, |
|||
{ |
|||
title: "We will buy some Products!, let's add (POS Product 1)", |
|||
element: '.product-list .product-name:contains("POS Product 1")' |
|||
}, |
|||
{ |
|||
wait: 5000, |
|||
title: 'The order total has been updated to the correct value : 100€', |
|||
waitFor: '.order .total .value:contains("100.00 €")' |
|||
}, |
|||
{ |
|||
wait: 5000, |
|||
title: 'We will add one more unit!', |
|||
element: '.product-list .product-name:contains("POS Product 1")' |
|||
}, |
|||
{ |
|||
wait: 4000, |
|||
title: 'We will add another unit', |
|||
element: '.product-list .product-name:contains("POS Product 1")' |
|||
}, |
|||
{ |
|||
wait: 4000, |
|||
title: 'The order total should be updated : 270€ which means 90€/Unit (Rule 10% Discount from 3 Units)', |
|||
waitFor: '.order .total .value:contains("270.00 €")' |
|||
}, |
|||
{ |
|||
wait: 8000, |
|||
title: 'We will add another product', |
|||
element: '.product-list .product-name:contains("POS Product 2")' |
|||
}, |
|||
{ |
|||
wait: 4000, |
|||
title: 'We will add another unit for this product (POS Product 2)', |
|||
element: '.product-list .product-name:contains("POS Product 2")' |
|||
}, |
|||
{ |
|||
wait: 4000, |
|||
title: "Let's verify the total that we should pay, it's should be equal to : 450€, which means that <br>" + |
|||
"10% Discount if offered if we buy 2 units of (POS Product 2), Rule based on standard price", |
|||
waitFor: '.order .total .value:contains("450.00 €")' |
|||
}, |
|||
{ |
|||
wait: 10000, |
|||
title: "Now, we will add (POS Product 3), for this product if we buy more then 2 units <br>" + |
|||
"20% Discount is given by supplier to our customers", |
|||
element: '.product-list .product-name:contains("POS Product 3")' |
|||
}, |
|||
{ |
|||
wait: 10000, |
|||
title: 'We will add another unit for this product (POS Product 3)', |
|||
element: '.product-list .product-name:contains("POS Product 3")' |
|||
}, |
|||
{ |
|||
wait: 5000, |
|||
title: "Let's check the total (610€)", |
|||
waitFor: '.order .total .value:contains("610.00 €")' |
|||
}, |
|||
{ |
|||
wait: 5000, |
|||
title: "Now, we will add (POS Product 4), this product belong to (Comptuer) category in which " + |
|||
"we apply 5% if customer buy more then 2 products", |
|||
element: '.product-list .product-name:contains("POS Product 4")' |
|||
}, |
|||
{ |
|||
wait: 10000, |
|||
title: 'We will add another unit for this product (POS Product 4)', |
|||
element: '.product-list .product-name:contains("POS Product 4")' |
|||
}, |
|||
{ |
|||
wait: 5000, |
|||
title: "Let's check the total again (800€)", |
|||
waitFor: '.order .total .value:contains("800.00 €")' |
|||
}, |
|||
{ |
|||
wait: 5000, |
|||
title: "Let's pay the order", |
|||
element: ".paypad-button:contains('Bank')" |
|||
}, |
|||
{ |
|||
wait: 1000, |
|||
title: "Let's accept the payment", |
|||
onload: function () { |
|||
window._print = window.print; |
|||
window.print = function () { |
|||
console.log('Print!') |
|||
}; |
|||
}, |
|||
element: ".button .iconlabel:contains('Validate'):visible" |
|||
}, |
|||
{ |
|||
wait: 1000, |
|||
title: "Let's finish the order", |
|||
element: ".button:not(.disabled) .iconlabel:contains('Next'):visible" |
|||
}, |
|||
{ |
|||
wait: 1000, |
|||
onload: function () { |
|||
window.print = window._print; |
|||
window._print = undefined; |
|||
}, |
|||
title: "Let's wait for the order posting", |
|||
waitFor: ".oe_status.js_synch .js_connected:visible" |
|||
}, |
|||
{ |
|||
wait: 1000, |
|||
title: "Let's close the Point of Sale", |
|||
element: ".header-button:contains('Close')" |
|||
}, |
|||
{ |
|||
title: "Let's confirm", |
|||
element: ".header-button.confirm:contains('Confirm')" |
|||
}, |
|||
{ |
|||
title: "Wait for the backend to ready itself", |
|||
element: 'span:contains("Resume Session"),span:contains("Start Session")' |
|||
} |
|||
] |
|||
}); |
|||
|
|||
})(); |
@ -0,0 +1,27 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# Point Of Sale - Pricelist for POS Odoo |
|||
# Copyright (C) 2014 Taktik (http://www.taktik.be) |
|||
# @author Adil Houmadi <ah@taktik.be> |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# it under the terms of the GNU Affero General Public License as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU Affero General Public License for more details. |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
import openerp.tests |
|||
|
|||
@openerp.tests.common.at_install(False) |
|||
@openerp.tests.common.post_install(True) |
|||
class TestPOS(openerp.tests.HttpCase): |
|||
def test_01_pos(self): |
|||
self.phantom_js("/", "openerp.Tour.run('pos_pricelist_order', 'test')", |
|||
"openerp.Tour.tours.pos_pricelist_order", |
|||
login="admin") |
Write
Preview
Loading…
Cancel
Save
Reference in new issue