[IMP] point_of_sale: Fixed view errors. Improved reports.
authoruco (Open ERP) <uco@tinyerp.com>
Mon, 20 Sep 2010 07:10:38 +0000 (12:40 +0530)
committeruco (Open ERP) <uco@tinyerp.com>
Mon, 20 Sep 2010 07:10:38 +0000 (12:40 +0530)
bzr revid: uco@tinyerp.com-20100920071038-ga4s8dbt0obnaqja

12 files changed:
addons/account/account_view.xml
addons/point_of_sale/pos_view.xml
addons/point_of_sale/report/pos_payment_report_date.py
addons/point_of_sale/report/report_cash_register_view.xml
addons/point_of_sale/report/report_pos_order_view.xml
addons/point_of_sale/wizard/pos_box_entries.xml
addons/point_of_sale/wizard/pos_box_out.xml
addons/point_of_sale/wizard/pos_close_statement.xml
addons/point_of_sale/wizard/pos_open_statement.xml
addons/point_of_sale/wizard/pos_payment.xml
addons/point_of_sale/wizard/pos_payment_report_date.py
addons/point_of_sale/wizard/pos_receipt_view.xml

index 40f8fd2..b2fa853 100644 (file)
                                     <field domain="[('journal_id','=',parent.journal_id)]" name="account_id"/>
                                     <field name="analytic_account_id" groups="base.group_extended" />
                                     <field name="amount"/>
-                                    <field context="{'partner_id': partner_id, 'amount': amount, 'account_id': account_id, 'currency_id': parent.currency, 'journal_id': parent.journal_id, 'date':date}" name="reconcile_id"/>
-                                    <field invisible="1" name="reconcile_amount"/>
                                 </tree>
                                 <form string="Statement lines">
                                     <field name="date"/>
                                     <field domain="[('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view')]" name="account_id"/>
                                     <field name="analytic_account_id" groups="base.group_extended" />
                                     <field name="amount"/>
-                                    <field context="{'partner_id':partner_id,'amount':amount,'account_id':account_id,'currency_id': parent.currency,'journal_id':parent.journal_id, 'date':date}" name="reconcile_id"/>
                                     <field name="ref"/>
                                     <field name="sequence"/>
                                     <separator colspan="4" string="Notes"/>
index a12a71f..c0f7b56 100644 (file)
                             <separator colspan="4"/>
                             <group colspan="4" col="6">
                                 <field name="state" />
-                                <button name="%(action_pos_payment)d" string="Ma_ke Payment" icon="terp-dolar" type="action" states="draft,advance" />
-                                <button name="%(action_report_pos_receipt)d" string="_Reprint" icon="gtk-print" type="action" states="paid,done,invoiced"/>
-                                <button name="set_to_draft" string="Set to _draft" states="paid" icon="gtk-execute" type="object" />
-                                <button name="%(action_view_pos_return)d" string="Return P_icking" type="action" icon="gtk-ok" states="paid"
+                                <button name="%(action_pos_payment)d" string="Make Payment" icon="terp-dolar" type="action" states="draft,advance" />
+                                <button name="%(action_report_pos_receipt)d" string="Reprint" icon="gtk-print" type="action" states="paid,done,invoiced"/>
+                                <button name="set_to_draft" string="Set to draft" states="paid" icon="gtk-execute" type="object" />
+                                <button name="%(action_view_pos_return)d" string="Return Picking" type="action" icon="gtk-ok" states="paid"
                                     attrs="{'invisible':[('state','!=','paid'),('state','!=','invoiced')]}" context="{'return':'return'}" />
                             </group>
                         </page>
index 38f87d5..e492e92 100644 (file)
@@ -37,12 +37,20 @@ class pos_payment_report_date(report_sxw.rml_parse):
         dt1 = form['date_start'] + ' 00:00:00'
         dt2 = form['date_end'] + ' 23:59:59'
         data={}
-        self.cr.execute ("select pt.name,pol.qty,pol.discount,pol.price_unit, " \
-                         "(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 " \
-                         "where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id  " \
-                         "and po.state IN ('paid','invoiced') and po.date_order  >= %s and po.date_order <= %s and po.user_id IN %s " \
-                         ,(dt1,dt2,tuple(form['user_id'])))
+        if form['user_id']:
+            self.cr.execute ("select pt.name,pol.qty,pol.discount,pol.price_unit, " \
+                             "(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 " \
+                             "where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id  " \
+                             "and po.state IN ('paid','invoiced') and po.date_order  >= %s and po.date_order <= %s and po.user_id IN %s " \
+                             ,(dt1,dt2,tuple(form['user_id'])))
+        else:
+            self.cr.execute ("select pt.name,pol.qty,pol.discount,pol.price_unit, " \
+                             "(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 " \
+                             "where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id  " \
+                             "and po.state IN ('paid','invoiced') and po.date_order  >= %s and po.date_order <= %s" \
+                             ,(dt1,dt2))
         data=self.cr.dictfetchall()
         return data
 
@@ -50,11 +58,18 @@ class pos_payment_report_date(report_sxw.rml_parse):
         dt1 = form['date_start'] + ' 00:00:00'
         dt2 = form['date_end'] + ' 23:59:59'
         res=[]
