[FIX] point_of_sale: save and close crash adding product in point of sale
lp bug: https://launchpad.net/bugs/666592 fixed bzr revid: pso@tinyerp.com-20101115135905-koh2e5ojh6a7rd6r
This commit is contained in:
@@ -48,8 +48,9 @@
|
||||
</group>
|
||||
|
||||
<separator colspan="4"/>
|
||||
<group colspan="4" col="6">
|
||||
<group colspan="4" col="8">
|
||||
<field name="state" />
|
||||
<button name="%(action_add_product)d" string="Add product" type="action" icon="gtk-ok" states="draft"/>
|
||||
<button name="%(action_pos_payment)d" string="Make Payment" icon="terp-dolar" type="action" states="draft,advance" />
|
||||
<button name="%(action_report_pos_receipt)d" string="Reprint" icon="gtk-print" type="action" states="paid,done,invoiced"/>
|
||||
<button name="set_to_draft" string="Set to draft" states="paid" icon="gtk-execute" type="object" />
|
||||
|
||||
@@ -76,21 +76,22 @@ class add_product(osv.osv_memory):
|
||||
context = {}
|
||||
record_id = context and context.get('active_id', False)
|
||||
order_obj= self.pool.get('pos.order')
|
||||
this = self.browse(cr, uid, ids[0], context)
|
||||
order_obj.add_product(cr, uid, record_id, this.product_id.id, this.quantity, context=context)
|
||||
|
||||
obj = order_obj.browse(cr, uid, record_id, context=context)
|
||||
order_obj.write(cr, uid, [record_id], {'state': 'done'}, context=context)
|
||||
if obj.amount_total != obj.amount_paid:
|
||||
return {
|
||||
'name': _('Make Payment'),
|
||||
'context': context and context.get('active_id', False),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'pos.make.payment',
|
||||
'view_id': False,
|
||||
'target': 'new',
|
||||
'views': False,
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
return {}
|
||||
return {
|
||||
'name': _('Make Payment'),
|
||||
'context': context and context.get('active_id', False),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'pos.make.payment',
|
||||
'view_id': False,
|
||||
'target': 'new',
|
||||
'views': False,
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
|
||||
add_product()
|
||||
|
||||
|
||||
@@ -340,8 +340,11 @@ class add_product(osv.osv_memory):
|
||||
date_cur=time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
uom_obj = self.pool.get('product.uom')
|
||||
return_boj=self.pool.get('pos.return')
|
||||
return_id=return_boj.search(cr,uid,[])
|
||||
data=return_boj.read(cr,uid,return_id,[])[0]
|
||||
return_id = return_boj.search(cr,uid,[])
|
||||
data = {}
|
||||
if return_id:
|
||||
data = return_boj.read(cr,uid,return_id,[])[0]
|
||||
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
self_data = self.read(cr, uid, ids)[0]
|
||||
order_obj.add_product(cr, uid, active_ids[0], self_data['product_id'], self_data['quantity'], context=context)
|
||||
|
||||
Reference in New Issue
Block a user