+ A lunch order is defined by its user, date and order lines.
+ Each order line corresponds to a product, an additional note and a price.
+ Before selecting your order lines, don't forget to read the warnings displayed in the reddish area.
+
+
+
+
+
+
+
+ Your Account
+ lunch.cashmove
+ tree
+
+ {"search_default_is_mine":1}
+
+
+ Here you can see your cash moves. A cash moves can be either an expense or a payment.
+ An expense is automatically created when an order is received while a payment is a reimbursement to the company encoded by the manager.
+
+
+
+
+
+
+
+ Orders by Supplier
+ lunch.order.line
+ tree
+
+ {"search_default_group_by_supplier":1, "search_default_today":1}
+
+
+ Here you can see today's orders grouped by suppliers.
+
+
+ - Click on the to announce that the order is ordered
+ - Click on the to announce that the order is received
+ - Click on the to announce that the order isn't available
+
+
+
+
+
+
+
+ Control Suppliers
+ lunch.order.line
+ tree
+
+ {"search_default_group_by_date":1, "search_default_group_by_supplier":1}
+
+
+ Here you can see every orders grouped by suppliers and by date.
+
+
+ - Click on the to announce that the order is ordered
+ - Click on the to announce that the order is received
+ - Click on the red X to announce that the order isn't available
+
+ A cashmove can either be an expense or a payment.
+ An expense is automatically created at the order receipt.
+ A payment represents the employee reimbursement to the company.
+
+ Alerts are used to warn employee from possible issues concerning the lunch orders.
+ To create a lunch alert you have to define its recurrency, the time interval during which the alert should be executed and the message to display.
+
+
+ Example:
+ - Recurency: Everyday
+ - Time interval: from 00h00 am to 11h59 pm
+ - Message: "You must order before 10h30 am"
+
+
+
+
+
+
+
+ Order lines Tree
+ lunch.order.line
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Orders Tree View
+ lunch.order
+ tree
+
+
+
+
+
+
+
+
+
+
+
+ Lunch Orderlunch.order
-
+
+
+
+
+ Products Tree
+ lunch.product
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+ Products Form
+ lunch.product
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ cashmove tree
+ lunch.cashmove
+ tree
+
+
+
+
+
+
+
+
+
+
+
+ cashmove form
+ lunch.cashmove
+ form
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+ alert tree
+ lunch.alert
+ tree
+
+
+
+
+
+
+
+
+
+
+
+ alert form
+ lunch.alert
+ form
+
+
- [[ (lines.product and lines.product.name) or '' ]]
+ [[ (lines.product_id and lines.product_id.name) or '' ]]
- [[ lines.descript]]
+ [[ lines.note]]
- [[ formatLang(lines.price , currency_obj = o.company_id and o.company_id.currency_id) ]]
+ [[ lines.price ]] [[ (o.company_id and o.company_id.currency_id and o.company_id.currency_id.symbol) or '' ]]
@@ -172,7 +172,7 @@
Total :
- [[ formatLang(get_nettotal(), currency_obj = o.company_id and o.company_id.currency_id) ]]
+ [[ formatLang(get_nettotal()) ]] [[ (o.company_id and o.company_id.currency_id and o.company_id.currency_id.symbol) or '' ]]
diff --git a/addons/lunch/report/report_lunch_order.py b/addons/lunch/report/report_lunch_order.py
index 7e2b8de9f49..3a0875c1cd1 100644
--- a/addons/lunch/report/report_lunch_order.py
+++ b/addons/lunch/report/report_lunch_order.py
@@ -23,7 +23,7 @@ import tools
from osv import fields,osv
class report_lunch_order(osv.osv):
- _name = "report.lunch.order"
+ _name = "report.lunch.order.line"
_description = "Lunch Orders Statistics"
_auto = False
_rec_name = 'date'
@@ -35,32 +35,29 @@ class report_lunch_order(osv.osv):
('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
'day': fields.char('Day', size=128, readonly=True),
'user_id': fields.many2one('res.users', 'User Name'),
- 'box_name': fields.char('Name', size=30),
'price_total':fields.float('Total Price', readonly=True),
+ 'note' : fields.text('Note',size=256,readonly=True),
}
_order = 'date desc'
def init(self, cr):
- tools.drop_view_if_exists(cr, 'report_lunch_order')
+ tools.drop_view_if_exists(cr, 'report_lunch_order_line')
cr.execute("""
- create or replace view report_lunch_order as (
+ create or replace view report_lunch_order_line as (
select
min(lo.id) as id,
+ lo.user_id as user_id,
lo.date as date,
to_char(lo.date, 'YYYY') as year,
to_char(lo.date, 'MM') as month,
to_char(lo.date, 'YYYY-MM-DD') as day,
- lo.user_id,
- cm.name as box_name,
+ lo.note as note,
sum(lp.price) as price_total
from
- lunch_order as lo
- left join lunch_cashmove as cm on (cm.id = lo.cashmove)
- left join lunch_cashbox as lc on (lc.id = cm.box)
- left join lunch_product as lp on (lo.product = lp.id)
-
+ lunch_order_line as lo
+ left join lunch_product as lp on (lo.product_id = lp.id)
group by
- lo.date,lo.user_id,cm.name
+ lo.date,lo.user_id,lo.note
)
""")
report_lunch_order()
diff --git a/addons/lunch/report/report_lunch_order_view.xml b/addons/lunch/report/report_lunch_order_view.xml
index e92007592ac..f7bfdcd7395 100644
--- a/addons/lunch/report/report_lunch_order_view.xml
+++ b/addons/lunch/report/report_lunch_order_view.xml
@@ -2,50 +2,6 @@
-
- report.lunch.order.tree
- report.lunch.order
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- report.lunch.order.search
- report.lunch.order
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Lunch Order Analysis
- report.lunch.order
- form
- tree
-
- {'search_default_month':1,'search_default_User':1}
-
-
-
-
diff --git a/addons/lunch/security/ir.model.access.csv b/addons/lunch/security/ir.model.access.csv
index 72c06cceb2b..026a43e0a61 100644
--- a/addons/lunch/security/ir.model.access.csv
+++ b/addons/lunch/security/ir.model.access.csv
@@ -1,8 +1,13 @@
-id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
-access_lunch_order_user,lunch.order user,model_lunch_order,base.group_tool_user,1,1,1,1
-access_lunch_cashmove_user,lunch.cashmove user,model_lunch_cashmove,base.group_tool_user,1,1,1,1
-access_report_lunch_amount_manager,report.lunch.amount manager,model_report_lunch_amount,base.group_tool_manager,1,1,1,1
-access_lunch_category_manager,lunch.category.user,model_lunch_category,base.group_tool_user,1,1,1,1
-access_report_lunch_order_manager,report.lunch.order manager,model_report_lunch_order,base.group_tool_manager,1,1,1,1
-access_lunch_product_user,lunch.product user,model_lunch_product,base.group_tool_user,1,1,1,1
-access_lunch_cashbox_user,lunch.cashbox user,model_lunch_cashbox,base.group_tool_user,1,1,1,1
+id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink
+order_user,"Order user",model_lunch_order,group_lunch_manager,1,1,1,1
+order_line_user,"Order Line user",model_lunch_order_line,group_lunch_manager,1,1,1,1
+cashmove_user,"Cashmove user",model_lunch_cashmove,group_lunch_manager,1,1,1,1
+product_user,"Product user",model_lunch_product,group_lunch_manager,1,1,1,1
+product_category_user,"Product category user",model_lunch_product_category,group_lunch_manager,1,1,1,1
+alert_user,"Alert user",model_lunch_alert,group_lunch_manager,1,1,1,1
+order_user,"Order user",model_lunch_order,group_lunch_user,1,1,1,0
+order_line_user,"Order Line user",model_lunch_order_line,group_lunch_user,1,1,1,1
+cashmove_user,"Cashmove user",model_lunch_cashmove,group_lunch_user,1,0,0,0
+product_user,"Product user",model_lunch_product,group_lunch_user,1,0,0,0
+product_category_user,"Product category user",model_lunch_product_category,group_lunch_user,1,0,0,0
+alert_user,"Alert user",model_lunch_alert,group_lunch_user,1,0,0,0
\ No newline at end of file
diff --git a/addons/lunch/security/lunch_security.xml b/addons/lunch/security/lunch_security.xml
index 46293a97561..75ab0836b12 100644
--- a/addons/lunch/security/lunch_security.xml
+++ b/addons/lunch/security/lunch_security.xml
@@ -1,17 +1,11 @@
-
+
-
-
-
- User
-
-
-
- Manager
-
-
-
-
-
-
+
+
+ Lunch / Manager
+
+
+ Lunch / User
+
+
diff --git a/addons/lunch/static/src/css/Makefile b/addons/lunch/static/src/css/Makefile
new file mode 100644
index 00000000000..941e8dbfe7d
--- /dev/null
+++ b/addons/lunch/static/src/css/Makefile
@@ -0,0 +1,3 @@
+lunch.css: lunch.sass
+ sass -t expanded lunch.sass lunch.css
+
diff --git a/addons/lunch/static/src/css/lunch.css b/addons/lunch/static/src/css/lunch.css
new file mode 100644
index 00000000000..96e39c53fa6
--- /dev/null
+++ b/addons/lunch/static/src/css/lunch.css
@@ -0,0 +1,43 @@
+@charset "utf-8";
+.openerp .oe_lunch .oe_lunch_alert textarea {
+ background-color: #ffc7c7;
+ padding: 10px;
+ height: 1em;
+ margin-bottom: 20px;
+}
+.openerp .oe_lunch button.oe_button_add {
+ position: relative;
+ top: -2px;
+ left: 3px;
+}
+.openerp .oe_lunch button.oe_button_plus {
+ margin: -2px;
+}
+.openerp .oe_lunch .oe_lunch_30pc {
+ width: 30%;
+ display: inline-block;
+ vertical-align: top;
+}
+.openerp .oe_lunch .oe_lunch_30pc:nth-child(3) {
+ padding-right: 0;
+}
+.openerp .oe_lunch .oe_lunch_30pc {
+ padding-right: 5%;
+}
+.openerp .oe_lunch h2 {
+ color: #7c7bad;
+}
+.openerp .oe_lunch .oe_lunch_button {
+ float: right;
+}
+.openerp .oe_lunch .oe_lunch_vignette {
+ border-bottom: 1px solid #dddddd;
+ padding-top: 5px;
+ padding-bottom: 5px;
+}
+.openerp .oe_lunch .oe_lunch_vignette:last-child {
+ border: none;
+}
+.openerp .oe_lunch .oe_group_text_button {
+ margin-bottom: 3px;
+}
diff --git a/addons/lunch/static/src/css/lunch.sass b/addons/lunch/static/src/css/lunch.sass
new file mode 100644
index 00000000000..9612b5fdd3d
--- /dev/null
+++ b/addons/lunch/static/src/css/lunch.sass
@@ -0,0 +1,36 @@
+@charset "utf-8"
+
+.openerp
+ .oe_lunch
+ .oe_lunch_alert
+ textarea
+ background-color: #ffc7c7
+ padding: 10px
+ height: 1em
+ margin-bottom: 20px
+ button.oe_button_add
+ position: relative
+ top: -2px
+ left: 3px
+ button.oe_button_plus
+ margin: -2px
+ .oe_lunch_30pc
+ width: 30%
+ display: inline-block
+ vertical-align: top
+ .oe_lunch_30pc:nth-child(3)
+ padding-right: 0
+ .oe_lunch_30pc
+ padding-right: 5%
+ h2
+ color: #7C7BAD
+ .oe_lunch_button
+ float: right
+ .oe_lunch_vignette
+ border-bottom: 1px solid #dddddd
+ padding-top: 5px
+ padding-bottom: 5px
+ .oe_lunch_vignette:last-child
+ border: none
+ .oe_group_text_button
+ margin-bottom: 3px
diff --git a/addons/lunch/static/src/img/icon.png b/addons/lunch/static/src/img/icon.png
index 7493a3c7f4e..0dda33edd50 100644
Binary files a/addons/lunch/static/src/img/icon.png and b/addons/lunch/static/src/img/icon.png differ
diff --git a/addons/lunch/test/lunch_report.yml b/addons/lunch/test/lunch_report.yml
deleted file mode 100644
index 2043afe7796..00000000000
--- a/addons/lunch/test/lunch_report.yml
+++ /dev/null
@@ -1,8 +0,0 @@
--
- In order to test the PDF reports defined on a Lunch, we will print a Lunch Order Report
--
- !python {model: lunch.order}: |
- import netsvc, tools, os
- (data, format) = netsvc.LocalService('report.lunch.order').create(cr, uid, [ref('lunch.lunch_order_0'),ref('lunch.lunch_order_1')], {}, {})
- if tools.config['test_report_directory']:
- file(os.path.join(tools.config['test_report_directory'], 'lunch-lunch_order_report.'+format), 'wb+').write(data)
diff --git a/addons/lunch/test/test_lunch.yml b/addons/lunch/test/test_lunch.yml
deleted file mode 100644
index 7cb23f52dbf..00000000000
--- a/addons/lunch/test/test_lunch.yml
+++ /dev/null
@@ -1,128 +0,0 @@
-- |
- In order to test the Lunch module in OpenERP,
- I will create one lunch order and then check the effect on cashboxes and cashmoves
-
-- |
- Given that I have a category of lunch products "Burger".
--
- !record {model: lunch.category, id: lunch_category_burger0}:
- name: Burger
-- |
- Given that I have a product "Club1" in this category with a price of "2.75".
-
--
- !record {model: lunch.product, id: lunch_product_club1}:
- category_id: lunch_category_burger0
- name: Club1
- price: 2.75
-- |
- Given that I have a cashbox "Employee Cashbox"
--
- !record {model: lunch.cashbox, id: lunch_cashbox_cashbox0}:
- manager: base.user_root
- name: Employee Cashbox
-- |
- I create a lunch order "LU001" for the "Club1" product
-- |
- When I select the product "club1", the price of 2.75 is automatically proposed
--
- !record {model: lunch.order, id: lunch_order_0}:
- date: !eval time.strftime('%Y-%m-%d')
- product: 'lunch_product_club1'
- price: 2.75
-
-- |
- I check that lunch order is on draft state after having created it.
--
- !assert {model: lunch.order, id: lunch_order_0}:
- - state == 'draft'
-- |
- I confirm the order "LU001" using the "Confirm Order" wizard.
--
- !record {model: lunch.order.confirm, id: lunch_order_confirm_0}:
- confirm_cashbox: 'lunch_cashbox_cashbox0'
--
- I click on "Confirm Order" button of this wizard.
--
- !python {model: lunch.order.confirm}: |
- self.confirm(cr, uid, [ref('lunch_order_confirm_0')], {'active_ids': [ref('lunch_order_0')]})
-
-- |
- I check that the Cash Moves have been generated with the right box
- name
--
- !assert {model: lunch.order, id: lunch_order_0}:
- - cashmove.id != False
-
-- |
- I check that the Total on the "Employee Cashbox" is -2.75
-
--
- !assert {model: lunch.cashbox, id: lunch_cashbox_cashbox0}:
- - sum_remain == -2.75
-
-- |
- I create a new lunch order "LU002" for the "Club1" product, at another date.
--
- !record {model: lunch.order, id: lunch_order_1}:
- date: !eval "(datetime.now() + timedelta(2)).strftime('%Y-%m-%d')"
- product: 'lunch_product_club1'
- price: 2.75
-
-- |
- I confirm this order.open wizard and select "Employee Cashbox".
--
- !record {model: lunch.order.confirm, id: lunch_order_confirm_1}:
- confirm_cashbox: 'lunch_cashbox_cashbox0'
-- |
- Now I click on "Confirm Order" button of this wizard.
--
- !python {model: lunch.order.confirm}: |
- self.confirm(cr, uid, [ref('lunch_order_confirm_1')], {'active_ids': [ref('lunch_order_1')]})
-
-- |
- I check that the Total on the "Employee Cashbox" is -5.50
--
- !assert {model: lunch.cashbox, id: lunch_cashbox_cashbox0}:
- - sum_remain == -5.50
-
-- |
- I cancel the order "LU002"
--
- !record {model: lunch.order.cancel, id: lunch_order_cancel_0}:
- {}
-- |
- I click on "Yes" button of this wizard for cancel order.
-
--
- !python {model: lunch.order.cancel}: |
- self.cancel(cr, uid, [ref('lunch_order_cancel_0')], {'active_ids': [ref('lunch_order_1')]})
-
-- |
- I test that the Cash Moves record have been removed for the order LU002.
--
- !assert {model: lunch.order, id: lunch_order_1}:
- - cashmove.id == False
-
-- |
- I check that the Total on the "Employee Cashbox" is -2.75
--
- !assert {model: lunch.cashbox, id: lunch_cashbox_cashbox0}:
- - sum_remain == -2.75
-- |
- I reset the "Employee Cashbox" to zero using the "Set CashBox to Zero" wizard.
--
- !record {model: lunch.cashbox.clean, id: lunch_cashbox_clean_0}:
- {}
--
- Now click on "Set to Zero" button of this wizard.
--
- !python {model: lunch.cashbox.clean, id: lunch_cashbox_clean_0}: |
- self.set_to_zero(cr, uid, [ref('lunch_cashbox_clean_0')], {'active_ids': [ref('lunch_cashbox_cashbox0')]})
-
-- |
- I check that the Total on the "Employee Cashbox" is -5.50
--
- !assert {model: lunch.cashbox, id: lunch_cashbox_cashbox0}:
- - sum_remain == 0.00
-
diff --git a/addons/lunch/tests/__init__.py b/addons/lunch/tests/__init__.py
new file mode 100644
index 00000000000..194888974b0
--- /dev/null
+++ b/addons/lunch/tests/__init__.py
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Business Applications
+# Copyright (c) 2012-TODAY OpenERP S.A.
+#
+# 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 .
+#
+##############################################################################
+from . import test_lunch
+
+checks = [
+ test_lunch,
+]
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/lunch/tests/test_lunch.py b/addons/lunch/tests/test_lunch.py
new file mode 100644
index 00000000000..128e4796611
--- /dev/null
+++ b/addons/lunch/tests/test_lunch.py
@@ -0,0 +1,92 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Business Applications
+# Copyright (c) 2012-TODAY OpenERP S.A.
+#
+# 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 .
+#
+##############################################################################
+
+import tools
+from openerp.tests import common
+
+class Test_Lunch(common.TransactionCase):
+
+ def setUp(self):
+ """*****setUp*****"""
+ super(Test_Lunch, self).setUp()
+ cr, uid = self.cr, self.uid
+
+ self.res_users = self.registry('res.users')
+ self.lunch_order = self.registry('lunch.order')
+ self.lunch_order_line = self.registry('lunch.order.line')
+ self.lunch_cashmove = self.registry('lunch.cashmove')
+ self.lunch_product = self.registry('lunch.product')
+ self.lunch_alert = self.registry('lunch.alert')
+ self.lunch_product_category = self.registry('lunch.product.category')
+
+ self.demo_id = self.res_users.search(cr, uid, [('name', '=', 'Demo User')])
+ self.product_bolognese_ref = self.registry('ir.model.data').get_object_reference(cr, uid, 'lunch', 'product_Bolognese')
+ self.product_Bolognese_id = self.product_bolognese_ref and self.product_bolognese_ref[1] or False
+ self.new_id_order = self.lunch_order.create(cr,uid,{
+ 'user_id': self.demo_id[0],
+ 'order_line_ids':'[]',
+ },context=None)
+ self.new_id_order_line = self.lunch_order_line.create(cr,uid,{
+ 'order_id':self.new_id_order,
+ 'product_id':self.product_Bolognese_id,
+ 'note': '+Emmental',
+ 'cashmove': [],
+ 'price': self.lunch_product.browse(cr,uid,self.product_Bolognese_id,context=None).price,
+ })
+
+ def test_00_lunch_order(self):
+ """Change the state of an order line from 'new' to 'ordered'. Check that there are no cashmove linked to that order line"""
+ cr, uid = self.cr, self.uid
+ self.order_one = self.lunch_order_line.browse(cr,uid,self.new_id_order_line,context=None)
+ #we check that our order_line is a 'new' one and that there are no cashmove linked to that order_line:
+ self.assertEqual(self.order_one.state,'new')
+ self.assertEqual(self.order_one.cashmove, [])
+ #we order that orderline so it's state will be 'ordered'
+ self.order_one.order()
+ self.order_one = self.lunch_order_line.browse(cr,uid,self.new_id_order_line,context=None)
+ #we check that our order_line is a 'ordered' one and that there are no cashmove linked to that order_line:
+ self.assertEqual(self.order_one.state,'ordered')
+ self.assertEqual(self.order_one.cashmove, [])
+
+ def test_01_lunch_order(self):
+ """Change the state of an order line from 'new' to 'ordered' then to 'confirmed'. Check that there is a cashmove linked to the order line"""
+ cr, uid = self.cr, self.uid
+ self.test_00_lunch_order()
+ #We receive the order so we confirm the order line so it's state will be 'confirmed'
+ #A cashmove will be created and we will test that the cashmove amount equals the order line price
+ self.order_one.confirm()
+ self.order_one = self.lunch_order_line.browse(cr,uid,self.new_id_order_line,context=None)
+ #we check that our order_line is a 'confirmed' one and that there are a cashmove linked to that order_line with an amount equals to the order line price:
+ self.assertEqual(self.order_one.state,'confirmed')
+ self.assertTrue(self.order_one.cashmove!=[])
+ self.assertTrue(self.order_one.cashmove[0].amount==-self.order_one.price)
+
+ def test_02_lunch_order(self):
+ """Change the state of an order line from 'confirmed' to 'cancelled' and check that the cashmove linked to that order line will be deleted"""
+ cr, uid = self.cr, self.uid
+ self.test_01_lunch_order()
+ #We have a confirmed order with its associate cashmove
+ #We execute the cancel function
+ self.order_one.cancel()
+ self.order_one = self.lunch_order_line.browse(cr,uid,self.new_id_order_line,context=None)
+ #We check that the state is cancelled and that the cashmove has been deleted
+ self.assertEqual(self.order_one.state,'cancelled')
+ self.assertTrue(self.order_one.cashmove==[])
\ No newline at end of file
diff --git a/addons/lunch/wizard/__init__.py b/addons/lunch/wizard/__init__.py
index e6b34c215ac..9af98b65899 100644
--- a/addons/lunch/wizard/__init__.py
+++ b/addons/lunch/wizard/__init__.py
@@ -1,8 +1,8 @@
# -*- encoding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL ().
+# Copyright (C) 2004-2012 Tiny SPRL ().
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -15,13 +15,10 @@
# 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 .
+# along with this program. If not, see .
#
##############################################################################
-import lunch_order_confirm
-import lunch_order_cancel
-import lunch_cashbox_clean
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
+import lunch_validation
+import lunch_cancel
+import lunch_order
diff --git a/addons/lunch/wizard/lunch_order_cancel.py b/addons/lunch/wizard/lunch_cancel.py
similarity index 51%
rename from addons/lunch/wizard/lunch_order_cancel.py
rename to addons/lunch/wizard/lunch_cancel.py
index a0c8779b323..648ab4e2396 100644
--- a/addons/lunch/wizard/lunch_order_cancel.py
+++ b/addons/lunch/wizard/lunch_cancel.py
@@ -2,7 +2,7 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL ().
+# Copyright (C) 2004-2012 Tiny SPRL ().
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -18,28 +18,12 @@
# along with this program. If not, see .
#
##############################################################################
-from osv import fields, osv
+from osv import osv, fields
-class lunch_order_cancel(osv.osv_memory):
- """
- Cancel Lunch Order
- """
- _name = "lunch.order.cancel"
- _description = "Cancel Order"
-
- def cancel(self, cr, uid, ids, context=None):
- """
- Cancel cashmove entry from cashmoves and update state to draft.
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: List Lunch Order Cancel’s IDs
- """
- if context is None:
- 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:
+class lunch_cancel(osv.Model):
+ """ lunch cancel """
+ _name = 'lunch.cancel'
+ _description = 'cancel lunch order'
+ def cancel(self,cr,uid,ids,context=None):
+ return self.pool.get('lunch.order.line').cancel(cr, uid, ids, context=context)
diff --git a/addons/lunch/wizard/lunch_cancel_view.xml b/addons/lunch/wizard/lunch_cancel_view.xml
new file mode 100644
index 00000000000..4df5c8739e9
--- /dev/null
+++ b/addons/lunch/wizard/lunch_cancel_view.xml
@@ -0,0 +1,32 @@
+
+
+
+
+ cancel order lines
+ lunch.cancel
+ form
+
+
+
+
+ Cancel a meal means that we didn't receive it from the supplier.
+
+ A cancelled meal should not be paid by employees.
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/addons/lunch/wizard/lunch_cashbox_clean.py b/addons/lunch/wizard/lunch_cashbox_clean.py
deleted file mode 100644
index e95d05870f9..00000000000
--- a/addons/lunch/wizard/lunch_cashbox_clean.py
+++ /dev/null
@@ -1,65 +0,0 @@
-# -*- encoding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-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=None):
-
- """
- clean Cashbox. set active fields False.
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: List Lunch cashbox Clean’s IDs
- @return:Dictionary {}.
- """
- #TOFIX: use orm methods
- if context is None:
- context = {}
- 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" , (tuple(data),))
- res = cr.fetchall()
-
- cr.execute("update lunch_cashmove set active = 'f' where active= 't' \
- and box IN %s" , (tuple(data),))
- #TOCHECK: Why need to create duplicate entry after clean box ?
-
- #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 {'type': 'ir.actions.act_window_close'}
-
-lunch_cashbox_clean()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/lunch/wizard/lunch_cashbox_clean_view.xml b/addons/lunch/wizard/lunch_cashbox_clean_view.xml
deleted file mode 100644
index 5ba2a6ff3bf..00000000000
--- a/addons/lunch/wizard/lunch_cashbox_clean_view.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-
-
-
- lunch.cashbox.clean.form
- lunch.cashbox.clean
-
-
-
-
-
-
-
-
-
-
-
- Set CashBox to Zero
- lunch.cashbox.clean
- form
- tree,form
-
- new
-
-
-
-
-
-
diff --git a/addons/lunch/wizard/lunch_order.py b/addons/lunch/wizard/lunch_order.py
new file mode 100644
index 00000000000..20de4adc263
--- /dev/null
+++ b/addons/lunch/wizard/lunch_order.py
@@ -0,0 +1,29 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2012 Tiny SPRL ().
+#
+# 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 .
+#
+##############################################################################
+from osv import osv, fields
+
+class lunch_order_order(osv.Model):
+ """ lunch order meal """
+ _name = 'lunch.order.order'
+ _description = 'Wizard to order a meal'
+
+ def order(self,cr,uid,ids,context=None):
+ return self.pool.get('lunch.order.line').order(cr, uid, ids, context=context)
diff --git a/addons/lunch/wizard/lunch_order_cancel_view.xml b/addons/lunch/wizard/lunch_order_cancel_view.xml
deleted file mode 100644
index 91d6a959241..00000000000
--- a/addons/lunch/wizard/lunch_order_cancel_view.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-
-
-
- lunch.order.cancel.form
- lunch.order.cancel
-
-
-
-
-
-
-
-
-
-
-
- Cancel Order
- lunch.order.cancel
- form
- tree,form
-
- new
-
-
-
-
-
-
diff --git a/addons/lunch/wizard/lunch_order_confirm.py b/addons/lunch/wizard/lunch_order_confirm.py
deleted file mode 100644
index 279234897de..00000000000
--- a/addons/lunch/wizard/lunch_order_confirm.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# -*- encoding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL ().
-#
-# 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 .
-#
-##############################################################################
-
-from osv import fields, osv
-
-class lunch_order_confirm(osv.osv_memory):
- """
- Confirm Lunch Order
- """
- _name = "lunch.order.confirm"
- _description = "confirm Order"
-
- _columns = {
- 'confirm_cashbox':fields.many2one('lunch.cashbox', 'Name of box', required=True),
- }
-
- def confirm(self, cr, uid, ids, context=None):
- """
- 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 ids: List Lunch Order confirm’s IDs
- @return: Dictionary {}.
- """
- if context is None:
- context = {}
- data = context and context.get('active_ids', []) or []
- order_ref = self.pool.get('lunch.order')
-
- for confirm_obj in self.browse(cr, uid, ids, context=context):
- order_ref.confirm(cr, uid, data, confirm_obj.confirm_cashbox.id, context)
- return {'type': 'ir.actions.act_window_close'}
-
-lunch_order_confirm()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/lunch/wizard/lunch_order_confirm_view.xml b/addons/lunch/wizard/lunch_order_confirm_view.xml
deleted file mode 100644
index 022d17acea3..00000000000
--- a/addons/lunch/wizard/lunch_order_confirm_view.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
-
-
- lunch.order.confirm.form
- lunch.order.confirm
-
-
-
-
-
-
-
-
-
-
-
-
- Confirm Order
- lunch.order.confirm
- form
- tree,form
-
- new
-
-
-
-
-
-
diff --git a/addons/lunch/wizard/lunch_order_view.xml b/addons/lunch/wizard/lunch_order_view.xml
new file mode 100644
index 00000000000..990add2564e
--- /dev/null
+++ b/addons/lunch/wizard/lunch_order_view.xml
@@ -0,0 +1,31 @@
+
+
+
+
+ Order meal
+ lunch.order.order
+ form
+
+
+
+
+ Order a meal doesn't mean that we have to pay it.
+ A meal should be paid when it is received.
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/lunch/wizard/lunch_validation.py b/addons/lunch/wizard/lunch_validation.py
new file mode 100644
index 00000000000..f4b4b30747d
--- /dev/null
+++ b/addons/lunch/wizard/lunch_validation.py
@@ -0,0 +1,29 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2012 Tiny SPRL ().
+#
+# 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 .
+#
+##############################################################################
+from osv import osv, fields
+
+class lunch_validation(osv.Model):
+ """ lunch validation """
+ _name = 'lunch.validation'
+ _description = 'lunch validation for order'
+
+ def confirm(self,cr,uid,ids,context=None):
+ return self.pool.get('lunch.order.line').confirm(cr, uid, ids, context=context)
diff --git a/addons/lunch/wizard/lunch_validation_view.xml b/addons/lunch/wizard/lunch_validation_view.xml
new file mode 100644
index 00000000000..5e9fb92956f
--- /dev/null
+++ b/addons/lunch/wizard/lunch_validation_view.xml
@@ -0,0 +1,30 @@
+
+
+
+
+ validate order lines
+ lunch.validation
+ form
+
+
+
+
+ Once a meal is received a new cash move is created for the employee.
+