diff --git a/addons/lunch/__init__.py b/addons/lunch/__init__.py deleted file mode 100644 index 949e893c0f0..00000000000 --- a/addons/lunch/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# -*- encoding: utf-8 -*- -import lunch -import wizard -import report -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/lunch/__terp__.py b/addons/lunch/__terp__.py deleted file mode 100644 index 46da1f5e13f..00000000000 --- a/addons/lunch/__terp__.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- encoding: utf-8 -*- -{ - "name": "Lunch Module", - "author": "Tiny", - "version": "0.1", - "depends": ["base", "process", "hr"], - "init_xml": [], - "update_xml": ['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: - diff --git a/addons/lunch/lunch.py b/addons/lunch/lunch.py deleted file mode 100644 index 167a075d95b..00000000000 --- a/addons/lunch/lunch.py +++ /dev/null @@ -1,171 +0,0 @@ -# -*- encoding: utf-8 -*- -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: - diff --git a/addons/lunch/lunch_demo.xml b/addons/lunch/lunch_demo.xml deleted file mode 100644 index e26680f5253..00000000000 --- a/addons/lunch/lunch_demo.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - Sandwich - - - - Club - - 2.75 - - - - Cashbox - - - - diff --git a/addons/lunch/lunch_report.xml b/addons/lunch/lunch_report.xml deleted file mode 100644 index 3cdd8cb418c..00000000000 --- a/addons/lunch/lunch_report.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - diff --git a/addons/lunch/lunch_view.xml b/addons/lunch/lunch_view.xml deleted file mode 100644 index 5862089067a..00000000000 --- a/addons/lunch/lunch_view.xml +++ /dev/null @@ -1,232 +0,0 @@ - - - - - - - - - - Order - lunch.order - -
- - - - - - - - - -
-
-
- - - Order - lunch.order - tree - - - - - - - - - - - - - - - - - Make order - lunch.order - form,tree - - - - - Order of the day - lunch.order - [('date','=',time.strftime('%Y-%m-%d'))] - - - - - - CashBox - lunch.cashbox - -
- - - - -
- - - CashBox - lunch.cashbox - tree - - - - - - - - - - - CashBox - lunch.cashbox - - - - - CashMove - lunch.cashmove - -
- - - - - - - -
- - - CashMove - lunch.cashmove - tree - - - - - - - - - - - - - CashMove - lunch.cashmove - - - - - - Category of product - lunch.category - -
- - - - -
- - - Category - lunch.category - tree - - - - - - - - - - Category of product - lunch.category - - - - Products - form - lunch.product - -
- - - - - - - -
- - - - Products - lunch.product - tree - - - - - - - - - - - - Product - lunch.product - - - - - - - - - Lunch amount - report.lunch.amount - tree - - - - - - - - - - - Lunch amount - report.lunch.amount - form - -
- - - - - -
- - - - Lunch amount - report.lunch.amount - form - tree,form - - -
-
- - diff --git a/addons/lunch/lunch_wizard.xml b/addons/lunch/lunch_wizard.xml deleted file mode 100644 index ec9f7fea855..00000000000 --- a/addons/lunch/lunch_wizard.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - diff --git a/addons/lunch/process/lunch_process.xml b/addons/lunch/process/lunch_process.xml deleted file mode 100644 index 4818d9d93f9..00000000000 --- a/addons/lunch/process/lunch_process.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/addons/lunch/report/__init__.py b/addons/lunch/report/__init__.py deleted file mode 100644 index efaffa8d307..00000000000 --- a/addons/lunch/report/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# -*- encoding: utf-8 -*- -import order -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/lunch/report/order.py b/addons/lunch/report/order.py deleted file mode 100644 index 7824bade083..00000000000 --- a/addons/lunch/report/order.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved. -# -# WARNING: This program as such is intended to be used by professional -# programmers who take the whole responsability of assessing all potential -# consequences resulting from its eventual inadequacies and bugs -# End users who are looking for a ready-to-use solution with commercial -# garantees and support are strongly adviced to contract a Free Software -# Service Company -# -# 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 2 -# 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, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -############################################################################## - -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: - diff --git a/addons/lunch/report/order.rml b/addons/lunch/report/order.rml deleted file mode 100644 index a7bc1b32cdd..00000000000 --- a/addons/lunch/report/order.rml +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Printed at : [[time.strftime("%Hh%M")]] - - - - - - - - - - - Name - - - Order - - - Description - - - Unit Price - - - -
- - - -
- - - - [[repeatIn(objects, 'o') ]] - [[ o.user_id.name ]] - - - [[o.product.name ]] - - - [[ o.descript ]] - - - - - - [['%.2f' % o.price ]] - - - - - - - - - - - - - - - - - - - - [[ '%.2f' % sum_price(objects) ]] - - - - - - -
-
- diff --git a/addons/lunch/wizard/__init__.py b/addons/lunch/wizard/__init__.py deleted file mode 100644 index 26328e41dc2..00000000000 --- a/addons/lunch/wizard/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# -*- encoding: utf-8 -*- -import confirm -import cancel -import reset_box -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/lunch/wizard/cancel.py b/addons/lunch/wizard/cancel.py deleted file mode 100644 index 15ad6b96451..00000000000 --- a/addons/lunch/wizard/cancel.py +++ /dev/null @@ -1,34 +0,0 @@ -# -*- encoding: utf-8 -*- - -import wizard -import netsvc -import ir -import pooler - -cancel_form = """ -
-