[FIX] lunch: yml issue

bzr revid: hmo@tinyerp.com-20100901095339-mxashqfc4k3dwi3n
This commit is contained in:
Harry (OpenERP) 2010-09-01 15:23:39 +05:30
parent 34f623bd25
commit f3684e9274
2 changed files with 36 additions and 36 deletions

View File

@ -87,6 +87,30 @@
-
!assert {model: lunch.cashbox, id: lunch_cashbox_cashbox0}:
- sum_remain == -5.50
- |
I cancel the order "LU002"
-
!record {model: lunch.order.cancel, id: lunch_order_cancel_0}:
{}
- |
I click on "Yes" button of this wizard for cancel order.
-
!python {model: lunch.order.cancel}: |
self.cancel(cr, uid, [ref('lunch_order_cancel_0')], {'active_ids': [ref('lunch_order_1')]})
- |
I test that the Cash Moves record have been removed for the order LU002.
-
!assert {model: lunch.order, id: lunch_order_1}:
- cashmove.id == False
- |
I check that the Total on the "Employee Cashbox" is -2.75
-
!assert {model: lunch.cashbox, id: lunch_cashbox_cashbox0}:
- sum_remain == -2.75
- |
I reset the "Employee Cashbox" to zero using the "Set CashBox to Zero" wizard.
-
@ -103,28 +127,4 @@
-
!assert {model: lunch.cashbox, id: lunch_cashbox_cashbox0}:
- sum_remain == 0.00
- |
I cancel the order "LU002"
-
!record {model: lunch.order.cancel, id: lunch_order_cancel_0}:
{}
- |
I click on "Yes" button of this wizard for cancel order.
-
!python {model: lunch.order.cancel}: |
self.cancel(cr, uid, [ref('lunch_order_cancel_0')], {'active_ids': [ref('lunch_order_1')]})
- |
I test that the Cash Moves revord have been removed for the order LU002.
-
!assert {model: lunch.order, id: lunch_order_1}:
- cashmove.id == False
- |
I check that the Total on the "Employee Cashbox" is -2.75
-
!assert {model: lunch.cashbox, id: lunch_cashbox_cashbox0}:
- sum_remain == -2.75

View File

@ -35,10 +35,9 @@ class lunch_cashbox_clean(osv.osv_memory):
@param ids: List Lunch cashbox Cleans IDs
@return:Dictionary {}.
"""
#TOFIX: use orm methods
data = context and context.get('active_ids', []) or []
cashmove_ref = self.pool.get('lunch.cashmove')
cr.execute("select user_cashmove, box,sum(amount) from lunch_cashmove \
where active = 't' and box IN %s group by user_cashmove, \
box" , (tuple(data),))
@ -46,15 +45,16 @@ class lunch_cashbox_clean(osv.osv_memory):
cr.execute("update lunch_cashmove set active = 'f' where active= 't' \
and box IN %s" , (tuple(data),))
for (user_id, box_id, amount) in res:
cashmove_ref.create(cr, uid, {
'name': 'Summary for user' + str(user_id),
'amount': amount,
'user_cashmove': user_id,
'box': box_id,
'active': True,
})
#TOCHECK: Why need to create duplicate entry after clean box ?
#for (user_id, box_id, amount) in res:
# cashmove_ref.create(cr, uid, {
# 'name': 'Summary for user' + str(user_id),
# 'amount': amount,
# 'user_cashmove': user_id,
# 'box': box_id,
# 'active': True,
# })
return {}
lunch_cashbox_clean()