[ADD] lunch : Moduled added from trunk extra addons with new menu structure
bzr revid: vir@tinyerp.com-20100118125211-r3nfcsikheh76tkj
This commit is contained in:
parent
120bb1bda7
commit
e01abccc4c
|
@ -0,0 +1,26 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero 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 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import lunch
|
||||
import wizard
|
||||
import report
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero 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 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
{
|
||||
"name": "Lunch Module",
|
||||
"author": "Tiny",
|
||||
"version": "0.1",
|
||||
"depends": ["base"],
|
||||
"category" : "Generic Modules/Others",
|
||||
"init_xml": [],
|
||||
"update_xml": [
|
||||
'security/ir.model.access.csv',
|
||||
'lunch_wizard.xml',
|
||||
'lunch_view.xml',
|
||||
'lunch_report.xml',
|
||||
#'process/lunch_process.xml'
|
||||
],
|
||||
"demo_xml": ['lunch_demo.xml'],
|
||||
"installable": True,
|
||||
}
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,347 @@
|
|||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * lunch
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 5.0.6\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"POT-Creation-Date: 2009-11-26 04:56:11+0000\n"
|
||||
"PO-Revision-Date: 2009-11-26 04:56:11+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.model,name:lunch.model_lunch_category
|
||||
#: view:lunch.category:0
|
||||
#: field:lunch.product,category_id:0
|
||||
msgid "Category"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: wizard_view:lunch.cashbox.clean,init:0
|
||||
msgid "Reset cashbox"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: selection:lunch.order,state:0
|
||||
msgid "Confirmed"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: constraint:ir.model:0
|
||||
msgid "The Object name must start with x_ and not contain any special character !"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.model,name:lunch.model_lunch_cashmove
|
||||
msgid "lunch.cashmove"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: wizard_view:lunch.order.cancel,init:0
|
||||
msgid "Are you sure you want to cancel this order ?"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.module.module,shortdesc:lunch.module_meta_information
|
||||
msgid "Lunch Module"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.ui.menu,name:lunch.menu_lunch_cashmove_form
|
||||
msgid "Cash Moves"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: rml:lunch.order:0
|
||||
msgid "Printed at :"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.model,name:lunch.model_lunch_product
|
||||
msgid "lunch.product"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: wizard_view:lunch.cashbox.clean,init:0
|
||||
msgid "Are you sure you want to reset this cashbox ?"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: field:lunch.order,state:0
|
||||
msgid "State"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.ui.menu,name:lunch.menu_lunch_cashbox_form
|
||||
#: view:lunch.cashbox:0
|
||||
msgid "CashBox"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: selection:lunch.order,state:0
|
||||
msgid "Draft"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: constraint:ir.actions.act_window:0
|
||||
msgid "Invalid model name in the action definition."
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: field:lunch.cashmove,user_cashmove:0
|
||||
#: field:lunch.order,user_id:0
|
||||
#: field:report.lunch.amount,user_id:0
|
||||
msgid "User Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.ui.menu,name:lunch.menu_lunch_report_amount_tree
|
||||
#: view:report.lunch.amount:0
|
||||
msgid "Box Amount by User"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: view:report.lunch.amount:0
|
||||
msgid "Total box"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.actions.act_window,name:lunch.action_lunch_product_form
|
||||
#: field:lunch.order,product:0
|
||||
msgid "Product"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: rml:lunch.order:0
|
||||
#: field:lunch.product,description:0
|
||||
msgid "Description"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: field:lunch.order,price:0
|
||||
#: field:lunch.product,price:0
|
||||
msgid "Price"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: wizard_button:lunch.order.cancel,init,end:0
|
||||
msgid "No"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: view:lunch.category:0
|
||||
#: rml:lunch.order:0
|
||||
#: view:lunch.order:0
|
||||
msgid "Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: field:lunch.cashmove,create_date:0
|
||||
msgid "Created date"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.ui.menu,name:lunch.menu_lunch
|
||||
msgid "Lunch"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: field:lunch.order,descript:0
|
||||
msgid "Description Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.actions.wizard,name:lunch.lunch_order_confirm
|
||||
#: wizard_button:lunch.order.confirm,init,go:0
|
||||
msgid "Confirm Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: wizard_view:lunch.order.confirm,init:0
|
||||
msgid "Orders Confirmation"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: field:lunch.cashmove,active:0
|
||||
#: field:lunch.product,active:0
|
||||
msgid "Active"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.actions.act_window,name:lunch.action_lunch_order_day_form
|
||||
msgid " Order of the day"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.ui.menu,name:lunch.menu_lunch_category_root
|
||||
msgid "Configuration"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.actions.wizard,name:lunch.wizard_id_cancel
|
||||
#: wizard_view:lunch.order.cancel,init:0
|
||||
msgid "Cancel Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.actions.act_window,name:lunch.action_lunch_cashbox_form
|
||||
msgid " CashBox "
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: constraint:ir.ui.view:0
|
||||
msgid "Invalid XML for View Architecture!"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.actions.act_window,name:lunch.action_report_lunch_amount_tree
|
||||
msgid "Lunch amount"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: field:lunch.cashbox,name:0
|
||||
#: field:lunch.cashmove,name:0
|
||||
#: field:lunch.category,name:0
|
||||
#: rml:lunch.order:0
|
||||
#: field:lunch.product,name:0
|
||||
msgid "Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.actions.act_window,name:lunch.action_lunch_category_form
|
||||
msgid " Category of product "
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: view:lunch.cashmove:0
|
||||
msgid "Total amount"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.model,name:lunch.model_lunch_cashbox
|
||||
msgid "lunch.cashbox"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: field:lunch.order,date:0
|
||||
msgid "Date"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: field:lunch.cashmove,amount:0
|
||||
#: field:report.lunch.amount,amount:0
|
||||
msgid "Amount"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.ui.menu,name:lunch.menu_lunch_product_form
|
||||
#: view:lunch.product:0
|
||||
msgid "Products"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.ui.menu,name:lunch.menu_lunch_category_form
|
||||
msgid "Category of product"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.actions.report.xml,name:lunch.report_lunch_order
|
||||
msgid "Print Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.ui.menu,name:lunch.menu_lunch_order_day_form
|
||||
msgid "Order of the day"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.model,name:lunch.model_report_lunch_amount
|
||||
msgid "Amount available by user and box"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: view:lunch.category:0
|
||||
msgid "Category related to Products"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.model,name:lunch.model_lunch_order
|
||||
msgid "lunch.order"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: field:lunch.cashbox,sum_remain:0
|
||||
msgid "Remained Total"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.actions.act_window,name:lunch.action_lunch_order_form
|
||||
#: model:ir.ui.menu,name:lunch.menu_lunch_order_form
|
||||
msgid "Make order"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.actions.wizard,name:lunch.wizard_clean_cashbox
|
||||
msgid "Set CashBox to Zero"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: field:lunch.cashmove,box:0
|
||||
#: field:report.lunch.amount,box:0
|
||||
msgid "Box Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: field:lunch.cashbox,manager:0
|
||||
msgid "Manager"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: rml:lunch.order:0
|
||||
msgid "Unit Price"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: wizard_field:lunch.order.confirm,init,confirm_cashbox:0
|
||||
msgid "Name of box"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: view:lunch.order:0
|
||||
msgid "Total price"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: wizard_button:lunch.cashbox.clean,init,end:0
|
||||
#: wizard_button:lunch.order.confirm,init,end:0
|
||||
msgid "Cancel"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: wizard_button:lunch.cashbox.clean,init,zero:0
|
||||
msgid "Set to Zero"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: wizard_button:lunch.order.cancel,init,cancel:0
|
||||
msgid "Yes"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.ui.menu,name:lunch.menu_tools
|
||||
msgid "Tools"
|
||||
msgstr ""
|
||||
|
||||
#. module: lunch
|
||||
#: model:ir.actions.act_window,name:lunch.action_lunch_cashmove_form
|
||||
#: view:lunch.cashmove:0
|
||||
#: field:lunch.order,cashmove:0
|
||||
msgid "CashMove"
|
||||
msgstr ""
|
||||
|
|
@ -0,0 +1,191 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero 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 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv, fields
|
||||
import time
|
||||
|
||||
class lunch_category(osv.osv):
|
||||
_name = 'lunch.category'
|
||||
_description = "Category"
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Name', required=True, size=50),
|
||||
}
|
||||
|
||||
_order = 'name'
|
||||
|
||||
lunch_category()
|
||||
|
||||
class lunch_product(osv.osv):
|
||||
_name = 'lunch.product'
|
||||
|
||||
def _category_name_get(self, cr, uid, context={}):
|
||||
obj = self.pool.get('lunch.category')
|
||||
cat_ids= obj.search(cr,uid,[])
|
||||
res = obj.read(cr,uid,cat_ids,['name', 'category'])
|
||||
return [(str(r['id']), r['name']) for r in res]+ [('0','')]
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Name', size=50, required=True),
|
||||
'category_id': fields.selection(_category_name_get, 'Category', size=32),
|
||||
'description': fields.char('Description', size=128, required=False),
|
||||
'price': fields.float('Price', digits=(16,2)),
|
||||
'active': fields.boolean('Active'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'active': lambda *a : True,
|
||||
}
|
||||
|
||||
lunch_product()
|
||||
|
||||
class lunch_cashbox(osv.osv):
|
||||
_name='lunch.cashbox'
|
||||
|
||||
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 :
|
||||
r.setdefault(i,0)
|
||||
return r
|
||||
|
||||
_columns={
|
||||
'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):
|
||||
_name= 'lunch.cashmove'
|
||||
|
||||
_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'),
|
||||
'create_date': fields.datetime('Created date', readonly=True),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
'active': lambda *a: True,
|
||||
}
|
||||
|
||||
lunch_cashmove()
|
||||
|
||||
|
||||
|
||||
class lunch_order(osv.osv):
|
||||
_name='lunch.order'
|
||||
_rec_name= "user_id"
|
||||
|
||||
def _price_get(self, cr, uid, ids, name, args, context=None):
|
||||
res = {}
|
||||
for o in self.browse(cr, uid, ids):
|
||||
res[o.id] = o.product.price
|
||||
return res
|
||||
|
||||
_columns={
|
||||
'user_id': fields.many2one('res.users','User Name', required=True,
|
||||
readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'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,
|
||||
states={'draft':[('readonly',False)]}),
|
||||
'state': fields.selection([('draft','Draft'), ('confirmed','Confirmed'),],
|
||||
'State', readonly=True, select=True),
|
||||
'price': fields.function(_price_get, method=True, string="Price"),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
'user_id': lambda self,cr,uid,context: uid,
|
||||
'date': lambda self,cr,uid,context: time.strftime('%Y-%m-%d'),
|
||||
'state': lambda self,cr,uid,context: 'draft',
|
||||
}
|
||||
|
||||
def confirm(self,cr,uid,ids,box,context):
|
||||
cashmove_ref= self.pool.get('lunch.cashmove')
|
||||
for order in self.browse(cr,uid,ids):
|
||||
if order.state == 'confirmed':
|
||||
continue
|
||||
new_id= cashmove_ref.create(cr,uid,{'name': order.product.name+' order',
|
||||
'amount':-order.product.price,
|
||||
'user_cashmove':order.user_id.id,
|
||||
'box':box,
|
||||
'active':True,
|
||||
})
|
||||
self.write(cr,uid,[order.id],{'cashmove':new_id, 'state':'confirmed'})
|
||||
return {}
|
||||
|
||||
def lunch_order_cancel(self,cr,uid,ids,context):
|
||||
orders= self.browse(cr,uid,ids)
|
||||
for order in orders:
|
||||
if not order.cashmove:
|
||||
continue
|
||||
self.pool.get('lunch.cashmove').unlink(cr, uid, [order.cashmove.id])
|
||||
self.write(cr,uid,ids,{'state':'draft'})
|
||||
return {}
|
||||
|
||||
def onchange_product(self, cr, uid, ids, product):
|
||||
if not product:
|
||||
return {'value': {'price': 0.0}}
|
||||
price = self.pool.get('lunch.product').read(cr, uid, product, ['price'])['price']
|
||||
return {'value': {'price': price}}
|
||||
|
||||
lunch_order()
|
||||
|
||||
class report_lunch_amount(osv.osv):
|
||||
_name='report.lunch.amount'
|
||||
_description = "Amount available by user and box"
|
||||
_auto = False
|
||||
_rec_name= "user"
|
||||
|
||||
_columns = {
|
||||
'user_id': fields.many2one('res.users','User Name',readonly=True),
|
||||
'amount': fields.float('Amount', readonly=True, digits=(16,2)),
|
||||
'box':fields.many2one('lunch.cashbox','Box Name',size=30,readonly=True),
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
cr.execute("""
|
||||
create or replace view report_lunch_amount as (
|
||||
select
|
||||
min(lc.id) as id,
|
||||
lc.user_cashmove as user_id,
|
||||
sum(amount) as amount,
|
||||
lc.box as box
|
||||
from
|
||||
lunch_cashmove lc
|
||||
where
|
||||
active = 't'
|
||||
group by lc.user_cashmove, lc.box
|
||||
)""")
|
||||
|
||||
report_lunch_amount()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
|
||||
<record model="lunch.category" id="categ_sandwich">
|
||||
<field name="name">Sandwich</field>
|
||||
</record>
|
||||
|
||||
<record model="lunch.product" id="product_club">
|
||||
<field name="name">Club</field>
|
||||
<field name="category_id" eval="str(ref('categ_sandwich'))"/>
|
||||
<field name="price">2.75</field>
|
||||
</record>
|
||||
|
||||
<record model="lunch.cashbox" id="cashbox_cashbox">
|
||||
<field name="name">Cashbox</field>
|
||||
<field name="manager" ref="base.user_admin"/>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<report
|
||||
id="report_lunch_order"
|
||||
string="Print Order"
|
||||
model="lunch.order"
|
||||
name="lunch.order"
|
||||
rml="lunch/report/order.rml"
|
||||
auto="False"
|
||||
/>
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,235 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<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"/>
|
||||
|
||||
<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">
|
||||
<form string="Order">
|
||||
<group colspan="2" col="4">
|
||||
<field name="user_id" select="1"/>
|
||||
<field name="date" select="1"/>
|
||||
<field name="product" select="1" on_change="onchange_product(product)"/>
|
||||
<field name="price"/>
|
||||
<field name="descript"/>
|
||||
<field name="cashmove"/>
|
||||
<field name="state" select="2"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_order_tree">
|
||||
<field name="name">Order</field>
|
||||
<field name="model">lunch.order</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Order">
|
||||
<field name="user_id"/>
|
||||
<field name="product"/>
|
||||
<field name="date"/>
|
||||
<field name="cashmove"/>
|
||||
<field name="state"/>
|
||||
<field name="descript"/>
|
||||
<field name="price" sum="Total price"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
<record model="ir.actions.act_window" id="action_lunch_order_form">
|
||||
<field name="name">Orders</field>
|
||||
<field name="res_model">lunch.order</field>
|
||||
<field name="view_mode">form,tree</field>
|
||||
</record>
|
||||
<menuitem name="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"/>-->
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_cashbox_form">
|
||||
<field name="name">CashBox</field>
|
||||
<field name="model">lunch.cashbox</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="CashBox">
|
||||
<field name="name" select="1"/>
|
||||
<field name="manager" select="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_cashbox_tree">
|
||||
<field name="name">CashBox</field>
|
||||
<field name="model">lunch.cashbox</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="CashBox" colors="red:sum_remain<=0">
|
||||
<field name="name" select="1"/>
|
||||
<field name="manager" select="1"/>
|
||||
<field name="sum_remain" select="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_lunch_cashbox_form">
|
||||
<field name="name"> CashBox </field>
|
||||
<field name="res_model">lunch.cashbox</field>
|
||||
</record>
|
||||
<menuitem name="CashBox" parent="menu_lunch_category_root" id="menu_lunch_cashbox_form" action="action_lunch_cashbox_form"/>
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_cashmove_form">
|
||||
<field name="name">CashMove</field>
|
||||
<field name="model">lunch.cashmove</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="CashMove">
|
||||
<field name="name" select="1"/>
|
||||
<field name="user_cashmove" select="1"/>
|
||||
<field name="amount" select="2"/>
|
||||
<field name="box" select="1"/>
|
||||
<field name="create_date" select="1"/>
|
||||
<field name="active" select="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_cashmove_tree">
|
||||
<field name="name">CashMove</field>
|
||||
<field name="model">lunch.cashmove</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="CashMove" editable="top">
|
||||
<field name="name" select="1" required="1"/>
|
||||
<field name="user_cashmove" select="1"/>
|
||||
<field name="amount" select="1" sum="Total amount"/>
|
||||
<field name="box" select="1"/>
|
||||
<field name="create_date"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_lunch_cashmove_form">
|
||||
<field name="name">CashMove</field>
|
||||
<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"/>
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_category_form">
|
||||
<field name="name"> Category of product </field>
|
||||
<field name="model">lunch.category</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Category">
|
||||
<separator string="Category related to Products" colspan="4"/>
|
||||
<field name="name" select="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_category_tree">
|
||||
<field name="name">Category</field>
|
||||
<field name="model">lunch.category</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Order">
|
||||
<field name="name" select="1"/>
|
||||
</tree>
|
||||
</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>
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_product_form">
|
||||
<field name="name">Products</field>
|
||||
<field name="type">form</field>
|
||||
<field name="model">lunch.product</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Products">
|
||||
<field name="name" select="1"/>
|
||||
<field name="category_id" select="1"/>
|
||||
<field name="description" select="1"/>
|
||||
<field name="price" select="1"/>
|
||||
<field name="active" select="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_product_tree">
|
||||
<field name="name">Products</field>
|
||||
<field name="model">lunch.product</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Products">
|
||||
<field name="name" select="1"/>
|
||||
<field name="category_id" select="1"/>
|
||||
<field name="description" select="1"/>
|
||||
<field name="price" select="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_lunch_product_form">
|
||||
<field name="name">Product</field>
|
||||
<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" id="menu_lunch_product_form" action="action_lunch_product_form" sequence="2"/>
|
||||
<menuitem name="Category of product" parent="menu_lunch_category_root" id="menu_lunch_category_form" action="action_lunch_category_form" sequence="1"/>
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="view_report_lunch_amount_tree">
|
||||
<field name="name">Lunch amount</field>
|
||||
<field name="model">report.lunch.amount</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Box Amount by User">
|
||||
<field name="box" select="1"/>
|
||||
<field name="user_id" select="1"/>
|
||||
<field name="amount" select="1" sum="Total box" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_report_lunch_amount_form">
|
||||
<field name="name">Lunch amount</field>
|
||||
<field name="model">report.lunch.amount</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Box Amount by User">
|
||||
<field name="user_id" select="1"/>
|
||||
<field name="box" select="1"/>
|
||||
<field name="amount" select="1"/>
|
||||
</form>
|
||||
</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"/>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data>
|
||||
<wizard
|
||||
string="Confirm Order"
|
||||
model="lunch.order"
|
||||
name="lunch.order.confirm"
|
||||
keyword="client_action_multi"
|
||||
id="lunch_order_confirm"/>
|
||||
|
||||
<wizard
|
||||
string="Cancel Order"
|
||||
model="lunch.order"
|
||||
name="lunch.order.cancel"
|
||||
keyword="client_action_multi"
|
||||
id="wizard_id_cancel"/>
|
||||
|
||||
<wizard
|
||||
string="Set CashBox to Zero"
|
||||
model="lunch.cashbox"
|
||||
name="lunch.cashbox.clean"
|
||||
keyword="client_action_multi"
|
||||
id="wizard_clean_cashbox"/>
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,24 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero 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 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import order
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero 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 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
from report import report_sxw
|
||||
from osv import osv
|
||||
|
||||
|
||||
class order(report_sxw.rml_parse):
|
||||
|
||||
def sum_price(self, orders):
|
||||
res = 0.0
|
||||
for o in orders:
|
||||
res += o.price
|
||||
return res
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(order, self).__init__(cr, uid, name, context)
|
||||
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'sum_price': self.sum_price,
|
||||
})
|
||||
|
||||
report_sxw.report_sxw('report.lunch.order', 'lunch.order',
|
||||
'addons/lunch/report/order.rml',parser=order, header=False)
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
<?xml version="1.0"?>
|
||||
<document filename="test.pdf">
|
||||
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
|
||||
<pageTemplate id="first">
|
||||
<frame id="first" x1="34.0" y1="42.0" width="527" height="758"/>
|
||||
</pageTemplate>
|
||||
</template>
|
||||
<stylesheet>
|
||||
<blockTableStyle id="Standard_Outline">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Tableau2">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="GRID" colorName="black"/>
|
||||
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="3,0" stop="3,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Tableau1">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="GRID" colorName="black"/>
|
||||
</blockTableStyle>
|
||||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
<paraStyle name="P1" fontName="Times-Roman" fontSize="15.0" leading="19"/>
|
||||
<paraStyle name="P2" fontName="Times-Roman" fontSize="16.0" leading="20"/>
|
||||
<paraStyle name="P3" fontName="Times-Roman"/>
|
||||
<paraStyle name="P4" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="CENTER"/>
|
||||
<paraStyle name="P5" fontName="Times-BoldItalic" fontSize="9.0" leading="11" alignment="LEFT"/>
|
||||
<paraStyle name="P6" fontName="Times-BoldItalic" fontSize="9.0" leading="11"/>
|
||||
<paraStyle name="P7" fontName="Times-Italic" fontSize="9.0" leading="11" alignment="LEFT"/>
|
||||
<paraStyle name="P8" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT"/>
|
||||
<paraStyle name="P9" fontName="Times-Roman" fontSize="9.0" leading="11"/>
|
||||
<paraStyle name="P10" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT"/>
|
||||
<paraStyle name="P11" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT"/>
|
||||
<paraStyle name="P12" fontName="Times-BoldItalic" fontSize="6.0" leading="8"/>
|
||||
<paraStyle name="P13" fontName="Times-Italic" fontSize="9.0" leading="11" alignment="LEFT"/>
|
||||
<paraStyle name="P14" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT"/>
|
||||
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Header" fontName="Times-Roman"/>
|
||||
<paraStyle name="Footer" fontName="Times-Roman"/>
|
||||
<paraStyle name="Table Contents" fontName="Times-Roman"/>
|
||||
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
|
||||
<paraStyle name="Caption" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Footnote" rightIndent="0.0" leftIndent="14.0" fontName="Times-Roman" fontSize="10.0" leading="13"/>
|
||||
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||
</stylesheet>
|
||||
<story>
|
||||
<para style="P1">
|
||||
<font face="Times-Roman">Printed at : [[time.strftime("%Hh%M")]]</font>
|
||||
</para>
|
||||
<para style="P2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P3">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="149.0,135.0,103.0,140.0" repeatRows="1" style="Tableau2">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P4">Name</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Order</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Description</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Unit Price</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<section>
|
||||
<para style="P5">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</section>
|
||||
<blockTable colWidths="148.0,135.0,103.0,140.0" style="Tableau1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P7">[[repeatIn(objects, 'o') ]]</para>
|
||||
<para style="P7">[[ o.user_id.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[o.product.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9">[[ o.descript ]]</para>
|
||||
<para style="P10">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P14">[['%.2f' % o.price ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P11">[[ '%.2f' % sum_price(objects) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P6">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</story>
|
||||
</document>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
|
||||
"access_lunch_category","lunch.category","model_lunch_category",base.group_user,1,1,1,1
|
||||
"access_lunch_product","lunch.product","model_lunch_product",base.group_user,1,1,1,1
|
||||
"access_lunch_cashbox","lunch.cashbox","model_lunch_cashbox",base.group_user,1,1,1,1
|
||||
"access_lunch_cashmove","lunch.cashmove","model_lunch_cashmove",base.group_user,1,1,1,1
|
||||
"access_lunch_order","lunch.order","model_lunch_order",base.group_user,1,1,1,1
|
||||
"access_report_lunch_amount","report.lunch.amount","model_report_lunch_amount",base.group_user,1,1,1,1
|
|
|
@ -0,0 +1,26 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero 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 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import confirm
|
||||
import cancel
|
||||
import reset_box
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero 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 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
import ir
|
||||
import pooler
|
||||
|
||||
cancel_form = """<?xml version="1.0"?>
|
||||
<form string="Cancel Order">
|
||||
<label string="Are you sure you want to cancel this order ?"/>
|
||||
</form>"""
|
||||
|
||||
|
||||
cancel_fields = {
|
||||
}
|
||||
|
||||
def _cancel(self,cr,uid,data,context):
|
||||
return pooler.get_pool(cr.dbname).get('lunch.order').lunch_order_cancel(cr,uid,data['ids'],context)
|
||||
|
||||
class order_cancel(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type':'form', 'arch':cancel_form, 'fields':cancel_fields, 'state':[('end','No'),('cancel','Yes')]}
|
||||
},
|
||||
'cancel': {
|
||||
'actions': [_cancel],
|
||||
'result': {'type':'state', 'state':'end'}
|
||||
}
|
||||
}
|
||||
order_cancel('lunch.order.cancel')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero 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 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
import ir
|
||||
import pooler
|
||||
|
||||
confirm_order_form = """<?xml version="1.0"?>
|
||||
<form title="Confirm">
|
||||
<separator string="Orders Confirmation" colspan="4"/>
|
||||
<field name="confirm_cashbox"/>
|
||||
<newline/>
|
||||
</form>
|
||||
"""
|
||||
|
||||
confirm_order_fields = {
|
||||
'confirm_cashbox': {'string':'Name of box', 'type':'many2one', 'required':True, 'relation':'lunch.cashbox' },
|
||||
}
|
||||
|
||||
def _confirm(self,cr,uid,data,context):
|
||||
pool= pooler.get_pool(cr.dbname)
|
||||
order_ref = pool.get('lunch.order')
|
||||
order_ref.confirm(cr,uid,data['ids'],data['form']['confirm_cashbox'],context)
|
||||
return {}
|
||||
|
||||
class order_confirm(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'action':[],
|
||||
'result':{'type' : 'form', 'arch' : confirm_order_form, 'fields' : confirm_order_fields, 'state' : [('end', 'Cancel'),('go', 'Confirm Order') ]},
|
||||
},
|
||||
'go' : {
|
||||
'actions' : [_confirm],
|
||||
'result' : {'type' : 'state', 'state' : 'end'}
|
||||
},
|
||||
}
|
||||
order_confirm('lunch.order.confirm')
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero 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 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
import ir
|
||||
import pooler
|
||||
|
||||
set_to_zero_form = """<?xml version="1.0"?>
|
||||
<form string="Reset cashbox">
|
||||
<label string="Are you sure you want to reset this cashbox ?"/>
|
||||
</form>"""
|
||||
|
||||
|
||||
|
||||
confirm_setting_zero_fields = {}
|
||||
|
||||
def _set_to_zero(self,cr,uid,data,context):
|
||||
pool= pooler.get_pool(cr.dbname)
|
||||
cashmove_ref = 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,data['ids'])))
|
||||
res= cr.fetchall()
|
||||
cr.execute("update lunch_cashmove set active = 'f' where active= 't' and box in (%s)"%','.join(map(str,data['ids'])))
|
||||
## to_unactive= {}.fromkeys([r[0] for r in cr.fetchall]).keys()
|
||||
## print to_unactive
|
||||
## cashmove_ref.write(cr,uid,to_unactive,{'active':False})
|
||||
##
|
||||
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 {}
|
||||
|
||||
|
||||
class cashbox_set_to_zero(wizard.interface):
|
||||
|
||||
states = {
|
||||
|
||||
'init': {
|
||||
'action':[],
|
||||
'result':{'type' : 'form',
|
||||
'arch' : set_to_zero_form,
|
||||
'fields' : confirm_setting_zero_fields,
|
||||
'state' : [('end', 'Cancel'),('zero', 'Set to Zero') ]},
|
||||
|
||||
},
|
||||
'zero' : {
|
||||
'actions' : [_set_to_zero],
|
||||
'result' : {'type' : 'state', 'state' : 'end'}
|
||||
},
|
||||
}
|
||||
|
||||
cashbox_set_to_zero('lunch.cashbox.clean')
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
Loading…
Reference in New Issue