From 597412b09a34d7944ca0ff2449e84e2ccbc38889 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers <fp@tinyerp.com> Date: Sun, 25 Sep 2011 23:45:32 +0200 Subject: [PATCH] [IMP] Point of Sale Useability and code cleaning bzr revid: fp@tinyerp.com-20110925214532-1scgzy6tk9r70091 --- addons/point_of_sale/__openerp__.py | 4 - .../point_of_sale/account_statement_view.xml | 6 + addons/point_of_sale/point_of_sale_report.xml | 11 - addons/point_of_sale/point_of_sale_view.xml | 41 ++-- addons/point_of_sale/report/__init__.py | 1 - .../pos_sales_user_today_current_user.py | 68 ------ .../pos_sales_user_today_current_user.rml | 204 ------------------ .../test/point_of_sale_report.yml | 17 -- addons/point_of_sale/wizard/__init__.py | 3 - addons/point_of_sale/wizard/pos_confirm.py | 39 ++-- addons/point_of_sale/wizard/pos_confirm.xml | 35 +-- addons/point_of_sale/wizard/pos_get_sale.py | 81 ------- addons/point_of_sale/wizard/pos_get_sale.xml | 34 --- .../wizard/pos_sale_user_today.xml | 32 --- .../wizard/pos_sales_user_current_user.xml | 34 --- 15 files changed, 66 insertions(+), 544 deletions(-) delete mode 100644 addons/point_of_sale/report/pos_sales_user_today_current_user.py delete mode 100644 addons/point_of_sale/report/pos_sales_user_today_current_user.rml delete mode 100644 addons/point_of_sale/wizard/pos_get_sale.py delete mode 100644 addons/point_of_sale/wizard/pos_get_sale.xml delete mode 100644 addons/point_of_sale/wizard/pos_sale_user_today.xml delete mode 100644 addons/point_of_sale/wizard/pos_sales_user_current_user.xml diff --git a/addons/point_of_sale/__openerp__.py b/addons/point_of_sale/__openerp__.py index 706069339138..125449cfc6f0 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 e314f6af1bc9..16cc953d9efc 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" /> + <menuitem + parent="menu_point_open_config" + action="action_pos_confirm" + id="menu_wizard_pos_confirm" sequence="8" /> + + <menuitem name="List of Cash Registers" parent="menu_point_open_config" diff --git a/addons/point_of_sale/point_of_sale_report.xml b/addons/point_of_sale/point_of_sale_report.xml index 3e6a265b34e1..b8d5456f1cd5 100644 --- a/addons/point_of_sale/point_of_sale_report.xml +++ b/addons/point_of_sale/point_of_sale_report.xml @@ -96,17 +96,6 @@ menu="False" rml="point_of_sale/report/pos_payment_report_user.rml" /> - <report - id="pos_sales_user_today_current_user" - string="Today's Sales by Current User" - model="pos.order" - name="pos.sales.user.today.current.user" - auto="False" - multi="True" - menu="False" - rml="point_of_sale/report/pos_sales_user_today_current_user.rml" - /> - </data> </openerp> diff --git a/addons/point_of_sale/point_of_sale_view.xml b/addons/point_of_sale/point_of_sale_view.xml index d7089ec3fd1c..2e9e53a0ba8b 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"/> <record model="ir.actions.act_window" id="action_product_input"> - <field name="name">Products</field> + <field name="name">Products 'Take Money Out'</field> <field name="type">ir.actions.act_window</field> <field name="res_model">product.product</field> <field name="view_type">form</field> @@ -661,14 +661,14 @@ <field name="view_id" ref="product_input_output_form_view"/> <field name="act_window_id" ref="action_product_input"/> </record> - <menuitem name="Products for Input Operations" - parent="menu_point_config_product" - action="action_product_input" - id="products_for_input_operations" - groups="group_pos_manager"/> + <menuitem + parent="menu_point_config_product" + action="action_product_input" + id="products_for_input_operations" + groups="group_pos_manager"/> <record model="ir.actions.act_window" id="action_product_output"> - <field name="name">Products</field> + <field name="name">Products 'Put Money In'</field> <field name="type">ir.actions.act_window</field> <field name="res_model">product.product</field> <field name="view_type">form</field> @@ -687,11 +687,11 @@ <field name="view_id" ref="product_input_output_form_view"/> <field name="act_window_id" ref="action_product_output"/> </record> - <menuitem name="Products for Output Operations" - parent="menu_point_config_product" - action="action_product_output" - id="products_for_output_operations" - groups="group_pos_manager"/> + <menuitem + parent="menu_point_config_product" + action="action_product_output" + id="products_for_output_operations" + groups="group_pos_manager"/> <menuitem parent="menu_point_of_sale" @@ -703,6 +703,21 @@ action="action_box_out" id="menu_wizard_enter_jrnl2" sequence="3" /> + <record id="action_account_journal_form" model="ir.actions.act_window"> + <field name="name">Payment Methods</field> + <field name="res_model">account.journal</field> + <field name="view_type">form</field> + <field name="view_mode">tree,form</field> + <field name="context">{'default_journal_user': 1}</field> + <field name="domain">[('journal_user','=', 1)]</field> + <field name="help">Payment methods are defined by accounting journals having the field Payment Method checked.</field> + </record> + + <menuitem action="action_account_journal_form" + id="menu_action_account_journal_form_open" + parent="menu_point_config_product" + sequence="20"/> + <record model="ir.ui.view" id="view_pos_order_tree_all_sales_lines"> <field name="name">POS Sales Lines</field> <field name="model">pos.order.line</field> @@ -737,7 +752,7 @@ <field name="view_mode">tree,form</field> <field name="domain">[]</field> </record> - <menuitem parent="menu_point_root" id="menu_point_ofsale_all" action="action_pos_sale_all" sequence="1"/> + <menuitem parent="menu_point_rep" id="menu_point_ofsale_all" action="action_pos_sale_all" sequence="1"/> <record model="ir.actions.act_window" id="action_pos_invoice"> <field name="name">Invoices</field> diff --git a/addons/point_of_sale/report/__init__.py b/addons/point_of_sale/report/__init__.py index c537119efe94..171f323e337c 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 07cbdcbc488f..000000000000 --- 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 (<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 - -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 7a94f5d6632f..000000000000 --- a/addons/point_of_sale/report/pos_sales_user_today_current_user.rml +++ /dev/null @@ -1,204 +0,0 @@ -<?xml version="1.0"?> -<document filename="test.pdf"> - <template pageSize="(595.0,842.0)" title="Todays Sales By Current User" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20"> - <pageTemplate id="first"> - <frame id="first" x1="27.0" y1="57.0" width="512" height="728"/> - </pageTemplate> - </template> - <stylesheet> - <blockTableStyle id="Standard_Outline"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - </blockTableStyle> - <blockTableStyle id="Table1"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/> - <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="2,0" stop="2,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - </blockTableStyle> - <blockTableStyle id="Table2"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/> - <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="2,0" stop="2,-1"/> - <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - </blockTableStyle> - <blockTableStyle id="Table3"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/> - </blockTableStyle> - <blockTableStyle id="Table6"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> - </blockTableStyle> - <blockTableStyle id="Table5"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/> - </blockTableStyle> - <initialize> - <paraStyle name="all" alignment="justify"/> - </initialize> - <paraStyle name="P1" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT"/> - <paraStyle name="P2" fontName="Helvetica-Bold" fontSize="16.0" leading="20" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="Standard" fontName="Helvetica"/> - <paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/> - <paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="Index" fontName="Helvetica"/> - <paraStyle name="Table Contents" fontName="Helvetica"/> - <paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER"/> - <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="Footer" fontName="Helvetica"/> - <paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/> - <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/> - <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_1" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Right_9_Bold" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_8_Italic" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <images/> - </stylesheet> - <story> - <para style="terp_default_8">[[ repeatIn(objects,'order') ]]</para> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - <para style="P2">Today's Sales By Current User</para> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - <blockTable colWidths="170.0,170.0,170.0" style="Table1"> - <tr> - <td> - <para style="terp_tblheader_General_Centre">Company</para> - </td> - <td> - <para style="terp_tblheader_General_Centre">Print Date</para> - </td> - <td> - <para style="terp_tblheader_General_Centre">User</para> - </td> - </tr> - </blockTable> - <blockTable colWidths="170.0,170.0,170.0" style="Table2"> - <tr> - <td> - <para style="terp_default_Centre_8">[[ company.name ]]</para> - </td> - <td> - <para style="terp_default_Centre_8">[[ formatLang(time.strftime('%Y-%m-%d'),date = True) ]]</para> - </td> - <td> - <para style="terp_default_Centre_8">[[ (get_user(user)) ]]</para> - </td> - </tr> - </blockTable> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - <blockTable colWidths="299.0,76.0,69.0,67.0" style="Table3"> - <tr> - <td> - <para style="terp_tblheader_Details">Name</para> - </td> - <td> - <para style="terp_tblheader_Details_Right">State</para> - </td> - <td> - <para style="terp_tblheader_Details_Right">Qty</para> - </td> - <td> - <para style="terp_tblheader_Details_Right">Total</para> - </td> - </tr> - </blockTable> - <section> - <para style="terp_default_1">[[ repeatIn(get_data_current_user(user), 'line_ids')]]</para> - <blockTable colWidths="299.0,76.0,69.0,67.0" style="Table6"> - <tr> - <td> - <para style="terp_default_9">[[ line_ids['name'] ]]</para> - </td> - <td> - <para style="terp_default_Right_9">[[ line_ids['state'] ]]</para> - </td> - <td> - <para style="terp_default_Right_9">[[ formatLang(line_ids['qty']) ]]</para> - </td> - <td> - <para style="terp_default_Right_9">[[ formatLang(line_ids['total']) ]] [[company.currency_id.symbol]]</para> - </td> - </tr> - </blockTable> - </section> - <blockTable colWidths="299.0,76.0,69.0,67.0" style="Table5"> - <tr> - <td> - <para style="P1"> - <font color="white"> </font> - </para> - </td> - <td> - <para style="terp_tblheader_Details_Right">Total : </para> - </td> - <td> - <para style="terp_default_Right_9">[[ formatLang((get_data_current_user_qty(user))) ]]</para> - </td> - <td> - <para style="terp_default_Right_9">[[ formatLang((get_data_current_user_tot(user))) or removeParentNode('blockTable')]] [[company.currency_id.symbol]]</para> - </td> - </tr> - </blockTable> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - </story> -</document> 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 14a4b3348000..f31f9ec0f494 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 1c95aa17ab08..0985ae906be9 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 c55209650ca3..c80f3ed1dd61 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 1ea769cae496..85b43bd115d8 100644 --- a/addons/point_of_sale/wizard/pos_confirm.xml +++ b/addons/point_of_sale/wizard/pos_confirm.xml @@ -1,32 +1,37 @@ <?xml version="1.0" encoding="utf-8"?> <openerp> - <data> + <data> <!-- Point of Sale Confirm --> - - <record id="view_pos_confirm" model="ir.ui.view"> - <field name="name">Sale Confirm</field> + <record id="view_pos_confirm" model="ir.ui.view"> + <field name="name">Post Journal Entries</field> <field name="model">pos.confirm</field> <field name="type">form</field> <field name="arch" type="xml"> - <form string="Open Statements"> - <label string="Are you sure you want to close your sales ?" colspan="2"/> - <newline/> - <button icon='gtk-cancel' special="cancel" - string="No" /> - <button name="action_confirm" string="Yes" - colspan="1" type="object" icon="gtk-ok"/> + <form string="Post All Orders"> + <separator string="Generate Journal Entries" colspan="4"/> + <label string="This wizard will generate all journal entries for orders linked to a closed cash register or statement." colspan="4" align="0.0"/> + <newline/> + <separator colspan="4"/> + <group colspan="4" col="4"> + <group colspan="2" col="2"> + <button icon='gtk-cancel' special="cancel" + string="Cancel" /> + <button name="action_confirm" string="Generate Entries" + colspan="1" type="object" icon="gtk-ok"/> + </group> + </group> </form> </field> </record> <record id="action_pos_confirm" model="ir.actions.act_window"> - <field name="name">Sale Confirm</field> + <field name="name">Post Journal Entries</field> <field name="type">ir.actions.act_window</field> <field name="res_model">pos.confirm</field> <field name="view_type">form</field> <field name="view_mode">form</field> <field name="target">new</field> </record> - - </data> -</openerp> \ No newline at end of file + + </data> +</openerp> diff --git a/addons/point_of_sale/wizard/pos_get_sale.py b/addons/point_of_sale/wizard/pos_get_sale.py deleted file mode 100644 index 48bd89bce7f4..000000000000 --- a/addons/point_of_sale/wizard/pos_get_sale.py +++ /dev/null @@ -1,81 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 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 -from tools.translate import _ - - -class pos_get_sale(osv.osv_memory): - _name = 'pos.get.sale' - _description = 'Get From Sale' - - _columns = { - 'picking_id': fields.many2one('stock.picking', 'Sale Order', domain=[('state', 'in', ('assigned', 'confirmed')), ('type', '=', 'out')], context="{'contact_display': 'partner'}", required=True), - } - - def sale_complete(self, cr, uid, ids, context=None): - """ - Select the picking order and add the in Point of sale order - @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 : nothing - """ - proxy_pos = self.pool.get('pos.order') - proxy_pick = self.pool.get('stock.picking') - proxy_order_line = self.pool.get('pos.order.line') - if context is None: - context = {} - this = self.browse(cr, uid, ids[0], context=context) - record_id = context and context.get('active_id', False) - - if record_id: - order = proxy_pos.browse(cr, uid, record_id, context=context) - if order.state in ('paid', 'invoiced'): - raise osv.except_osv(_('UserError '), _("You can't modify this order. It has already been paid")) - - for pick in proxy_pick.browse(cr, uid, [this.picking_id.id], context=context): - proxy_pos.write(cr, uid, record_id, { - 'picking_id': this.picking_id.id, - 'partner_id': pick.address_id and pick.address_id.partner_id.id - }, context=context) - - order = proxy_pick.write(cr, uid, [this.picking_id.id], { - 'invoice_state': 'none', - 'pos_order': record_id - }, context=context) - - for line in pick.move_lines: - proxy_order_line.create(cr, uid, { - 'name': line.sale_line_id.name, - 'order_id': record_id, - 'qty': line.product_qty, - 'product_id': line.product_id.id, - 'price_unit': line.sale_line_id.price_unit, - 'discount': line.sale_line_id.discount, - }, context=context) - return {} - -pos_get_sale() - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/point_of_sale/wizard/pos_get_sale.xml b/addons/point_of_sale/wizard/pos_get_sale.xml deleted file mode 100644 index 9a28da548d2c..000000000000 --- a/addons/point_of_sale/wizard/pos_get_sale.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<openerp> - <data> - - <!-- Select an Open Sale Order --> - - <record id="view_pos_get_sale" model="ir.ui.view"> - <field name="name">Open Sale Order</field> - <field name="model">pos.get.sale</field> - <field name="type">form</field> - <field name="arch" type="xml"> - <form string="Select an Open Sale Order"> - <field name="picking_id"/> - <newline/> - <group col="2" colspan="4"> - <button icon='gtk-cancel' special="cancel" - string="Cancel" /> - <button name="sale_complete" string="Confirm" - colspan="1" type="object" icon="gtk-ok" /> - </group> - </form> - </field> - </record> - <record id="action_pos_get_sale" model="ir.actions.act_window"> - <field name="name">Select an Open Sale Order</field> - <field name="type">ir.actions.act_window</field> - <field name="res_model">pos.get.sale</field> - <field name="view_type">form</field> - <field name="view_mode">form</field> - <field name="target">new</field> - </record> - </data> -</openerp> - \ No newline at end of file diff --git a/addons/point_of_sale/wizard/pos_sale_user_today.xml b/addons/point_of_sale/wizard/pos_sale_user_today.xml deleted file mode 100644 index 78f01a4650f3..000000000000 --- a/addons/point_of_sale/wizard/pos_sale_user_today.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<openerp> - <data> - <!-- pos.details --> - - <record id="view_pos_sales_user_today" model="ir.ui.view"> - <field name="name">Sales User Today</field> - <field name="model">pos.sales.user.today</field> - <field name="type">form</field> - <field name="arch" type="xml"> - <form string="Sales User Today"> - <group col="2" colspan="4"> - <field name="user_id"/> - <button icon='gtk-cancel' special="cancel" - string="Close" /> - <button name="print_report" string="Print Report" - colspan="1" type="object" icon="gtk-print" /> - </group> - </form> - </field> - </record> - <record id="action_pos_sales_user_today" model="ir.actions.act_window"> - <field name="name">Sale by Users</field> - <field name="type">ir.actions.act_window</field> - <field name="res_model">pos.sales.user.today</field> - <field name="view_type">form</field> - <field name="view_mode">form</field> - <field name="target">new</field> - </record> - - </data> -</openerp> \ No newline at end of file diff --git a/addons/point_of_sale/wizard/pos_sales_user_current_user.xml b/addons/point_of_sale/wizard/pos_sales_user_current_user.xml deleted file mode 100644 index e51ecfee7605..000000000000 --- a/addons/point_of_sale/wizard/pos_sales_user_current_user.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<openerp> - <data> - <!-- Sales for Current User --> - - <record id="view_pos_sales_user_today_current_user" model="ir.ui.view"> - <field name="name">Sales for Current User</field> - <field name="model">pos.sales.user.today.current_user</field> - <field name="type">form</field> - <field name="arch" type="xml"> - <form string="Sales for Current User"> - <group col="2" colspan="4"> - <button icon='gtk-cancel' special="cancel" - string="Close" /> - <button name="print_report" string="Print Report" - colspan="1" type="object" icon="gtk-print" /> - </group> - </form> - </field> - </record> - - - <record id="action_report_pos_sales_user_today_current_user" model="ir.actions.act_window"> - <field name="name">Sales for Current User</field> - <field name="type">ir.actions.act_window</field> - <field name="res_model">pos.sales.user.today.current_user</field> - <field name="view_type">form</field> - <field name="view_mode">form</field> - <field name="target">new</field> - </record> - - - </data> -</openerp> \ No newline at end of file -- GitLab