-        self.cr.execute ("select sum(pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0)) " \
-                         "from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt " \
-                         "where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id " \
-                         "and po.state IN ('paid','invoiced') and po.date_order  >= %s and po.date_order <= %s and po.user_id IN %s " \
-                         ,(dt1,dt2,tuple(form['user_id'])))
+        if form['user_id']:
+            self.cr.execute ("select sum(pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0)) " \
+                             "from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt " \
+                             "where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id " \
+                             "and po.state IN ('paid','invoiced') and po.date_order  >= %s and po.date_order <= %s and po.user_id IN %s " \
+                             ,(dt1,dt2,tuple(form['user_id'])))
+        else:
+            self.cr.execute ("select sum(pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0)) " \
+                             "from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt " \
+                             "where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id " \
+                             "and po.state IN ('paid','invoiced') and po.date_order  >= %s and po.date_order <= %s" \
+                             ,(dt1,dt2))
         res=self.cr.fetchone()[0] or 0.0
         return res
 
index 2f96d4f..3cda047 100644 (file)
                <field name="arch" type="xml">
                    <search string="Point of Sale Cash Register Analysis">
                        <group>
-                           <filter icon="terp-go-year" string="  This Year  "
+                           <filter icon="terp-go-year" string="Year"
                                domain="[('year','=',time.strftime('%%Y'))]"
                                help="Cash Analysis created during this year"/>
-                           <filter icon="terp-go-month" string="   This Month   "
+                           <filter icon="terp-go-month" string="Month"
                                domain="[('month','=',time.strftime('%%m'))]"
                                help="Cash Analysis created in current month"/>
                            <filter icon="terp-go-month"
index 40bcf40..6a9bc68 100644 (file)
                <field name="arch" type="xml">
                    <search string="Point of Sale Analysis">
                        <group>
-                           <filter icon="terp-go-year" string="This Year"
+                           <filter icon="terp-go-year" string="Year"
                                domain="[('year','=',time.strftime('%%Y'))]"
                                help="POS ordered created during current year"/>
-                           <filter icon="terp-go-month" string="This Month"
+                           <filter icon="terp-go-month" string="Month"
                                domain="[('month','=',time.strftime('%%m'))]"
                                help="POS ordered created during current month"/>
                            <filter icon="terp-go-month"
index 33cfefb..e0af60a 100644 (file)
@@ -18,8 +18,8 @@
                                <group colspan="4" col="4">
                                    <group col="2" colspan="2"/>
                                                <button icon="gtk-stop" special="cancel"
-                                       string="_Cancel" />
-                               <button name="get_in" string="_Put Money"
+                                       string="Cancel" />
+                               <button name="get_in" string="Put Money"
                                        colspan="1" type="object" icon="terp-dolar_ok!" />
                                </group>
                 </form>
index 2bcbb27..3bd817b 100644 (file)
@@ -18,8 +18,8 @@
                                        <group colspan="4" col="4">
                                            <group col="2" colspan="2"/>
                                                        <button icon="gtk-stop" special="cancel"
-                                               string="_Cancel" />
-                                       <button name="get_out" string="_Take Money"
+                                               string="Cancel" />
+                                       <button name="get_out" string="Take Money"
                                                colspan="1" type="object" icon="terp-dolar" />
                            </group>
                 </form>
index 91d254f..c1ee3dc 100644 (file)
@@ -14,8 +14,8 @@
                     <group col="4" colspan="4">
                         <group col="2" colspan="2"/>
                         <button icon='gtk-stop' special="cancel"
-                            string="_No" />
-                        <button name="close_statement" string="_Yes"
+                            string="No" />
+                        <button name="close_statement" string="Yes"
                              type="object" icon="gtk-ok"/>
                    </group>
                 </form>
index 3f44039..2b275d3 100644 (file)
@@ -14,8 +14,8 @@
                            <group col="4" colspan="4">
                                    <group col="2" colspan="2"/>
                                <button icon='gtk-stop' special="cancel"
-                                       string="_No" />
-                               <button name="open_statement" string="_Yes"
+                                       string="No" />
+                               <button name="open_statement" string="Yes"
                                         type="object" icon="gtk-ok"/>
                    </group>
                 </form>
index e3549bb..36c9266 100644 (file)
@@ -32,8 +32,8 @@
                                    <separator colspan="4"/>
                                    <group col="4" colspan="4">
                                        <group col="2" colspan="2"/>
-                               <button icon='gtk-stop' special="cancel"  string="_Cancel" />
-                                               <button name="check" string="Ma_ke Payment" colspan="1" type="object" icon="terp-dolar"/>
+                               <button icon='gtk-stop' special="cancel"  string="Cancel" />
+                                               <button name="check" string="Make Payment" colspan="1" type="object" icon="terp-dolar"/>
                                        </group>        
                                 </group>
                                </form>
index eb5a3d9..0830e09 100644 (file)
@@ -51,7 +51,7 @@ class pos_payment_report_date(osv.osv_memory):
     _columns = {
         'date_start': fields.date('Start Date', required=True),
         'date_end': fields.date('End Date', required=True),
-        'user_id': fields.many2many('res.users', 'res_user_sale', 'user_id', 'sale_id', 'Salesman', required=True)
+        'user_id': fields.many2many('res.users', 'res_user_sale', 'user_id', 'sale_id', 'Salesman')
     }
     _defaults = {
         'date_start': lambda *a: time.strftime('%Y-%m-%d'),
index 2e852b8..3f935f5 100644 (file)
@@ -12,8 +12,8 @@
                        <form string="Receipt :">
             <separator string="Print the receipt of the sale" colspan="4"/>
                          <button icon='gtk-cancel' special="cancel"
-                                 string="_Cancel" />
-                         <button name="print_report" string="_Print Receipt"
+                                 string="Cancel" />
+                         <button name="print_report" string="Print Receipt"
                                  colspan="1" type="object" icon="gtk-print" />
                        </form>
                      </field>