Task 578 : Improve the code,Task :581 Convert wizard_return into osv_memory
bzr revid: sbh@tinyerp.com-20100427121803-7y0wv8quy11264ko
This commit is contained in:
@@ -62,8 +62,9 @@ Main features :
|
||||
'wizard/pos_payment_report.xml',
|
||||
'wizard/pos_payment.xml',
|
||||
'wizard/pos_scan_product_view.xml',
|
||||
'wizard/pos_return_view.xml',
|
||||
'pos_report.xml',
|
||||
'pos_wizard.xml',
|
||||
# 'pos_wizard.xml',
|
||||
'pos_view.xml',
|
||||
'pos_sequence.xml',
|
||||
'posrule_data.xml',
|
||||
|
||||
@@ -64,8 +64,8 @@
|
||||
<button name="%(action_pos_payment)d" string="Ma_ke Payment" icon="gtk-ok" type="action" states="draft,advance" context="{'record_id':'active_id'}" />
|
||||
<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" />
|
||||
<button name="%(pos_return_picking)d" string="Return Picking" type="action" icon="gtk-ok" states="paid"
|
||||
attrs="{'invisible':[('state','!=','paid'),('state','!=','invoiced')]}"/>
|
||||
<button name="%(action_view_pos_return)d" string="Return Picking" type="action" icon="gtk-ok" states="paid"
|
||||
attrs="{'invisible':[('state','!=','paid'),('state','!=','invoiced')]}" context="{'record_id':'active_id'}" />
|
||||
</group>
|
||||
</page>
|
||||
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<wizard
|
||||
id="pos_return_picking"
|
||||
model="pos.order"
|
||||
menu="False"
|
||||
name="pos.return.picking"
|
||||
string="Return Goods"/>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
import wizard_return
|
||||
|
||||
import pos_add_product
|
||||
import pos_confirm
|
||||
import pos_discount
|
||||
@@ -39,6 +39,7 @@ import pos_payment_report_date
|
||||
import pos_payment_report
|
||||
import pos_payment
|
||||
import pos_scan_product
|
||||
import pos_return
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -61,7 +61,27 @@ class add_product(osv.osv_memory):
|
||||
'views': False,
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
def close_action(self, cr, uid, ids, context):
|
||||
|
||||
record_id = context and context.get('record_id', False)
|
||||
order_obj= self.pool.get('pos.order')
|
||||
order_line_obj= self.pool.get('pos.order.line')
|
||||
obj=order_obj.browse(cr,uid, record_id)
|
||||
order_obj.write(cr,uid,[record_id],{'state':'done'})
|
||||
if obj.amount_total != obj.amount_paid:
|
||||
return {
|
||||
'name': _('Make Payment'),
|
||||
'context ':context and context.get('record_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 {}
|
||||
add_product()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
<group col="2" colspan="4">
|
||||
<field name="product_id"/>
|
||||
<field name="quantity"/>
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Close" />
|
||||
<button icon='gtk-cancel' name="close_action"
|
||||
string="Close" type="object" />
|
||||
<button name="select_product" string="Contiue"
|
||||
colspan="1" type="object" icon="gtk-ok" />
|
||||
</group>
|
||||
|
||||
@@ -43,7 +43,7 @@ class pos_make_payment(osv.osv_memory):
|
||||
@return: A dictionary which of fields with values.
|
||||
"""
|
||||
res = super(pos_make_payment, self).default_get(cr, uid, fields, context=context)
|
||||
record_id = context and context.get('active_id',False)
|
||||
record_id = context and context.get('record_id',False)
|
||||
j_obj = self.pool.get('account.journal')
|
||||
company_id = self.pool.get('res.users').browse(cr,uid,uid).company_id.id
|
||||
journal = j_obj.search(cr, uid, [('type', '=', 'cash'), ('company_id', '=', company_id)])
|
||||
@@ -81,7 +81,7 @@ class pos_make_payment(osv.osv_memory):
|
||||
|
||||
def view_init(self, cr, uid, fields_list, context=None):
|
||||
res = super(pos_make_payment, self).view_init(cr, uid, fields_list, context=context)
|
||||
record_id = context and context.get('active_id', False) or False
|
||||
record_id = context and context.get('record_id', False) or False
|
||||
order = self.pool.get('pos.order').browse(cr, uid, record_id)
|
||||
if not order.lines:
|
||||
raise osv.except_osv('Error!','No order lines defined for this sale ')
|
||||
@@ -103,8 +103,7 @@ class pos_make_payment(osv.osv_memory):
|
||||
res = super(pos_make_payment, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
|
||||
if record_id:
|
||||
order = self.pool.get('pos.order').browse(cr, uid, record_id)
|
||||
amount = order.amount_total - order.amount_paid
|
||||
if amount==0.0:
|
||||
if order.amount_total == order.amount_paid:
|
||||
res['arch'] = """ <form string="Make Payment" colspan="4">
|
||||
<group col="2" colspan="2">
|
||||
<label string="Do you want to print the Receipt?" colspan="4"/>
|
||||
@@ -122,13 +121,13 @@ class pos_make_payment(osv.osv_memory):
|
||||
if the order is not paid: continue payment,
|
||||
if the order is paid print invoice (if wanted) or ticket.
|
||||
"""
|
||||
record_id = context and context.get('active_id',False)
|
||||
record_id = context and context.get('record_id',False)
|
||||
order_obj = self.pool.get('pos.order')
|
||||
jrnl_obj = self.pool.get('account.journal')
|
||||
order = order_obj.browse(cr, uid, record_id, context)
|
||||
amount = order.amount_total - order.amount_paid
|
||||
data = self.read(cr, uid, ids)[0]
|
||||
|
||||
|
||||
# Todo need to check ...
|
||||
if amount !=0.0:
|
||||
invoice_wanted = data['invoice_wanted']
|
||||
@@ -145,6 +144,7 @@ class pos_make_payment(osv.osv_memory):
|
||||
if order.partner_id and order.invoice_wanted:
|
||||
return self.create_invoice(cr,uid,ids,context)
|
||||
else:
|
||||
context.update({'flag': True})
|
||||
order_obj.action_paid(cr,uid,[record_id],context)
|
||||
order_obj.write(cr, uid, [record_id],{'state':'paid'})
|
||||
return self.print_report(cr, uid, ids, context)
|
||||
@@ -159,10 +159,10 @@ class pos_make_payment(osv.osv_memory):
|
||||
|
||||
def create_invoice(self, cr, uid, ids, context):
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
record_ids = context and context.get('active_ids',False)
|
||||
record_ids = [context and context.get('record_id',False)]
|
||||
for i in record_ids:
|
||||
wf_service.trg_validate(uid, 'pos.order', i, 'invoice', cr)
|
||||
datas = {'ids' : context.get('active_ids', [])}
|
||||
datas = {'ids' : context.get('record_id', [])}
|
||||
return {
|
||||
'type' : 'ir.actions.report.xml',
|
||||
'report_name':'pos.invoice',
|
||||
@@ -180,7 +180,8 @@ class pos_make_payment(osv.osv_memory):
|
||||
@param context: A standard dictionary
|
||||
@return : retrun report
|
||||
"""
|
||||
datas = {'ids' : context.get('active_ids',[])}
|
||||
record_id=context.get('record_id',[])
|
||||
datas = {'ids' : [record_id]}
|
||||
res = {}
|
||||
datas['form'] = res
|
||||
|
||||
|
||||
@@ -0,0 +1,347 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import netsvc
|
||||
from osv import osv,fields
|
||||
from tools.translate import _
|
||||
from mx import DateTime
|
||||
import time
|
||||
import pos_box_entries
|
||||
import pos_add_product
|
||||
import pos_payment
|
||||
|
||||
class pos_return(osv.osv_memory):
|
||||
_name = 'pos.return'
|
||||
_description = 'Point of sale return'
|
||||
|
||||
_columns = {
|
||||
|
||||
}
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
"""
|
||||
To get default values for the object.
|
||||
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param fields: List of fields for which we want default values
|
||||
@param context: A standard dictionary
|
||||
|
||||
@return: A dictionary which of fields with values.
|
||||
|
||||
"""
|
||||
|
||||
res = super(pos_return, self).default_get(cr, uid, fields, context=context)
|
||||
order_obj=self.pool.get('pos.order')
|
||||
record_id=context.get('record_id')
|
||||
if not context:
|
||||
context={}
|
||||
for order in order_obj.browse(cr, uid,[record_id]):
|
||||
for line in order.lines:
|
||||
if 'return%s'%(line.id) in fields:
|
||||
res['return%s'%(line.id)] = line.qty
|
||||
return res
|
||||
|
||||
def view_init(self, cr, uid, fields_list, context=None):
|
||||
res = super(pos_return, self).view_init(cr, uid, fields_list, context=context)
|
||||
order_obj=self.pool.get('pos.order')
|
||||
if not context:
|
||||
context={}
|
||||
record_id=context.get('record_id')
|
||||
for order in order_obj.browse(cr, uid,[record_id]):
|
||||
for line in order.lines:
|
||||
if 'return%s'%(line.id) not in self._columns:
|
||||
self._columns['return%s'%(line.id)] = fields.float("Quantity")
|
||||
|
||||
return res
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False,submenu=False):
|
||||
result = super(pos_return, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu)
|
||||
if not context:
|
||||
context={}
|
||||
order_obj=self.pool.get('pos.order')
|
||||
record_id = context.get('record_id', False)
|
||||
if record_id:
|
||||
_moves_arch_lst="""<?xml version="1.0"?>
|
||||
<form string="Return lines">
|
||||
<label string="Quantities you enter, match to products that will return to the stock." colspan="4"/>"""
|
||||
_line_fields = result['fields']
|
||||
order=order_obj.browse(cr, uid, record_id)
|
||||
for line in order.lines:
|
||||
quantity=line.qty
|
||||
_line_fields.update({
|
||||
'return%s'%(line.id) : {
|
||||
'string': line.product_id.name,
|
||||
'type' : 'float',
|
||||
'required': True,
|
||||
'default':quantity
|
||||
},
|
||||
})
|
||||
_moves_arch_lst += """
|
||||
<field name="return%s"/>
|
||||
<newline/>
|
||||
"""%(line.id)
|
||||
|
||||
_moves_arch_lst+="""
|
||||
<newline/>
|
||||
<separator colspan="4"/>
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Cancel" />
|
||||
<button icon='gtk-ok' name= "create_returns"
|
||||
string="Return goods and Exchange" type="object"/>
|
||||
<button icon='gtk-ok' name="create_returns2"
|
||||
string="Return without Refund" type="object"/>
|
||||
</form>"""
|
||||
|
||||
result['arch'] = _moves_arch_lst
|
||||
result['fields'] = _line_fields
|
||||
return result
|
||||
|
||||
|
||||
def create_returns(self, cr, uid, data, context):
|
||||
return {
|
||||
'name': _('Add Product'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'pos.add.product',
|
||||
'view_id': False,
|
||||
'target':'new',
|
||||
'views': False,
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
def create_returns2(self, cr, uid, ids, context):
|
||||
record_id = context.get('record_id', False)
|
||||
order_obj =self.pool.get('pos.order')
|
||||
line_obj = self.pool.get('pos.order.line')
|
||||
picking_obj = self.pool.get('stock.picking')
|
||||
stock_move_obj = self.pool.get('stock.move')
|
||||
property_obj= self.pool.get("ir.property")
|
||||
uom_obj =self. pool.get('product.uom')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
#Todo :Need to clean the code
|
||||
if record_id:
|
||||
picking_ids = picking_obj.search(cr, uid, [('pos_order', 'in',[record_id]), ('state', '=', 'done')])
|
||||
data=self.read(cr,uid,ids)[0]
|
||||
clone_list = []
|
||||
date_cur=time.strftime('%Y-%m-%d')
|
||||
|
||||
for order_id in order_obj.browse(cr, uid, [record_id], context=context):
|
||||
prop_ids = property_obj.search(cr, uid,[('name', '=', 'property_stock_customer')])
|
||||
val = property_obj.browse(cr, uid,prop_ids[0]).value
|
||||
cr.execute("select s.id from stock_location s, stock_warehouse w where w.lot_stock_id=s.id and w.id= %d "%(order_id.shop_id.warehouse_id.id))
|
||||
res=cr.fetchone()
|
||||
location_id=res and res[0] or None
|
||||
stock_dest_id = int(val.split(',')[1])
|
||||
|
||||
new_picking=picking_obj.copy(cr, uid, order_id.last_out_picking.id, {'name':'%s (return)' % order_id.name,
|
||||
'move_lines':[], 'state':'draft', 'type':'in',
|
||||
'type':'in',
|
||||
'date':date_cur})
|
||||
new_order=order_obj.copy(cr,uid,order_id.id, {'name': 'Refund %s'%order_id.name,
|
||||
'lines':[],
|
||||
'statement_ids':[],
|
||||
'last_out_picking':[]})
|
||||
for line in order_id.lines:
|
||||
if line.id and (data['return%s' %line.id]!=0.0):
|
||||
new_move=stock_move_obj.create(cr, uid,{
|
||||
'product_qty': data['return%s' %line.id],
|
||||
'product_uos_qty': uom_obj._compute_qty(cr, uid,data['return%s' %line.id] ,line.product_id.uom_id.id),
|
||||
'picking_id':new_picking,
|
||||
'product_uom':line.product_id.uom_id.id,
|
||||
'location_id':location_id,
|
||||
'product_id':line.product_id.id,
|
||||
'location_dest_id':stock_dest_id,
|
||||
'name':'%s (return)' %order_id.name,
|
||||
'date':date_cur,
|
||||
'date_planned':date_cur,})
|
||||
line_obj.copy(cr,uid,line.id,{'qty':-data['return%s' %line.id],
|
||||
'order_id': new_order,
|
||||
})
|
||||
order_obj.write(cr,uid, new_order, {'state':'done'})
|
||||
wf_service.trg_validate(uid, 'stock.picking',new_picking,'button_confirm', cr)
|
||||
picking_obj.force_assign(cr, uid, [new_picking], context)
|
||||
act = {
|
||||
'domain': "[('id', 'in', ["+str(new_order)+"])]",
|
||||
'name': 'Refunded Orders',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form,tree',
|
||||
'res_model': 'pos.order',
|
||||
'auto_refresh':0,
|
||||
'res_id':new_order,
|
||||
'view_id': False,
|
||||
'type': 'ir.actions.act_window'
|
||||
}
|
||||
return act
|
||||
|
||||
pos_return()
|
||||
class add_product(osv.osv_memory):
|
||||
_inherit = 'pos.add.product'
|
||||
def select_product(self, cr, uid, ids, context):
|
||||
"""
|
||||
To get the product and quantity and add in order .
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param context: A standard dictionary
|
||||
@return : Retrun the add product form again for adding more product
|
||||
"""
|
||||
|
||||
if not context.get('record_id', False):
|
||||
super(add_product).select_product(cr,uid,ids)
|
||||
else:
|
||||
record_id=context.get('record_id', False)
|
||||
data = self.read(cr, uid, ids)[0]
|
||||
|
||||
order_obj = self.pool.get('pos.order')
|
||||
lines_obj = self.pool.get('pos.order.line')
|
||||
picking_obj = self.pool.get('stock.picking')
|
||||
stock_move_obj = self.pool.get('stock.move')
|
||||
move_obj = self.pool.get('stock.move')
|
||||
property_obj= self.pool.get("ir.property")
|
||||
invoice_obj= self.pool.get('account.invoice')
|
||||
picking_ids = picking_obj.search(cr, uid, [('pos_order', 'in',[record_id]), ('state', '=', 'done')])
|
||||
clone_list = []
|
||||
date_cur=time.strftime('%Y-%m-%d')
|
||||
uom_obj = self.pool.get('product.uom')
|
||||
prod_obj=self.pool.get('product.product')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
return_boj=self.pool.get('pos.return')
|
||||
order_obj.add_product(cr, uid, record_id,data['product_id'],data['quantity'], context=context)
|
||||
|
||||
for order_id in order_obj.browse(cr, uid, [record_id], context=context):
|
||||
prod=data['product_id']
|
||||
qty=data['quantity']
|
||||
prop_ids = property_obj.search(cr, uid,[('name', '=', 'property_stock_customer')])
|
||||
val = property_obj.browse(cr, uid,prop_ids[0]).value
|
||||
cr.execute("select s.id from stock_location s, stock_warehouse w where w.lot_stock_id=s.id and w.id= %d "%(order_id.shop_id.warehouse_id.id))
|
||||
res=cr.fetchone()
|
||||
location_id=res and res[0] or None
|
||||
stock_dest_id = int(val.split(',')[1])
|
||||
|
||||
prod_id=prod_obj.browse(cr,uid,prod)
|
||||
new_picking=picking_obj.create(cr,uid,{
|
||||
'name':'%s (Added)' %order_id.name,
|
||||
'move_lines':[],
|
||||
'state':'draft',
|
||||
'type':'out',
|
||||
'date':date_cur, })
|
||||
new_move=stock_move_obj.create(cr, uid,{
|
||||
'product_qty': qty,
|
||||
'product_uos_qty': uom_obj._compute_qty(cr, uid,prod_id.uom_id.id, qty, prod_id.uom_id.id),
|
||||
'picking_id':new_picking,
|
||||
'product_uom':prod_id.uom_id.id,
|
||||
'location_id':location_id,
|
||||
'product_id':prod_id.id,
|
||||
'location_dest_id':stock_dest_id,
|
||||
'name':'%s (return)' %order_id.name,
|
||||
'date':date_cur,
|
||||
'date_planned':date_cur,})
|
||||
|
||||
wf_service.trg_validate(uid, 'stock.picking',new_picking,'button_confirm', cr)
|
||||
picking_obj.force_assign(cr, uid, [new_picking], context)
|
||||
order_obj.write(cr,uid,record_id,{'last_out_picking':new_picking})
|
||||
|
||||
|
||||
return {
|
||||
'name': _('Add Product'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'pos.add.product',
|
||||
'view_id': False,
|
||||
'target':'new',
|
||||
'context':context,
|
||||
'views': False,
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
|
||||
def close_action(self, cr, uid, ids, context):
|
||||
|
||||
record_id=context.get('record_id', False)
|
||||
order_obj = self.pool.get('pos.order')
|
||||
lines_obj = self.pool.get('pos.order.line')
|
||||
picking_obj = self.pool.get('stock.picking')
|
||||
stock_move_obj = self.pool.get('stock.move')
|
||||
move_obj = self.pool.get('stock.move')
|
||||
property_obj= self.pool.get("ir.property")
|
||||
invoice_obj=self.pool.get('account.invoice')
|
||||
picking_ids = picking_obj.search(cr, uid, [('pos_order', 'in', [record_id]), ('state', '=', 'done')])
|
||||
clone_list = []
|
||||
date_cur=time.strftime('%Y-%m-%d')
|
||||
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]
|
||||
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for order_id in order_obj.browse(cr, uid, [record_id], context=context):
|
||||
prop_ids =property_obj.search(cr, uid,[('name', '=', 'property_stock_customer')])
|
||||
val = property_obj.browse(cr, uid,prop_ids[0]).value
|
||||
cr.execute("select s.id from stock_location s, stock_warehouse w where w.lot_stock_id=s.id and w.id= %d "%(order_id.shop_id.warehouse_id.id))
|
||||
res=cr.fetchone()
|
||||
location_id=res and res[0] or None
|
||||
stock_dest_id = int(val.split(',')[1])
|
||||
|
||||
order_obj.write(cr,uid,[order_id.id],{'type_rec':'Exchange'})
|
||||
if order_id.invoice_id:
|
||||
invoice_obj.refund(cr, uid, [order_id.invoice_id.id],time.strftime('%Y-%m-%d'), False, order_id.name)
|
||||
new_picking=picking_obj.create(cr,uid,{
|
||||
'name':'%s (return)' %order_id.name,
|
||||
'move_lines':[], 'state':'draft',
|
||||
'type':'in',
|
||||
'date':date_cur})
|
||||
for line in order_id.lines:
|
||||
key=('return%s') %line.id
|
||||
if line.id and data.has_key(key):
|
||||
new_move=stock_move_obj.create(cr, uid,{
|
||||
'product_qty': data['return%s' %line.id ],
|
||||
'product_uos_qty': uom_obj._compute_qty(cr, uid,data['return%s' %line.id] ,line.product_id.uom_id.id),
|
||||
'picking_id':new_picking,
|
||||
'product_uom':line.product_id.uom_id.id,
|
||||
'location_id':location_id,
|
||||
'product_id':line.product_id.id,
|
||||
'location_dest_id':stock_dest_id,
|
||||
'name':'%s (return)' %order_id.name,
|
||||
'date':date_cur,
|
||||
'date_planned':date_cur,})
|
||||
lines_obj.write(cr,uid,[line.id],{'qty_rfd':(line.qty or 0.0) + data['return%s' %line.id],
|
||||
'qty':line.qty-(data['return%s' %line.id] or 0.0)
|
||||
})
|
||||
wf_service.trg_validate(uid, 'stock.picking',new_picking,'button_confirm', cr)
|
||||
picking_obj.force_assign(cr, uid, [new_picking], context)
|
||||
obj=order_obj.browse(cr,uid, record_id)
|
||||
if obj.amount_total != obj.amount_paid:
|
||||
return {
|
||||
'name': _('Make Payment'),
|
||||
'context ':context and context.get('record_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()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="action_view_pos_return" model="ir.actions.act_window">
|
||||
<field name="name">Return lines</field>
|
||||
<field name="res_model">pos.return</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,550 +0,0 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import pooler
|
||||
from tools.misc import UpdateableStr
|
||||
|
||||
import netsvc
|
||||
import time
|
||||
|
||||
from tools.translate import _
|
||||
from decimal import Decimal
|
||||
|
||||
|
||||
arch=UpdateableStr()
|
||||
fields={}
|
||||
|
||||
|
||||
def _get_journal(self, cr, uid, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
obj = pool.get('account.journal')
|
||||
c=pool.get('res.users').browse(cr,uid,uid).company_id.id
|
||||
ids = obj.search(cr, uid, [('type', '=', 'cash'), ('company_id','=',c)])
|
||||
res = obj.read(cr, uid, ids, ['id', 'name'], context)
|
||||
res = [(r['id'], r['name']) for r in res]
|
||||
return res
|
||||
|
||||
|
||||
payment_form = """<?xml version="1.0"?>
|
||||
<form string="Add payment :">
|
||||
<field name="amount" />
|
||||
<field name="journal"/>
|
||||
<field name="payment_date" />
|
||||
<field name="payment_name" />
|
||||
<field name="invoice_wanted" />
|
||||
<field name="num_sale" />
|
||||
</form>
|
||||
"""
|
||||
|
||||
payment_fields = {
|
||||
'amount': {'string': 'Amount', 'type': 'float', 'required': True},
|
||||
'invoice_wanted': {'string': 'Invoice', 'type': 'boolean'},
|
||||
'journal': {'string': 'Journal',
|
||||
'type': 'selection',
|
||||
'selection': _get_journal,
|
||||
'required': True,
|
||||
},
|
||||
'payment_date': {'string': 'Payment date', 'type': 'date', 'required': True},
|
||||
'payment_name': {'string': 'Payment name', 'type': 'char', 'size': '32', 'required':True, 'default':'Payment'},
|
||||
'num_sale': {'string': 'Num.Cof', 'type': 'char', 'size': '32'},
|
||||
}
|
||||
|
||||
|
||||
def _pre_init(self, cr, uid, data, context):
|
||||
def _get_journal(pool, order):
|
||||
j_obj = pool.get('account.journal')
|
||||
|
||||
journal_to_fetch = 'DEFAULT'
|
||||
if order.amount_total < 0:
|
||||
journal_to_fetch = 'GIFT'
|
||||
else:
|
||||
if order.amount_paid > 0:
|
||||
journal_to_fetch = 'REBATE'
|
||||
|
||||
pos_config_journal = pool.get('pos.config.journal')
|
||||
ids = pos_config_journal.search(cr, uid, [('code', '=', journal_to_fetch)])
|
||||
objs = pos_config_journal.browse(cr, uid, ids)
|
||||
journal=''
|
||||
if objs:
|
||||
journal = objs[0].journal_id.id
|
||||
else:
|
||||
existing = [payment.journal_id.id for payment in order.payments]
|
||||
ids = j_obj.search(cr, uid, [('type', '=', 'cash')])
|
||||
for i in ids:
|
||||
if i not in existing:
|
||||
journal = i
|
||||
break
|
||||
if not journal:
|
||||
journal = ids and ids[0]
|
||||
return journal
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
order = pool.get('pos.order').browse(cr, uid, data['id'], context)
|
||||
# get amount to pay:
|
||||
# amount = Decimal(str(order.amount_total)) - Decimal(str(order.amount_paid))
|
||||
amount = order.amount_total - order.amount_paid
|
||||
if amount <= 0:
|
||||
pool.get('pos.order').action_paid(cr, uid, data['ids'], context)
|
||||
|
||||
# get journal:
|
||||
journal = _get_journal(pool, order)
|
||||
|
||||
# check if an invoice is wanted:
|
||||
#invoice_wanted_checked = not not order.partner_id # not not -> boolean
|
||||
invoice_wanted_checked = False
|
||||
|
||||
# select the current date
|
||||
current_date = time.strftime('%Y-%m-%d')
|
||||
|
||||
return {'journal': journal, 'amount': amount, 'invoice_wanted': invoice_wanted_checked, 'payment_date': current_date}
|
||||
|
||||
|
||||
def _add_pay(self, cr, uid, data, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
order_obj = pool.get('pos.order')
|
||||
jrnl_obj = pool.get('account.journal')
|
||||
result = data['form']
|
||||
invoice_wanted = data['form']['invoice_wanted']
|
||||
jrnl_used=False
|
||||
if data['form'] and data['form'].get('journal',False):
|
||||
jrnl_used=jrnl_obj.browse(cr,uid,data['form']['journal'])
|
||||
|
||||
# add 'invoice_wanted' in 'pos.order'
|
||||
order_obj.write(cr, uid, [data['id']], {'invoice_wanted': invoice_wanted})
|
||||
|
||||
order_obj.add_payment(cr, uid, data['id'], result, context=context)
|
||||
return {}
|
||||
|
||||
|
||||
def _check(self, cr, uid, data, context):
|
||||
"""Check the order:
|
||||
if the order is not paid: continue payment,
|
||||
if the order is paid print invoice (if wanted) or ticket.
|
||||
"""
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
order_obj = pool.get('pos.order')
|
||||
order = order_obj.browse(cr, uid, data['id'], context)
|
||||
order_obj.test_order_lines(cr, uid, order, context=context)
|
||||
|
||||
action = 'ask_pay'
|
||||
if order.state == 'paid':
|
||||
if order.partner_id:
|
||||
if order.invoice_wanted:
|
||||
action = 'invoice'
|
||||
else:
|
||||
action = 'paid'
|
||||
elif order.date_validation:
|
||||
action = 'receipt'
|
||||
else:
|
||||
action='paid'
|
||||
|
||||
if order.amount_total == order.amount_paid:
|
||||
order_obj.write(cr,uid,data['ids'],{'state':'done'})
|
||||
action = 'receipt'
|
||||
|
||||
return action
|
||||
|
||||
|
||||
def create_invoice(self, cr, uid, data, context):
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for i in data['ids']:
|
||||
wf_service.trg_validate(uid, 'pos.order', i, 'invoice', cr)
|
||||
return {}
|
||||
|
||||
|
||||
|
||||
_form = """<?xml version="1.0"?>
|
||||
<form string="Add product :">
|
||||
<field name="product"/>
|
||||
<field name="quantity"/>
|
||||
</form>
|
||||
"""
|
||||
_fields = {
|
||||
'product': {
|
||||
'string': 'Product',
|
||||
'type': 'many2one',
|
||||
'relation': 'product.product',
|
||||
'required': True,
|
||||
'default': False
|
||||
},
|
||||
|
||||
'quantity': {
|
||||
'string': 'Quantity',
|
||||
'type': 'integer',
|
||||
'required': True,
|
||||
'default': 1},
|
||||
}
|
||||
|
||||
def make_default(val):
|
||||
def fct(obj, cr, uid):
|
||||
return val
|
||||
return fct
|
||||
|
||||
def _get_returns(self, cr, uid, data, context):
|
||||
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
order_obj=pool.get('pos.order')
|
||||
order=order_obj.browse(cr, uid, [data['id']])[0]
|
||||
res={}
|
||||
fields.clear()
|
||||
arch_lst=['<?xml version="1.0"?>', '<form string="%s">' % _('Return lines'), '<label string="%s" colspan="4"/>' % _('Quantities you enter, match to products that will return to the stock.')]
|
||||
for m in [line for line in order.lines]:
|
||||
quantity=m.qty
|
||||
arch_lst.append('<field name="return%s"/>\n<newline/>' % (m.id,))
|
||||
fields['return%s' % m.id]={'string':m.product_id.name, 'type':'float', 'required':True, 'default':quantity}
|
||||
res.setdefault('returns', []).append(m.id)
|
||||
arch_lst.append('</form>')
|
||||
arch.string='\n'.join(arch_lst)
|
||||
return res
|
||||
|
||||
def _create_returns(self, cr, uid, data, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
order_obj = pool.get('pos.order')
|
||||
lines_obj = pool.get('pos.order.line')
|
||||
picking_obj = pool.get('stock.picking')
|
||||
stock_move_obj = pool.get('stock.move')
|
||||
move_obj = pool.get('stock.move')
|
||||
picking_ids = picking_obj.search(cr, uid, [('pos_order', 'in', data['ids']), ('state', '=', 'done')])
|
||||
clone_list = []
|
||||
date_cur=time.strftime('%Y-%m-%d')
|
||||
uom_obj = pool.get('product.uom')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for order_id in order_obj.browse(cr, uid, data['ids'], context=context):
|
||||
prop_ids = pool.get("ir.property").search(cr, uid,[('name', '=', 'property_stock_customer')])
|
||||
val = pool.get("ir.property").browse(cr, uid,prop_ids[0]).value
|
||||
cr.execute("select s.id from stock_location s, stock_warehouse w where w.lot_stock_id=s.id and w.id= %d "%(order_id.shop_id.warehouse_id.id))
|
||||
res=cr.fetchone()
|
||||
location_id=res and res[0] or None
|
||||
stock_dest_id = int(val.split(',')[1])
|
||||
|
||||
order_obj.write(cr,uid,[order_id.id],{'type_rec':'Exchange'})
|
||||
if order_id.invoice_id:
|
||||
pool.get('account.invoice').refund(cr, uid, [order_id.invoice_id.id],time.strftime('%Y-%m-%d'), False, order_id.name)
|
||||
new_picking=picking_obj.create(cr,uid,{
|
||||
'name':'%s (return)' %order_id.name,
|
||||
'move_lines':[], 'state':'draft',
|
||||
'type':'in',
|
||||
'date':date_cur, })
|
||||
for line in order_id.lines:
|
||||
for r in data['form'].get('returns',[]):
|
||||
if line.id==r and (data['form']['return%s' %r]!=0.0):
|
||||
new_move=stock_move_obj.create(cr, uid,{
|
||||
'product_qty': data['form']['return%s' %r],
|
||||
'product_uos_qty': uom_obj._compute_qty(cr, uid,data['form']['return%s' %r] ,line.product_id.uom_id.id),
|
||||
'picking_id':new_picking,
|
||||
'product_uom':line.product_id.uom_id.id,
|
||||
'location_id':location_id,
|
||||
'product_id':line.product_id.id,
|
||||
'location_dest_id':stock_dest_id,
|
||||
'name':'%s (return)' %order_id.name,
|
||||
'date':date_cur,
|
||||
'date_planned':date_cur,})
|
||||
lines_obj.write(cr,uid,[line.id],{'qty_rfd':(line.qty or 0.0) + data['form']['return%s' %r],
|
||||
'qty':line.qty-(data['form']['return%s' %r] or 0.0)
|
||||
})
|
||||
wf_service.trg_validate(uid, 'stock.picking',new_picking,'button_confirm', cr)
|
||||
picking_obj.force_assign(cr, uid, [new_picking], context)
|
||||
return res
|
||||
|
||||
def _create_returns2(self, cr, uid, data, context):
|
||||
act={}
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
order_obj = pool.get('pos.order')
|
||||
line_obj = pool.get('pos.order.line')
|
||||
picking_obj = pool.get('stock.picking')
|
||||
stock_move_obj = pool.get('stock.move')
|
||||
picking_ids = picking_obj.search(cr, uid, [('pos_order', 'in', data['ids']), ('state', '=', 'done')])
|
||||
clone_list = []
|
||||
date_cur=time.strftime('%Y-%m-%d')
|
||||
uom_obj = pool.get('product.uom')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for order_id in order_obj.browse(cr, uid, data['ids'], context=context):
|
||||
prop_ids = pool.get("ir.property").search(cr, uid,[('name', '=', 'property_stock_customer')])
|
||||
val = pool.get("ir.property").browse(cr, uid,prop_ids[0]).value
|
||||
cr.execute("select s.id from stock_location s, stock_warehouse w where w.lot_stock_id=s.id and w.id= %d "%(order_id.shop_id.warehouse_id.id))
|
||||
res=cr.fetchone()
|
||||
location_id=res and res[0] or None
|
||||
stock_dest_id = int(val.split(',')[1])
|
||||
if order_id.last_out_picking.id:
|
||||
new_picking=picking_obj.copy(cr, uid, order_id.last_out_picking.id, {'name':'%s (return)' % order_id.name,
|
||||
'move_lines':[], 'state':'draft', 'type':'in',
|
||||
'type':'in',
|
||||
'date':date_cur, })
|
||||
new_order=order_obj.copy(cr,uid,order_id.id, {'name': 'Refund %s'%order_id.name,
|
||||
'lines':[],
|
||||
'statement_ids':[],
|
||||
'last_out_picking':[]})
|
||||
for line in order_id.lines:
|
||||
for r in data['form'].get('returns',[]):
|
||||
if line.id==r and (data['form']['return%s' %r]!=0.0):
|
||||
new_move=stock_move_obj.create(cr, uid,{
|
||||
'product_qty': data['form']['return%s' %r],
|
||||
'product_uos_qty': uom_obj._compute_qty(cr, uid,data['form']['return%s' %r] ,line.product_id.uom_id.id),
|
||||
'picking_id':new_picking,
|
||||
'product_uom':line.product_id.uom_id.id,
|
||||
'location_id':location_id,
|
||||
'product_id':line.product_id.id,
|
||||
'location_dest_id':stock_dest_id,
|
||||
'name':'%s (return)' %order_id.name,
|
||||
'date':date_cur,
|
||||
'date_planned':date_cur,})
|
||||
line_obj.copy(cr,uid,line.id,{'qty':-data['form']['return%s' %r],
|
||||
'order_id': new_order,
|
||||
})
|
||||
order_obj.write(cr,uid, new_order, {'state':'done'})
|
||||
wf_service.trg_validate(uid, 'stock.picking',new_picking,'button_confirm', cr)
|
||||
picking_obj.force_assign(cr, uid, [new_picking], context)
|
||||
act = {
|
||||
'domain': "[('id', 'in', ["+str(new_order)+"])]",
|
||||
'name': 'Refunded Orders',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form,tree',
|
||||
'res_model': 'pos.order',
|
||||
'auto_refresh':0,
|
||||
'res_id':new_order,
|
||||
'view_id': False,
|
||||
'type': 'ir.actions.act_window'
|
||||
}
|
||||
else:
|
||||
raise wizard.except_wizard(_('Error'), _('Last out picking No find!'))
|
||||
|
||||
return act
|
||||
def test(self,cr,uid,data,context={}):
|
||||
# import pdb; pdb.set_trace()
|
||||
data['id']=data['res_id']
|
||||
return {'id':data['res_id']}
|
||||
|
||||
#def _raise(self,cr,uid,data,context={}):
|
||||
# return datas
|
||||
# raise wizard.except_wizard(_('Message'),_('You can not exchange products more than total paid amount.'))
|
||||
|
||||
|
||||
#def _test_exist1(self,cr,uid,data,context={}):
|
||||
# return 'choice'
|
||||
|
||||
def _test_exist(self,cr,uid,data,context={}):
|
||||
# order_obj= pooler.get_pool(cr.dbname).get('pos.order')
|
||||
# order_line_obj= pooler.get_pool(cr.dbname).get('pos.order.line')
|
||||
# obj=order_obj.browse(cr,uid, data['ids'])[0]
|
||||
# am_tot=obj._amount_total(cr, uid, data['ids'])
|
||||
# order_obj.write(cr,uid,data['ids'],{'state':'done'})
|
||||
# if obj.amount_total == obj.amount_paid:
|
||||
# return 'receipt'
|
||||
# elif obj.amount_total > obj.amount_paid:
|
||||
# sql = """select max(id) from pos_order_line where order_id = %d """%(obj.id)
|
||||
# cr.execute(sql)
|
||||
# res = cr.fetchone()
|
||||
# cr.execute("delete from pos_order_line where id = %d"%(res[0]))
|
||||
# cr.commit()
|
||||
# return 'choice_raise'
|
||||
# else:
|
||||
return 'add_p'
|
||||
|
||||
def _close(self,cr,uid,data,context={}):
|
||||
order_obj= pooler.get_pool(cr.dbname).get('pos.order')
|
||||
order_line_obj= pooler.get_pool(cr.dbname).get('pos.order.line')
|
||||
obj=order_obj.browse(cr,uid, data['ids'])[0]
|
||||
order_obj.write(cr,uid,data['ids'],{'state':'done'})
|
||||
if obj.amount_total != obj.amount_paid:
|
||||
return 'ask_pay'
|
||||
else :
|
||||
return 'receipt'
|
||||
|
||||
|
||||
|
||||
|
||||
def _add_pdct(self, cr, uid, data, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
order_obj = pool.get('pos.order')
|
||||
line_obj = pool.get('pos.order.line')
|
||||
picking_obj = pool.get('stock.picking')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
prod_obj = pool.get('product.product')
|
||||
stock_move_obj = pool.get('stock.move')
|
||||
uom_obj = pool.get('product.uom')
|
||||
date_cur=time.strftime('%Y-%m-%d')
|
||||
order_obj.add_product(cr, uid, data['id'], data['form']['product'],
|
||||
data['form']['quantity'], context=context)
|
||||
cr.commit()
|
||||
for order_id in order_obj.browse(cr, uid, data['ids'], context=context):
|
||||
prod=data['form']['product']
|
||||
qty=data['form']['quantity']
|
||||
prop_ids = pool.get("ir.property").search(cr, uid,[('name', '=', 'property_stock_customer')])
|
||||
val = pool.get("ir.property").browse(cr, uid,prop_ids[0]).value
|
||||
cr.execute("select s.id from stock_location s, stock_warehouse w where w.lot_stock_id=s.id and w.id= %d "%(order_id.shop_id.warehouse_id.id))
|
||||
res=cr.fetchone()
|
||||
location_id=res and res[0] or None
|
||||
stock_dest_id = int(val.split(',')[1])
|
||||
|
||||
prod_id=prod_obj.browse(cr,uid,prod)
|
||||
new_picking=picking_obj.create(cr,uid,{
|
||||
'name':'%s (Added)' %order_id.name,
|
||||
'move_lines':[],
|
||||
'state':'draft',
|
||||
'type':'out',
|
||||
'date':date_cur, })
|
||||
new_move=stock_move_obj.create(cr, uid,{
|
||||
'product_qty': qty,
|
||||
'product_uos_qty': uom_obj._compute_qty(cr, uid,prod_id.uom_id.id, qty, prod_id.uom_id.id),
|
||||
'picking_id':new_picking,
|
||||
'product_uom':prod_id.uom_id.id,
|
||||
'location_id':location_id,
|
||||
'product_id':prod_id.id,
|
||||
'location_dest_id':stock_dest_id,
|
||||
'name':'%s (return)' %order_id.name,
|
||||
'date':date_cur,
|
||||
'date_planned':date_cur,})
|
||||
|
||||
wf_service.trg_validate(uid, 'stock.picking',new_picking,'button_confirm', cr)
|
||||
picking_obj.force_assign(cr, uid, [new_picking], context)
|
||||
# order_obj.write(cr,uid,data['id'],{'state':'done','last_out_picking':new_picking})
|
||||
order_obj.write(cr,uid,data['id'],{'last_out_picking':new_picking})
|
||||
return {}
|
||||
|
||||
|
||||
|
||||
|
||||
class wizard_return_picking(wizard.interface):
|
||||
states={
|
||||
'init':{
|
||||
'actions':[_get_returns],
|
||||
'result':{'type':'form',
|
||||
'arch':arch,
|
||||
'fields':fields,
|
||||
'state':[('end','Cancel', 'gtk-cancel'),('return','Return goods and Exchange', 'gtk-ok'),('return_w','Return without Refund','gtk-ok')]
|
||||
}
|
||||
},
|
||||
'return':{
|
||||
'actions':[],
|
||||
'result':{ 'type': 'action',
|
||||
'action' : _create_returns,
|
||||
'state':'prod'}
|
||||
},
|
||||
'prod':{
|
||||
'actions':[],
|
||||
'result': {
|
||||
'type': 'form',
|
||||
'arch': _form,
|
||||
'fields':_fields,
|
||||
'state': [('close','Close'),('choice','Continue')]
|
||||
}
|
||||
},
|
||||
# 'choice1' : {
|
||||
# 'actions' : [_add_pdct],
|
||||
# 'result' : {'type' : 'choice', 'next_state': _test_exist1 }
|
||||
# },
|
||||
'choice' : {
|
||||
'actions' : [],
|
||||
'result' : {'type' : 'choice', 'next_state': _test_exist }
|
||||
},
|
||||
# 'choice_raise':{
|
||||
# 'actions':[],
|
||||
# 'result':{ 'type': 'action',
|
||||
# 'action' : _raise,
|
||||
# 'state':'end'}
|
||||
# },
|
||||
'add_p' :{
|
||||
'actions':[],
|
||||
'result':{
|
||||
'type':'action',
|
||||
'action': _add_pdct,
|
||||
'state': 'prod'}
|
||||
},
|
||||
# 'add_pp' :{
|
||||
# 'actions':[],
|
||||
# 'result':{
|
||||
# 'type':'action',
|
||||
# 'action': _add_pdct,
|
||||
# 'state': 'end'}
|
||||
# },
|
||||
'receipt':{
|
||||
'result': {
|
||||
'type': 'print',
|
||||
'report': 'pos.receipt',
|
||||
'state': 'end'
|
||||
}
|
||||
},
|
||||
'return_w':{
|
||||
'actions':[],
|
||||
'result':{'type':'action', 'action':_create_returns2, 'state':'end'}
|
||||
},
|
||||
|
||||
'close':{
|
||||
'actions' : [],
|
||||
'result' : {'type' : 'choice', 'next_state': _close }
|
||||
},
|
||||
|
||||
'check': {
|
||||
'actions': [],
|
||||
'result': {
|
||||
'type': 'choice',
|
||||
'next_state': _check,
|
||||
}
|
||||
},
|
||||
|
||||
'ask_pay': {
|
||||
'actions': [_pre_init],
|
||||
'result': {
|
||||
'type': 'form',
|
||||
'arch': payment_form,
|
||||
'fields': payment_fields,
|
||||
'state': (('end', 'Cancel'), ('add_pay', 'Ma_ke payment', 'gtk-ok', True)
|
||||
)
|
||||
}
|
||||
},
|
||||
'add_pay': {
|
||||
'actions': [_add_pay],
|
||||
'result': {
|
||||
'type': 'state',
|
||||
'state': "check",
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
'invoice': {
|
||||
'actions': [create_invoice],
|
||||
'result': {
|
||||
'type': 'print',
|
||||
'report': 'pos.invoice',
|
||||
'state': 'end'
|
||||
}
|
||||
},
|
||||
'receipt': {
|
||||
'actions': [],
|
||||
'result': {
|
||||
'type': 'print',
|
||||
'report': 'pos.receipt',
|
||||
'state': 'end'
|
||||
}
|
||||
},
|
||||
'paid': {
|
||||
'actions': [],
|
||||
'result': {
|
||||
'type': 'state',
|
||||
'state': 'end'
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
wizard_return_picking('pos.return.picking')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
Reference in New Issue
Block a user