diff --git a/addons/point_of_sale/__openerp__.py b/addons/point_of_sale/__openerp__.py index 70606933913..125449cfc6f 100644 --- a/addons/point_of_sale/__openerp__.py +++ b/addons/point_of_sale/__openerp__.py @@ -48,7 +48,6 @@ Main features : 'wizard/pos_details.xml', 'wizard/pos_confirm.xml', 'wizard/pos_discount.xml', - 'wizard/pos_get_sale.xml', 'wizard/pos_open_statement.xml', 'wizard/pos_close_statement.xml', 'wizard/pos_box_entries.xml', @@ -56,9 +55,6 @@ Main features : 'wizard/pos_payment_report_date_view.xml', 'wizard/pos_box_out.xml', 'wizard/pos_sales_user.xml', - 'wizard/all_closed_cashbox_of_the_day.xml', - 'wizard/pos_sales_user_current_user.xml', - 'wizard/pos_sale_user_today.xml', 'wizard/pos_receipt_view.xml', 'wizard/pos_payment_report_user.xml', 'wizard/pos_payment_report.xml', diff --git a/addons/point_of_sale/account_statement_view.xml b/addons/point_of_sale/account_statement_view.xml index e314f6af1bc..16cc953d9ef 100644 --- a/addons/point_of_sale/account_statement_view.xml +++ b/addons/point_of_sale/account_statement_view.xml @@ -142,6 +142,12 @@ action="action_pos_close_statement" id="menu_close_statement" sequence="2" /> + + + - - diff --git a/addons/point_of_sale/point_of_sale_view.xml b/addons/point_of_sale/point_of_sale_view.xml index d7089ec3fd1..2e9e53a0ba8 100644 --- a/addons/point_of_sale/point_of_sale_view.xml +++ b/addons/point_of_sale/point_of_sale_view.xml @@ -642,7 +642,7 @@ id="menu_point_config_product" sequence="25" groups="group_pos_manager"/> - Products + Products 'Take Money Out' ir.actions.act_window product.product form @@ -661,14 +661,14 @@ - + - Products + Products 'Put Money In' ir.actions.act_window product.product form @@ -687,11 +687,11 @@ - + + + Payment Methods + account.journal + form + tree,form + {'default_journal_user': 1} + [('journal_user','=', 1)] + Payment methods are defined by accounting journals having the field Payment Method checked. + + + + POS Sales Lines pos.order.line @@ -737,7 +752,7 @@ tree,form [] - + Invoices diff --git a/addons/point_of_sale/report/__init__.py b/addons/point_of_sale/report/__init__.py index c537119efe9..171f323e337 100644 --- a/addons/point_of_sale/report/__init__.py +++ b/addons/point_of_sale/report/__init__.py @@ -32,7 +32,6 @@ import pos_sales_user import pos_sales_user_today import pos_payment_report_date import pos_payment_report_user -import pos_sales_user_today_current_user import pos_report import pos_order_report import report_cash_register diff --git a/addons/point_of_sale/report/pos_sales_user_today_current_user.py b/addons/point_of_sale/report/pos_sales_user_today_current_user.py deleted file mode 100644 index 07cbdcbc488..00000000000 --- a/addons/point_of_sale/report/pos_sales_user_today_current_user.py +++ /dev/null @@ -1,68 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 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 . -# -############################################################################## - -import time -from report import report_sxw - -class pos_sales_user_today_current_user(report_sxw.rml_parse): - - def __init__(self, cr, uid, name, context): - super(pos_sales_user_today_current_user, self).__init__(cr, uid, name, context=context) - self.total = 0.0 - self.qty = 0.0 - self.localcontext.update({ - 'time': time, - 'get_user':self._get_user, - 'get_data_current_user':self._get_data_current_user, - 'get_data_current_user_tot':self._get_data_current_user_tot, - 'get_data_current_user_qty':self._get_data_current_user_qty, - }) - - def _get_user(self, user): - pos_user={} - self.cr.execute("select name from res_users where id = %s",str(self.uid)) - pos_user=self.cr.dictfetchone() - return pos_user['name'] - - def _get_data_current_user(self, user): - data={} - self.cr.execute("select po.name,po. state,sum(pol.qty)as Qty,sum((pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0))) as Total " \ - "from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt, res_users as ru,res_company as rc " \ - "where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id " \ - "and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date = current_date and po.user_id = ru.id and rc.id = %s and ru.id = %s " \ - "group by po.name, po.state " \ - ,(str(user.company_id.id),str(self.uid))) - - data = self.cr.dictfetchall() - for d in data: - self.total += d['total'] - self.qty += d['qty'] - return data - - def _get_data_current_user_tot(self, user): - return self.total - - def _get_data_current_user_qty(self, user): - return self.qty - -report_sxw.report_sxw('report.pos.sales.user.today.current.user', 'pos.order', 'addons/point_of_sale/report/pos_sales_user_today_current_user.rml', parser=pos_sales_user_today_current_user,header='internal') - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/point_of_sale/report/pos_sales_user_today_current_user.rml b/addons/point_of_sale/report/pos_sales_user_today_current_user.rml deleted file mode 100644 index 7a94f5d6632..00000000000 --- a/addons/point_of_sale/report/pos_sales_user_today_current_user.rml +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [[ repeatIn(objects,'order') ]] - - - - - - - Today's Sales By Current User - - - - - - - Company - - - Print Date - - - User - - - - - - - [[ company.name ]] - - - [[ formatLang(time.strftime('%Y-%m-%d'),date = True) ]] - - - [[ (get_user(user)) ]] - - - - - - - - - - - - - Name - - - State - - - Qty - - - Total - - - -
- [[ repeatIn(get_data_current_user(user), 'line_ids')]] - - - - [[ line_ids['name'] ]] - - - [[ line_ids['state'] ]] - - - [[ formatLang(line_ids['qty']) ]] - - - [[ formatLang(line_ids['total']) ]] [[company.currency_id.symbol]] - - - -
- - - - - - - - - Total : - - - [[ formatLang((get_data_current_user_qty(user))) ]] - - - [[ formatLang((get_data_current_user_tot(user))) or removeParentNode('blockTable')]] [[company.currency_id.symbol]] - - - - - - -
-
diff --git a/addons/point_of_sale/test/point_of_sale_report.yml b/addons/point_of_sale/test/point_of_sale_report.yml index 14a4b334800..f31f9ec0f49 100644 --- a/addons/point_of_sale/test/point_of_sale_report.yml +++ b/addons/point_of_sale/test/point_of_sale_report.yml @@ -65,15 +65,6 @@ (data, format) = netsvc.LocalService('report.pos.sales.user').create(cr, uid, [ref('point_of_sale.order_pos1'), ref('point_of_sale.order_pos2')], data_dict, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-sales_user_report'+format), 'wb+').write(data) -- - In order to test the PDF reports defined on a Point of Sale, we will print a POS Sales User Today Report -- - !python {model: pos.order}: | - import netsvc, tools, os, time - data_dict = {'model':'ir.ui.menu', 'form':{'user_id':[ref('base.user_root')] }} - (data, format) = netsvc.LocalService('report.pos.sales.user.today').create(cr, uid, [ref('point_of_sale.order_pos1'), ref('point_of_sale.order_pos2')], data_dict, {}) - if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-sales_user_today_report'+format), 'wb+').write(data) - In order to test the PDF reports defined on a Point of Sale, we will print a POS Payment Report - @@ -91,11 +82,3 @@ (data, format) = netsvc.LocalService('report.pos.payment.report.user').create(cr, uid, [ref('point_of_sale.order_pos1'), ref('point_of_sale.order_pos2')], data_dict, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-payment_user_report'+format), 'wb+').write(data) -- - In order to test the PDF reports defined on a Point of Sale, we will print a POS Today's Sales of Current User Report -- - !python {model: pos.order}: | - import netsvc, tools, os, time - (data, format) = netsvc.LocalService('report.pos.sales.user.today.current.user').create(cr, uid, [ref('point_of_sale.order_pos1'), ref('point_of_sale.order_pos2')], {}, {}) - if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-sales_today_current_user_report'+format), 'wb+').write(data) diff --git a/addons/point_of_sale/wizard/__init__.py b/addons/point_of_sale/wizard/__init__.py index 1c95aa17ab0..0985ae906be 100644 --- a/addons/point_of_sale/wizard/__init__.py +++ b/addons/point_of_sale/wizard/__init__.py @@ -21,7 +21,6 @@ import pos_confirm import pos_discount -import pos_get_sale import pos_open_statement import pos_close_statement import pos_box_entries @@ -29,8 +28,6 @@ import pos_box_out import pos_details import pos_sales_user import pos_sales_user_today -import pos_sales_user_current_user -import all_closed_cashbox_of_the_day import pos_receipt import pos_payment_report_user import pos_payment_report_date diff --git a/addons/point_of_sale/wizard/pos_confirm.py b/addons/point_of_sale/wizard/pos_confirm.py index c55209650ca..c80f3ed1dd6 100644 --- a/addons/point_of_sale/wizard/pos_confirm.py +++ b/addons/point_of_sale/wizard/pos_confirm.py @@ -25,36 +25,21 @@ from osv import osv class pos_confirm(osv.osv_memory): _name = 'pos.confirm' - _description = 'Point of Sale Confirm' + _description = 'Post POS Journal Entries' def action_confirm(self, cr, uid, ids, context=None): - """ - Confirm the order and close the sales. - @param self: The object pointer. - @param cr: A database cursor - @param uid: ID of the user currently logged in - @param context: A standard dictionary - @return :Blank dictionary - """ - if context is None: - context = {} - record_id = context and context.get('active_id', False) - if record_id: - if isinstance(record_id, (int, long)): - record_id = [record_id] - if record_id: - order_obj = self.pool.get('pos.order') - - for order_id in order_obj.browse(cr, uid, record_id, context=context): - if order_id.state == 'paid': - order_obj.write(cr, uid, [order_id.id], {'journal_entry': True}, context=context) - order_obj.create_account_move(cr, uid, [order_id.id], context=context) - - wf_service = netsvc.LocalService("workflow") - for i in record_id: - wf_service.trg_validate(uid, 'pos.order', i, 'done', cr) + wf_service = netsvc.LocalService("workflow") + order_obj = self.pool.get('pos.order') + ids = order_obj.search(cr, uid, [('state','=','paid')], context=context) + for order in order_obj.browse(cr, uid, ids, context=context): + todo = True + for line in order.statement_ids: + if line.statement_id.state <> 'confirm': + todo = False + break + if todo: + wf_service.trg_validate(uid, 'pos.order', order.id, 'done', cr) return {} - pos_confirm() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/point_of_sale/wizard/pos_confirm.xml b/addons/point_of_sale/wizard/pos_confirm.xml index 1ea769cae49..85b43bd115d 100644 --- a/addons/point_of_sale/wizard/pos_confirm.xml +++ b/addons/point_of_sale/wizard/pos_confirm.xml @@ -1,32 +1,37 @@ - + - - - Sale Confirm + + Post Journal Entries pos.confirm form -
-