|
|
|
@@ -1,173 +0,0 @@
|
|
|
|
|
-
|
|
|
|
|
In order to test the Point of Sale in module, I will do a full flow from the sale to the paiement and invoicing.
|
|
|
|
|
-
|
|
|
|
|
I create a PoS with 2 PC1 and 3 PC2.
|
|
|
|
|
-
|
|
|
|
|
!record {model: pos.order, id: pos_order_pos0}:
|
|
|
|
|
company_id: base.main_company
|
|
|
|
|
lines:
|
|
|
|
|
- name: OL/0001
|
|
|
|
|
product_id: product.product_product_pc1
|
|
|
|
|
price_unit: 450
|
|
|
|
|
discount: 0.0
|
|
|
|
|
qty: 2.0
|
|
|
|
|
- name: OL/0002
|
|
|
|
|
product_id: product.product_product_pc2
|
|
|
|
|
price_unit: 300
|
|
|
|
|
discount: 0.0
|
|
|
|
|
qty: 3.0
|
|
|
|
|
-
|
|
|
|
|
I check that the total of the order is equal to 450 * 2 / 300 * 3
|
|
|
|
|
-
|
|
|
|
|
!python {model: pos.order}: |
|
|
|
|
|
order = self.browse(cr, uid, ref('pos_order_pos0'))
|
|
|
|
|
assert(abs(order.amount_total - 1800.0) < 0.01), "The order has a wrong amount"
|
|
|
|
|
-
|
|
|
|
|
I want to add a global discount of 5 percent using the wizard
|
|
|
|
|
-
|
|
|
|
|
!record {model: pos.discount, id: pos_discount_0}:
|
|
|
|
|
discount: 5.0
|
|
|
|
|
-
|
|
|
|
|
I click the apply button to set the discount on all lines
|
|
|
|
|
-
|
|
|
|
|
!python {model: pos.discount}: |
|
|
|
|
|
self.apply_discount(cr, uid, [ref("pos_discount_0")], {"active_model": "pos.order",
|
|
|
|
|
"active_ids": [ref("pos_order_pos0")], "active_id": ref("pos_order_pos0"), })
|
|
|
|
|
-
|
|
|
|
|
I check that the total of the order is not equal to (450 * 2 / 300 * 3)*0.95
|
|
|
|
|
-
|
|
|
|
|
!python {model: pos.order}: |
|
|
|
|
|
order = self.browse(cr, uid, ref('pos_order_pos0'))
|
|
|
|
|
assert(abs(order.amount_total - (450*2+300*3)*0.95) < 0.01), "The order has a wrong amount"
|
|
|
|
|
#-
|
|
|
|
|
# I open the register.
|
|
|
|
|
#-
|
|
|
|
|
# !record {model: pos.open.statement, id: pos_open_statement_0}:
|
|
|
|
|
# {}
|
|
|
|
|
#-
|
|
|
|
|
# I open the statement.
|
|
|
|
|
#-
|
|
|
|
|
# !python {model: pos.open.statement}: |
|
|
|
|
|
# jou_obj = self.pool.get('account.journal')
|
|
|
|
|
# statement_obj = self.pool.get('account.bank.statement')
|
|
|
|
|
# cr.execute("SELECT DISTINCT journal_id FROM pos_journal_users "
|
|
|
|
|
# "WHERE user_id = %s ORDER BY journal_id"% (uid, ))
|
|
|
|
|
# jou_ids = map(lambda x1: x1[0], cr.fetchall())
|
|
|
|
|
# journal_ids = jou_obj.search(cr, uid, [('auto_cash', '=', True), ('type', '=', 'cash'), ('id', 'in', jou_ids)], context=context)
|
|
|
|
|
# ids = statement_obj.search(cr, uid, [('state', '=', 'open'), ('user_id', '=', uid), ('journal_id', 'in', journal_ids)], context=context)
|
|
|
|
|
# if not ids:
|
|
|
|
|
# self.open_statement(cr, uid, [ref("pos_open_statement_0")], {"lang": "en_US", "active_model":
|
|
|
|
|
# "ir.ui.menu", "active_ids": [ref("point_of_sale.menu_open_statement")], "tz":
|
|
|
|
|
# False, "active_id": ref("point_of_sale.menu_open_statement"), })
|
|
|
|
|
#-
|
|
|
|
|
# I click on the "Make Payment" wizard.
|
|
|
|
|
#-
|
|
|
|
|
# !record {model: pos.make.payment, id: pos_make_payment_0}:
|
|
|
|
|
# amount: 1615.0
|
|
|
|
|
# journal: 7
|
|
|
|
|
# payment_date: !eval time.strftime("%Y-%m-%d")
|
|
|
|
|
# payment_name: Payment
|
|
|
|
|
# product_id: product_product_hppaviliondesktoppcs0
|
|
|
|
|
# pricelist_id: product.list0
|
|
|
|
|
# partner_id: base.res_partner_agrolait
|
|
|
|
|
#-
|
|
|
|
|
# I make the payment.
|
|
|
|
|
#-
|
|
|
|
|
# !python {model: pos.make.payment}: |
|
|
|
|
|
# self.check(cr, uid, [ref("pos_make_payment_0")], {"lang": "en_US", "active_model":
|
|
|
|
|
# "pos.order", "active_ids": [ref("point_of_sale.pos_order_pos0")], "tz":
|
|
|
|
|
# False, "active_id": ref("point_of_sale.pos_order_pos0"), })
|
|
|
|
|
#-
|
|
|
|
|
# I check the Statement lines are created automatically when payment is done.
|
|
|
|
|
#-
|
|
|
|
|
# !python {model: pos.order}: |
|
|
|
|
|
# order=self.browse(cr,uid,ref("pos_order_pos0"))
|
|
|
|
|
# assert(order.statement_ids!=[]), "Statement lines not created"
|
|
|
|
|
#-
|
|
|
|
|
# When I click on Return picking button , I get three option.
|
|
|
|
|
#-
|
|
|
|
|
# 1. Cancel 2.Return Goods and Exchange 3.Return without Refund
|
|
|
|
|
#-
|
|
|
|
|
# When I click on Return Goods and Exchange.
|
|
|
|
|
#-
|
|
|
|
|
# Then it allows me to define the quantity of products, which will return to the stock.
|
|
|
|
|
#-
|
|
|
|
|
# I click on Return Picking button.
|
|
|
|
|
#-
|
|
|
|
|
# !record {model: pos.return, id: pos_return_0}:
|
|
|
|
|
# pos_moves_ids:
|
|
|
|
|
# - product_id: product_product_hppaviliondesktoppcs0
|
|
|
|
|
# quantity: 5.0
|
|
|
|
|
#-
|
|
|
|
|
# I Return the product.
|
|
|
|
|
#-
|
|
|
|
|
# !python {model: pos.return}: |
|
|
|
|
|
# self.create_returns(cr, uid, [ref("pos_return_0")], {"lang": "en_US", "active_model":
|
|
|
|
|
# "pos.order", "active_ids": [ref("point_of_sale.pos_order_pos0")], "tz":
|
|
|
|
|
# False, "active_id": ref("point_of_sale.pos_order_pos0"), })
|
|
|
|
|
#-
|
|
|
|
|
# Then it allows me to define the quantity of products, which will return to the stock.
|
|
|
|
|
#-
|
|
|
|
|
# I select the HP Pavilion Desktop PCs for exchange.
|
|
|
|
|
#-
|
|
|
|
|
# !record {model: pos.add.product, id: pos_add_product_0}:
|
|
|
|
|
# product_id: product_product_hppaviliondesktoppcs0
|
|
|
|
|
# quantity: 5.0
|
|
|
|
|
#-
|
|
|
|
|
# I click on close button.
|
|
|
|
|
#-
|
|
|
|
|
# !python {model: pos.add.product}: |
|
|
|
|
|
# return_obj = self.pool.get('pos.return')
|
|
|
|
|
# context['active_ids'] = [ref("pos_order_pos0")]
|
|
|
|
|
# return_obj.view_init(cr, uid, [],context=context)
|
|
|
|
|
# self.close_action(cr, uid, [ref("pos_add_product_0")], {"lang": "en_US", "active_model":
|
|
|
|
|
# "pos.order", "active_ids": [ref("pos_order_pos0")], "tz": False, "active_id": ref("pos_order_pos0"),
|
|
|
|
|
# })
|
|
|
|
|
#-
|
|
|
|
|
# I create payment.
|
|
|
|
|
#-
|
|
|
|
|
# !record {model: pos.make.payment, id: pos_make_payment_1}:
|
|
|
|
|
# amount: 680.0
|
|
|
|
|
# journal: 7
|
|
|
|
|
# payment_date: !eval time.strftime("%Y-%m-%d")
|
|
|
|
|
# payment_name: Payment
|
|
|
|
|
# product_id: product_product_hppaviliondesktoppcs0
|
|
|
|
|
# pricelist_id: product.list0
|
|
|
|
|
# partner_id: base.res_partner_agrolait
|
|
|
|
|
#-
|
|
|
|
|
# For payment, I click on Make Payment.
|
|
|
|
|
#-
|
|
|
|
|
# !python {model: pos.make.payment}: |
|
|
|
|
|
# self.check(cr, uid, [ref("pos_make_payment_1")], {"lang": "en_US", "active_model":
|
|
|
|
|
# "pos.order", "active_ids": [ref("pos_order_pos0")], "tz":
|
|
|
|
|
# False, "active_id": ref("pos_order_pos0"), })
|
|
|
|
|
#-
|
|
|
|
|
# To check the Return without Refund . I click button "Return without Refund ".
|
|
|
|
|
#-
|
|
|
|
|
# !record {model: pos.return, id: pos_return_0}:
|
|
|
|
|
# {}
|
|
|
|
|
#-
|
|
|
|
|
# The quantity which is selected in Return lines wizard is refunded.
|
|
|
|
|
#-
|
|
|
|
|
# !python {model: pos.return}: |
|
|
|
|
|
# self.create_returns2(cr, uid, [ref("pos_return_0")], {"lang": "en_US", "active_model":
|
|
|
|
|
# "pos.order", "active_ids": [ref("pos_order_pos0")], "tz":
|
|
|
|
|
# False, "active_id": ref("pos_order_pos0"), })
|
|
|
|
|
#-
|
|
|
|
|
# To Close order, I use the wizard "Sale Confirm".
|
|
|
|
|
#-
|
|
|
|
|
# !record {model: pos.confirm, id: pos_confirm_0}:
|
|
|
|
|
# {}
|
|
|
|
|
#-
|
|
|
|
|
# I close this order.
|
|
|
|
|
#-
|
|
|
|
|
# !python {model: pos.confirm}: |
|
|
|
|
|
# self.action_confirm(cr, uid, [ref("pos_confirm_0")], {"lang": "en_US", "active_model":
|
|
|
|
|
# "pos.order", "active_ids": [ref("pos_order_pos0")], "tz": False, "active_id": ref("pos_order_pos0"),
|
|
|
|
|
# })
|
|
|
|
|
#-
|
|
|
|
|
# I check order state is done.
|
|
|
|
|
#-
|
|
|
|
|
# !python {model: pos.order}: |
|
|
|
|
|
# order=self.browse(cr,uid,ref("pos_order_pos0"))
|
|
|
|
|
# assert(order.state=='done'), "Order is not done"
|