[IMP]: lunch: code optimization and apply doc string
bzr revid: ksa@tinyerp.co.in-20100316140302-sbjh3mot08dwdd0z
This commit is contained in:
+30
-18
@@ -1,6 +1,6 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
@@ -15,7 +15,7 @@
|
||||
# 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/>.
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
@@ -23,24 +23,28 @@ from osv import osv, fields
|
||||
import time
|
||||
|
||||
class lunch_category(osv.osv):
|
||||
""" Lunch category """
|
||||
_name = 'lunch.category'
|
||||
_description = "Category"
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Name', required=True, size=50),
|
||||
}
|
||||
|
||||
_order = 'name'
|
||||
|
||||
lunch_category()
|
||||
|
||||
|
||||
class lunch_product(osv.osv):
|
||||
""" Lunch Product """
|
||||
_name = 'lunch.product'
|
||||
_description = "Lunch Product"
|
||||
|
||||
def _category_name_get(self, cr, uid, context={}):
|
||||
""" Get category name """
|
||||
obj = self.pool.get('lunch.category')
|
||||
cat_ids= obj.search(cr,uid,[])
|
||||
res = obj.read(cr,uid,cat_ids,['name', 'category'])
|
||||
res = obj.read(cr, uid, cat_ids, ['name', 'category'])
|
||||
return [(str(r['id']), r['name']) for r in res]+ [('0','')]
|
||||
|
||||
_columns = {
|
||||
@@ -57,36 +61,40 @@ class lunch_product(osv.osv):
|
||||
|
||||
lunch_product()
|
||||
|
||||
|
||||
class lunch_cashbox(osv.osv):
|
||||
""" cashbox for Lunch """
|
||||
_name='lunch.cashbox'
|
||||
_description = "Cashbox for Lunch "
|
||||
|
||||
|
||||
def amount_available(self, cr, uid, ids, field_name, arg, context):
|
||||
cr.execute("SELECT box,sum(amount) from lunch_cashmove where active = 't' group by box")
|
||||
r = dict(cr.fetchall())
|
||||
for i in ids :
|
||||
for i in ids:
|
||||
r.setdefault(i,0)
|
||||
return r
|
||||
|
||||
_columns={
|
||||
'manager':fields.many2one('res.users','Manager'),
|
||||
'name':fields.char('Name',size=30,required=True, unique = True),
|
||||
'manager': fields.many2one('res.users','Manager'),
|
||||
'name': fields.char('Name',size=30,required=True, unique = True),
|
||||
'sum_remain': fields.function(amount_available, method=True, string='Remained Total'),
|
||||
}
|
||||
|
||||
lunch_cashbox()
|
||||
|
||||
|
||||
|
||||
|
||||
class lunch_cashmove(osv.osv):
|
||||
""" Move cah """
|
||||
_name= 'lunch.cashmove'
|
||||
_description = "Move cash"
|
||||
|
||||
_columns={
|
||||
'name': fields.char('Name',size=128),
|
||||
'user_cashmove': fields.many2one('res.users','User Name', required=True),
|
||||
'amount': fields.float('Amount', digits=(16,2)),
|
||||
'box':fields.many2one('lunch.cashbox','Box Name',size=30,required=True),
|
||||
'active':fields.boolean('Active'),
|
||||
'box': fields.many2one('lunch.cashbox','Box Name',size=30,required=True),
|
||||
'active': fields.boolean('Active'),
|
||||
'create_date': fields.datetime('Created date', readonly=True),
|
||||
}
|
||||
|
||||
@@ -97,9 +105,10 @@ class lunch_cashmove(osv.osv):
|
||||
lunch_cashmove()
|
||||
|
||||
|
||||
|
||||
class lunch_order(osv.osv):
|
||||
""" Apply lunch order """
|
||||
_name='lunch.order'
|
||||
_description = "Lunch Order"
|
||||
_rec_name= "user_id"
|
||||
|
||||
def _price_get(self, cr, uid, ids, name, args, context=None):
|
||||
@@ -109,15 +118,15 @@ class lunch_order(osv.osv):
|
||||
return res
|
||||
|
||||
_columns={
|
||||
'user_id': fields.many2one('res.users','User Name', required=True,
|
||||
'user_id': fields.many2one('res.users','User Name', required=True, \
|
||||
readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'product':fields.many2one('lunch.product','Product', required=True,
|
||||
'product': fields.many2one('lunch.product','Product', required=True, \
|
||||
readonly=True, states={'draft':[('readonly',False)]}, change_default=True),
|
||||
'date': fields.date('Date',readonly=True,states={'draft':[('readonly',False)]}),
|
||||
'cashmove':fields.many2one('lunch.cashmove', 'CashMove' , readonly=True ),
|
||||
'descript':fields.char('Description Order', readonly=True, size=50,
|
||||
'cashmove': fields.many2one('lunch.cashmove', 'CashMove' , readonly=True ),
|
||||
'descript': fields.char('Description Order', readonly=True, size=50,\
|
||||
states={'draft':[('readonly',False)]}),
|
||||
'state': fields.selection([('draft','Draft'), ('confirmed','Confirmed'),],
|
||||
'state': fields.selection([('draft','Draft'), ('confirmed','Confirmed'),],\
|
||||
'State', readonly=True, select=True),
|
||||
'price': fields.function(_price_get, method=True, string="Price"),
|
||||
}
|
||||
@@ -147,7 +156,7 @@ class lunch_order(osv.osv):
|
||||
for order in orders:
|
||||
if not order.cashmove:
|
||||
continue
|
||||
self.pool.get('lunch.cashmove').unlink(cr, uid, [order.cashmove.id])
|
||||
self.pool.get('lunch.cashmove').unlink(cr, uid, [order.cashmove.id])
|
||||
self.write(cr,uid,ids,{'state':'draft'})
|
||||
return {}
|
||||
|
||||
@@ -159,7 +168,9 @@ class lunch_order(osv.osv):
|
||||
|
||||
lunch_order()
|
||||
|
||||
|
||||
class report_lunch_amount(osv.osv):
|
||||
""" Lunch Amount Report """
|
||||
_name='report.lunch.amount'
|
||||
_description = "Amount available by user and box"
|
||||
_auto = False
|
||||
@@ -187,5 +198,6 @@ class report_lunch_amount(osv.osv):
|
||||
)""")
|
||||
|
||||
report_lunch_amount()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
+53
-29
@@ -2,21 +2,25 @@
|
||||
<openerp>
|
||||
<data>
|
||||
<menuitem icon="STOCK_PREFERENCES" id="base.menu_tools" name="Tools" sequence="15"/>
|
||||
<!--<menuitem name="Tools" id="menu_tools" icon="STOCK_PREFERENCES"/>
|
||||
<menuitem name="Lunch Order" parent="menu_tools" id="menu_lunch" sequence="1"/>
|
||||
<menuitem name="Reporting" parent="menu_tools" id="menu_lunch_reporting" sequence="4"/>
|
||||
<menuitem name="Lunch Orders" parent="menu_lunch_reporting" id="menu_lunch_reporting_order" sequence="1"/>
|
||||
<menuitem name="Configuration" parent="menu_tools" id="menu_lunch_category_root" sequence="5"/>
|
||||
<menuitem name="Tools" id="menu_tools" icon="STOCK_PREFERENCES"/>-->
|
||||
<menuitem name="Lunch Order" parent="base.menu_tools"
|
||||
id="menu_lunch" sequence="1" />
|
||||
|
||||
<menuitem name="Lunch Order" parent="base.menu_tools" id="menu_lunch" sequence="1"/>
|
||||
<menuitem name="Reporting" parent="base.menu_tools" id="base.menu_lunch_reporting" sequence="5"/>
|
||||
<menuitem name="Lunch Orders" parent="base.menu_lunch_reporting" id="menu_lunch_reporting_order" sequence="1"/>
|
||||
<menuitem name="Configuration" parent="base.menu_tools" id="base.menu_lunch_survey_root" sequence="6"/>
|
||||
<menuitem name="Reporting" parent="base.menu_tools"
|
||||
id="base.menu_lunch_reporting" sequence="5" />
|
||||
|
||||
<menuitem name="Lunch Orders"
|
||||
parent="base.menu_lunch_reporting"
|
||||
id="menu_lunch_reporting_order" sequence="1" />
|
||||
|
||||
<menuitem name="Lunch" parent="base.menu_lunch_survey_root" id="menu_lunch_category_root_configuration" sequence="1"/>
|
||||
<record model="ir.ui.view" id="view_lunch_order_form">
|
||||
<menuitem name="Configuration" parent="base.menu_tools"
|
||||
id="base.menu_lunch_survey_root" sequence="6" />
|
||||
|
||||
<menuitem name="Lunch" parent="base.menu_lunch_survey_root"
|
||||
id="menu_lunch_category_root_configuration" sequence="1" />
|
||||
|
||||
<!-- Lunch order -->
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_order_form">
|
||||
<field name="name">Order</field>
|
||||
<field name="model">lunch.order</field>
|
||||
<field name="arch" type="xml">
|
||||
@@ -58,15 +62,10 @@
|
||||
<field name="res_model">lunch.order</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
<menuitem name="Lunch Order" parent="menu_lunch" id="menu_lunch_order_form" action="action_lunch_order_form"/>
|
||||
<menuitem name="Lunch Order" parent="menu_lunch"
|
||||
id="menu_lunch_order_form" action="action_lunch_order_form" />
|
||||
|
||||
<!-- <record model="ir.actions.act_window" id="action_lunch_order_day_form">-->
|
||||
<!-- <field name="name"> Order of the day</field>-->
|
||||
<!-- <field name="res_model">lunch.order</field>-->
|
||||
<!-- <field name="domain">[('date','=',time.strftime('%Y-%m-%d'))]</field>-->
|
||||
<!---->
|
||||
<!-- </record>-->
|
||||
<!-- <menuitem name="Order of the day" parent="menu_lunch_order_form" id="menu_lunch_order_day_form" action="action_lunch_order_day_form"/>-->
|
||||
<!-- Cash Box -->
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_cashbox_form">
|
||||
<field name="name">CashBox</field>
|
||||
@@ -96,7 +95,13 @@
|
||||
<field name="name"> CashBox </field>
|
||||
<field name="res_model">lunch.cashbox</field>
|
||||
</record>
|
||||
<menuitem name="CashBox" parent="menu_lunch_category_root_configuration" id="menu_lunch_cashbox_form" action="action_lunch_cashbox_form"/>
|
||||
|
||||
<menuitem name="CashBox"
|
||||
parent="menu_lunch_category_root_configuration"
|
||||
id="menu_lunch_cashbox_form"
|
||||
action="action_lunch_cashbox_form" />
|
||||
|
||||
<!-- Cash Move -->
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_cashmove_form">
|
||||
<field name="name">CashMove</field>
|
||||
@@ -133,7 +138,11 @@
|
||||
<field name="res_model">lunch.cashmove</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="Cash Moves" parent="menu_lunch" id="menu_lunch_cashmove_form" action="action_lunch_cashmove_form"/>
|
||||
<menuitem name="Cash Moves" parent="menu_lunch"
|
||||
id="menu_lunch_cashmove_form"
|
||||
action="action_lunch_cashmove_form" />
|
||||
|
||||
<!-- Lunch Category -->
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_category_form">
|
||||
<field name="name"> Category of product </field>
|
||||
@@ -157,12 +166,13 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="ir.actions.act_window" id="action_lunch_category_form">
|
||||
<field name="name"> Category of product </field>
|
||||
<field name="res_model">lunch.category</field>
|
||||
</record>
|
||||
|
||||
<!-- Lunch Product -->
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_product_form">
|
||||
<field name="name">Products</field>
|
||||
<field name="type">form</field>
|
||||
@@ -178,7 +188,6 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_product_tree">
|
||||
<field name="name">Products</field>
|
||||
<field name="model">lunch.product</field>
|
||||
@@ -198,10 +207,21 @@
|
||||
<field name="res_model">lunch.product</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="Tools/Lunch/Configuration/Products" id="menu_lunch_product_form" action="action_lunch_product_form" sequence="1"/>
|
||||
<menuitem name="Products" parent="menu_lunch_category_root_configuration" id="menu_lunch_product_form" action="action_lunch_product_form" sequence="2"/>
|
||||
<menuitem name="Category of product" parent="menu_lunch_category_root_configuration" id="menu_lunch_category_form" action="action_lunch_category_form" sequence="1"/>
|
||||
<menuitem name="Tools/Lunch/Configuration/Products"
|
||||
id="menu_lunch_product_form" action="action_lunch_product_form"
|
||||
sequence="1" />
|
||||
|
||||
<menuitem name="Products"
|
||||
parent="menu_lunch_category_root_configuration"
|
||||
id="menu_lunch_product_form" action="action_lunch_product_form"
|
||||
sequence="2" />
|
||||
|
||||
<menuitem name="Category of product"
|
||||
parent="menu_lunch_category_root_configuration"
|
||||
id="menu_lunch_category_form"
|
||||
action="action_lunch_category_form" sequence="1" />
|
||||
|
||||
<!-- Lunch Amount -->
|
||||
|
||||
<record model="ir.ui.view" id="view_report_lunch_amount_tree">
|
||||
<field name="name">Lunch amount</field>
|
||||
@@ -229,14 +249,18 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="ir.actions.act_window" id="action_report_lunch_amount_tree">
|
||||
<field name="name">Lunch amount</field>
|
||||
<field name="res_model">report.lunch.amount</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
<menuitem name="Cash Position by User" parent="menu_lunch_reporting_order" action="action_report_lunch_amount_tree" id="menu_lunch_report_amount_tree"/>
|
||||
|
||||
<menuitem name="Cash Position by User"
|
||||
parent="menu_lunch_reporting_order"
|
||||
action="action_report_lunch_amount_tree"
|
||||
id="menu_lunch_report_amount_tree" />
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
@@ -15,16 +15,16 @@
|
||||
# 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/>.
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
from osv import fields, osv
|
||||
|
||||
class lunch_cashbox_clean(osv.osv_memory):
|
||||
|
||||
|
||||
_name = "lunch.cashbox.clean"
|
||||
_description = "clean cashbox"
|
||||
|
||||
|
||||
def set_to_zero(self, cr, uid, ids, context):
|
||||
"""
|
||||
clean Cashbox. set active fields False.
|
||||
@@ -33,22 +33,24 @@ class lunch_cashbox_clean(osv.osv_memory):
|
||||
@param ids: List Lunch cashbox Clean’s IDs
|
||||
@return:Dictionary {}.
|
||||
"""
|
||||
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" % ','.join(map(str, context['active_ids'])))
|
||||
cr.execute("select user_cashmove, box,sum(amount) from lunch_cashmove \
|
||||
where active = 't' and box in (%s) group by user_cashmove, \
|
||||
box" % ','.join(map(str, data)))
|
||||
res = cr.fetchall()
|
||||
cr.execute("update lunch_cashmove set active = 'f' where active= 't' and box in (%s)" % ','.join(map(str, context['active_ids'])))
|
||||
## to_unactive= {}.fromkeys([r[0] for r in cr.fetchall]).keys()
|
||||
## print to_unactive
|
||||
## cashmove_ref.write(cr,uid,to_unactive,{'active':False})
|
||||
cr.execute("update lunch_cashmove set active = 'f' where active= 't' \
|
||||
and box in (%s)" % ','.join(map(str, 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,
|
||||
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()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Lunch cashbox -->
|
||||
|
||||
<record id="view_lunch_cashbox_clean" model="ir.ui.view">
|
||||
<field name="name">lunch.cashbox.clean.form</field>
|
||||
<field name="model">lunch.cashbox.clean</field>
|
||||
@@ -18,21 +21,21 @@
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="action_lunch_cashbox_clean" model="ir.actions.act_window">
|
||||
<field name="name">Set CashBox to Zero</field>
|
||||
<field name="res_model">lunch.cashbox.clean</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_lunch_cashbox_clean"/>
|
||||
<field name="view_id" ref="view_lunch_cashbox_clean"/>
|
||||
<field name="target">new</field>
|
||||
<field name="context">{'record_id':active_id}</field>
|
||||
</record>
|
||||
|
||||
|
||||
<act_window id="action_lunch_cashbox_clean_values"
|
||||
key2="client_action_multi" name="Set CashBox to Zero"
|
||||
res_model="lunch.cashbox.clean" src_model="lunch.cashbox"
|
||||
view_mode="form" target="new" view_type="form" />
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
@@ -15,7 +15,7 @@
|
||||
# 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/>.
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
from osv import fields, osv
|
||||
@@ -26,7 +26,7 @@ class lunch_order_cancel(osv.osv_memory):
|
||||
"""
|
||||
_name = "lunch.order.cancel"
|
||||
_description = "Cancel Order"
|
||||
|
||||
|
||||
def cancel(self, cr, uid, ids, context):
|
||||
"""
|
||||
Cancel cashmove entry from cashmoves and update state to draft.
|
||||
@@ -34,8 +34,9 @@ class lunch_order_cancel(osv.osv_memory):
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List Lunch Order Cancel’s IDs
|
||||
"""
|
||||
return self.pool.get('lunch.order').lunch_order_cancel(cr, uid, context['active_ids'], context)
|
||||
|
||||
data = context and context.get('active_ids', []) or []
|
||||
return self.pool.get('lunch.order').lunch_order_cancel(cr, uid, data, context)
|
||||
|
||||
lunch_order_cancel()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- cancel order -->
|
||||
|
||||
<record id="view_lunch_order_cancel" model="ir.ui.view">
|
||||
<field name="name">lunch.order.cancel.form</field>
|
||||
<field name="model">lunch.order.cancel</field>
|
||||
@@ -18,21 +21,21 @@
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="action_lunch_order_cancel" model="ir.actions.act_window">
|
||||
<field name="name">Cancel Order</field>
|
||||
<field name="res_model">lunch.order.cancel</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_lunch_order_cancel"/>
|
||||
<field name="view_id" ref="view_lunch_order_cancel"/>
|
||||
<field name="target">new</field>
|
||||
<field name="context">{'record_id':active_id}</field>
|
||||
</record>
|
||||
|
||||
|
||||
<act_window id="action_lunch_order_cancel_values"
|
||||
key2="client_action_multi" name="Cancel Order"
|
||||
res_model="lunch.order.cancel" src_model="lunch.order"
|
||||
view_mode="form" target="new" view_type="form" />
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
@@ -15,7 +15,7 @@
|
||||
# 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/>.
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
@@ -28,21 +28,22 @@ class lunch_order_confirm(osv.osv_memory):
|
||||
_name = "lunch.order.confirm"
|
||||
_description = "confirm Order"
|
||||
_columns = {
|
||||
'confirm_cashbox':fields.many2one('lunch.cashbox', 'Name of box', required=True),
|
||||
'confirm_cashbox':fields.many2one('lunch.cashbox', 'Name of box', required=True),
|
||||
}
|
||||
|
||||
|
||||
def confirm(self, cr, uid, ids, context):
|
||||
"""
|
||||
confirm Lunch Order.Create cashmoves in launch cashmoves when state is
|
||||
confirm Lunch Order.Create cashmoves in launch cashmoves when state is
|
||||
confirm in lunch order.
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List Lunch Order confirm’s IDs
|
||||
@return: Dictionary {}.
|
||||
@return: Dictionary {}.
|
||||
"""
|
||||
data = context and context.get('active_ids', []) or []
|
||||
order_ref = self.pool.get('lunch.order')
|
||||
for data in self.read(cr, uid, ids):
|
||||
order_ref.confirm(cr, uid, context['active_ids'], data['confirm_cashbox'], context)
|
||||
for confirm_obj in self.read(cr, uid, ids):
|
||||
order_ref.confirm(cr, uid, data, confirm_obj['confirm_cashbox'], context)
|
||||
return {}
|
||||
|
||||
lunch_order_confirm()
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- confirm order -->
|
||||
|
||||
<record id="view_lunch_order_confirm" model="ir.ui.view">
|
||||
<field name="name">lunch.order.confirm.form</field>
|
||||
<field name="model">lunch.order.confirm</field>
|
||||
@@ -20,21 +23,21 @@
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="action_lunch_order_confirm" model="ir.actions.act_window">
|
||||
<field name="name">Confirm Order</field>
|
||||
<field name="res_model">lunch.order.confirm</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_lunch_order_confirm"/>
|
||||
<field name="view_id" ref="view_lunch_order_confirm"/>
|
||||
<field name="target">new</field>
|
||||
<field name="context">{'record_id':active_id}</field>
|
||||
</record>
|
||||
|
||||
|
||||
<act_window id="action_lunch_order_confirm_values"
|
||||
key2="client_action_multi" name="Confirm Order"
|
||||
res_model="lunch.order.confirm" src_model="lunch.order"
|
||||
view_mode="form" target="new" view_type="form" />
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
Reference in New Issue
Block a user