[MOD] point_of_sale : Modification in access rights
[odoo/odoo.git] / addons / point_of_sale / pos_view.xml
index d67476a..8b6e58e 100644 (file)
@@ -1,6 +1,9 @@
 <?xml version="1.0"?>
 <openerp>
     <data>
+        <menuitem name="Point of Sale" id="menu_point_root" sequence="21"
+            icon="terp-partner"
+            groups="group_pos_manager,group_pos_user,base.group_system"/>
 
         <record model="ir.ui.view" id="view_pos_pos_form">
             <field name="name">pos.order</field>
             <field name="type">form</field>
             <field name="arch" type="xml">
                 <form string="Sales Order POS">
-                    <notebook >
-                        <page string="Order lines">
-                            <group colspan="4" col="6">
-                                <field name="user_salesman_id" />
-                                <field name="partner_id" on_change="onchange_partner_pricelist(partner_id)"/>
-                                <field name="contract_number" select="1" groups="base.group_extended"/>
-                            </group>
+                    <group col="6" colspan="4">
+                        <!--field name="user_salesman_id" />
+                        <field name="partner_id" on_change="onchange_partner_pricelist(partner_id)"/>
+                        <field name="contract_number" groups="base.group_extended"/> -->
+
+                    </group>
+                     <notebook colspan="4">
+                      <page string="Sale Order ">
                             <field name="lines" colspan="4" nolabel="1">
                                 <tree string="Order lines" editable="bottom">
                                     <field name="product_id" on_change="onchange_product_id(parent.pricelist_id,product_id,qty,parent.partner_id)" width="275" />
-                                    <field name="qty" />
-                                    <field name="qty_rfd" />
+                                    <field name="qty"/>
+                                    <!--<field name="qty" on_change="onchange_qty(qty,price_unit)"/>-->
+                                    <!--field name="qty_rfd" groups="base.group_extended"/-->
                                     <field name="discount" on_change="onchange_discount(discount,price_unit)" />
-                                    <field name="price_ded" on_change="onchange_ded(price_ded, price_unit)" />
+                                    <field name="price_ded" on_change="onchange_ded(price_ded, price_subtotal_incl,price_unit)" invisible="1"/>
                                     <field name="price_unit" readonly="1"/>
-                                    <field name="notice"/>
-                                    <field name="serial_number"/>
+                                    <field name="notice" on_change="onchange_dis(qty,price_subtotal_incl,discount)"/>
+                                    <!--field name="serial_number"/-->
                                     <field name="price_subtotal" />
-                                    <field name="price_subtotal_incl"/>
+                                    <field name="price_subtotal_incl" sum="Subtotal"/>
                                 </tree>
                                 <form string="Order lines" >
                                     <field name="product_id" on_change="onchange_product_id(parent.pricelist_id,product_id,qty,parent.partner_id)" width="275"/>
-                                    <field name="qty" />
-                                    <field name="qty_rfd" />
+                                    <field name="qty"/>
+                                    <field name="qty_rfd" groups="base.group_extended"/>
                                     <field name="discount" on_change="onchange_discount(discount,price_unit)" />
                                     <field name="price_ded" on_change="onchange_ded(price_ded, price_unit)" />
                                     <field name="price_unit"/>
                             <group colspan="4" col="7">
                                 <field name="amount_tax"/>
                                 <field name="amount_total"/>
-                                <button name="%(action_pos_discount)d" string="D_iscount" type="action" states="draft"/>
-                                <button name="dummy_button" string="Compute" type="object" />
+                                <!--button name="%(action_pos_discount)d" string="D_iscount" type="action" states="draft"/>
+                                <button name="dummy_button" string="Compute" type="object" /-->
                             </group>
 
-                            <group colspan="4" col="9" groups="base.group_extended">
-                            <separator colspan="4" string="Validation of the Sale"/>
-                                <newline/>
-                                <field name="state_2" />
-                                <button name="button_validate"
-                                        string="Accept"
-                                        type="object"
-                                     icon="gtk-ok"
-                                    states="paid, draft"
-                                        attrs="{'invisible':[('state_2','=','accepted')]}"/>
-                              </group>
+<!--                            <group colspan="4" col="9" groups="base.group_extended">-->
+<!--                            <separator colspan="4" string="Validation of the Sale"/>-->
+<!--                                <newline/>-->
+<!--                                <field name="state_2" />-->
+<!--                                <button name="button_validate"-->
+<!--                                        string="Accept"-->
+<!--                                        type="object"-->
+<!--                                     icon="gtk-ok"-->
+<!--                                    states="paid, draft"-->
+<!--                                        attrs="{'invisible':[('state_2','=','accepted')]}"/>-->
+<!--                              </group>-->
                             <separator colspan="4" string="Actions"/>
                             <group colspan="4" col="6">
-                                <field name="state" select="1"/>
-                                <button name="%(action_pos_payment)d" string="Ma_ke Payment" icon="gtk-ok" type="action" states="draft,advance" context="{'record_id':'active_id'}" />
+                                <field name="state" />
+                                <button name="%(action_pos_payment)d" string="Ma_ke Payment" icon="gtk-ok" 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')]}"/>                             
+                                    attrs="{'invisible':[('state','!=','paid'),('state','!=','invoiced')]}" context="{'return':'return'}" />
                             </group>
                         </page>
 
-                        <page string="Payment">
+                        <page string="Order and Payment">
                             <group colspan="2" col="2" name="Type">
                                 <separator string="Order Information" colspan="4"/>
-                                <field name="company_id"/>
+                                <field name="user_salesman_id" />
+                                <field name="company_id" groups="base.group_multi_company"/>
                                 <field name="shop_id" widget="selection"  />
-                                <field name="name" select="1"/>
-                                <field name="user_id" />
-                                <field name="sale_manager" />
+                                <field name="name"/>
+                                <field name="user_id" string="Salesman"/>
+                                <!--field name="sale_manager" /-->
                                 <field name="price_type" />
                             </group>
                             <group colspan="2" col="2" name="Type">
                                 <separator string="Dates" colspan="4"/>
-                                <field name="date_order" select="1" />
-                                <field name="date_validation" select="1"  />
-                                <field name="date_payment" select="1"  groups="base.group_extended"/>
+                                <field name="date_order"/>
+                                <field name="date_validation" />
+                                <field name="date_payment" groups="base.group_extended"/>
+                                <field name="type_rec"  colspan="4"/>
                             </group>
                             <group colspan="4">
-                                <separator string="Invoicing" colspan="4"/>
-                                <field name="sale_journal" domain="[('type','=','sale'),('company_id','=',company_id)]"/>
-                                <field name="pricelist_id" domain="[('type','=','sale')]" widget="selection"/>
-                                <field name="invoice_id"/>
-                                <group colspan="2" col="3">
-                                    <button name="invoice" string="Create _Invoice" states="paid"/>
-                                </group>
+<!--                                <separator string="Invoicing" colspan="4"/>-->
+                                <field name="partner_id" on_change="onchange_partner_pricelist(partner_id)" invisible="1"/>
+                                <field name="sale_journal" domain="[('type','=','sale')]" widget="selection" invisible="1"/>
+                                <field name="pricelist_id" domain="[('type','=','sale')]" widget="selection" invisible="1"/>
+<!--                                <field name="invoice_id"/>-->
+<!--                                <group colspan="2" col="4">-->
+<!--                                    <button name="invoice" icon="gtk-execute" string="Create _Invoice" states="paid"/>-->
+<!--                                </group>-->
                             </group>
 
                             <field name="statement_ids" colspan="4" nolabel="1">
                                 </form>
                             </field>
                         </page>
+
                         <page string="Notes" >
-                            <separator string="Notes" colspan="4" />
-                            <group colspan="4">
-                                <field name="type_rec"  colspan="4"/>
-                                <field name="note"  colspan="4"/>
-                            </group>
+                            <field colspan="4" name="note" nolabel="1"/>
                         </page>
                     </notebook>
 
             <field name="arch" type="xml">
                 <tree string="POS Orders">
                     <field name="name"/>
-                    <field name="date_order" select="1"/>
+                    <field name="date_order"/>
                     <field name="date_validation"/>
                     <field name="date_payment"/>
                     <field name="user_id"/>
                     <field name="invoice_id"/>
-                    <field name="state" select="1"/>
+                    <field name="state" />
                     <field name="amount_total" sum="Amount total"/>
-                    <field name="company_id"/>
+                    <field name="company_id" groups="base.group_multi_company"/>
                 </tree>
             </field>
         </record>
             <field name="type">search</field>
             <field name="arch" type="xml">
                 <search string="Search Sales Order">
-                    <filter icon="terp-sale" string="Quotations" domain="[('state','=','draft')]"/>
-                    <filter icon="terp-sale" string="Running" domain="[('state','in',('payment','advance'))]"/>
+                    <filter icon="terp-document-new" string="Quotations" domain="[('state','=','draft')]"/>
+                    <filter icon="terp-check" string="Running" domain="[('state','in',('payment','advance'))]"/>
                     <separator orientation="vertical"/>
                     <field name="name" select="1"/>
                     <field name="partner_id" select="1"/>
-                    <field name="user_id" select="1" widget="selection">
-                        <filter icon="terp-partner" string="My Sale" domain="[('user_id','=',uid)]" help="My Sale Orders" />
-                    </field>
+                    <field name="user_id" select="1"/>
                     <field name="date_order" select="1" string="Order date" />
                     <newline/>
-                    <group expand="1" string="Group By..." colspan="11" col="11">
-                        <filter string="Customer" icon="terp-sale" domain="[]" context="{'group_by':'partner_id'}"/>
-                        <filter string="State" icon="terp-sale" domain="[]" context="{'group_by':'state'}"/>
-                        <filter string="Order Date" icon="terp-sale" domain="[]" context="{'group_by':'date_order'}"/>
-                        <filter string="Salesman" icon="terp-sale" domain="[]" context="{'group_by':'user_id'}"/>
+                    <group expand="0" string="Group By..." colspan="11" col="11" groups="base.group_extended">
+                        <filter string="Customer" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
+                        <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
+                        <filter string="Order Date" icon="terp-go-month" domain="[]" context="{'group_by':'date_order'}"/>
+                        <filter string="Salesman" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
                     </group>
                </search>
             </field>
         </record>
-        
-        <menuitem name="Point of Sale" id="menu_point_root" sequence="10"/>
-        <menuitem name="Point of Sale" id="menu_point_of_sale" parent="menu_point_root" sequence="1" />
-        <menuitem name="Sales Order" parent="menu_point_of_sale" id="menu_point_ofsale" action="action_pos_pos_form" sequence="1"/>
-        <menuitem name="Products" id="menu_point_of_sale_product" parent="menu_point_root" sequence="2" />
-        
+
+        <menuitem name="Daily Operations" id="menu_point_of_sale" parent="menu_point_root" sequence="1" />
+        <menuitem name="Sales Order" parent="menu_point_of_sale" id="menu_point_ofsale" action="action_pos_pos_form" sequence="1" groups="group_pos_manager,group_pos_user"/>
+        <menuitem name="Products" id="menu_point_of_sale_product" parent="menu_point_root" sequence="15" />
+
         <menuitem action="product.product_normal_action" id="menu_pos_products" parent="menu_point_of_sale_product" sequence="2" name="Products"/>
 
         <!--  POS Order view (date_payment)  -->
             <field name="view_type">form</field>
             <field name="view_mode">tree,form</field>
             <field name="view_id" ref="view_pos_order_tree"/>
-            <field name="domain">['|',('state_2','=','to_verify'),('state','=','advance')]</field>
-                       <field name="search_view_id" ref="view_pos_order_filter"/>                   
-                                          
+            <field name="domain">['|',('state','=','advance')]</field>
+            <field name="context">{"search_default_user_id":uid}</field>
+            <field name="search_view_id" ref="view_pos_order_filter"/>
+
         </record>
 
         <record model="ir.actions.act_window" id="action_pos_order_tobinvoiced">
             <field name="view_mode">tree,form</field>
             <field name="view_id" ref="view_pos_order_tree"/>
             <field name="domain">[('state','!=', 'invoiced')]</field>
-                       <field name="search_view_id" ref="view_pos_order_filter"/>                   
-                                    
+            <field name="context">{"search_default_user_id":uid}</field>
+            <field name="search_view_id" ref="view_pos_order_filter"/>
+
         </record>
         <menuitem name="Invoicing" id="menu_point_of_sale_invoicing" parent="menu_point_root" sequence="4" />
         <menuitem name="Sales to Invoice" action="action_pos_order_tobinvoiced" id="menu_point_of_sale_tobinvoiced" parent="menu_point_of_sale_invoicing"/>
             <field name="view_type">form</field>
             <field name="view_mode">tree,form</field>
             <field name="domain">[('state','=', 'paid')]</field>
-                       <field name="search_view_id" ref="view_pos_order_filter"/>                     
+            <field name="context">{"search_default_user_id":uid}</field>
+             <field name="search_view_id" ref="view_pos_order_filter"/>
         </record>
         <record model="ir.actions.act_window" id="action_pos_order_tree2">
             <field name="name">Point of Sale</field>
             <field name="view_type">form</field>
             <field name="view_mode">tree,form</field>
             <field name="domain">[('date_order','&lt;=', time.strftime('%Y-%m-%d 23:59:59'))]</field>
-                       <field name="search_view_id" ref="view_pos_order_filter"/>                     
+            <field name="context">{"search_default_user_id":uid}</field>
+             <field name="search_view_id" ref="view_pos_order_filter"/>
         </record>
 
         <record model="ir.actions.act_window" id="action_pos_order_tree3">
             <field name="res_model">pos.order</field>
             <field name="view_type">form</field>
             <field name="view_mode">tree,form</field>
-                       <field name="search_view_id" ref="view_pos_order_filter"/>            
+            <field name="context">{"search_default_user_id":uid}</field>
+            <field name="search_view_id" ref="view_pos_order_filter"/>
         </record>
         <record model="ir.actions.act_window" id="action_pos_order_tree_open">
             <field name="name">Opened Sales</field>
             <field name="res_model">pos.order</field>
             <field name="view_type">form</field>
             <field name="view_mode">form,tree</field>
-                       <field name="search_view_id" ref="view_pos_order_filter"/>            
+            <field name="context">{"search_default_user_id":uid}</field>
+            <field name="search_view_id" ref="view_pos_order_filter"/>
         </record>
 
         <record model="ir.ui.view" id="view_pos_order_line">
                                   <field name="expense_pdt"/>
                             <field name="am_out"/>
                           <field name="disc_controle"/>
-                                  <field name="company_id" groups="base.group_extended"/>
+                                  <field name="company_id" groups="base.group_extended,base.group_multi_company"/>
                               </group>
                               <group colspan="2" col="2" name="Prices">
                                   <separator string="Prices" colspan="2"/>
         </record>
 
         <menuitem name="Configuration" parent="menu_point_root"
-            id="menu_point_config_product" sequence="6"/>
+            id="menu_point_config_product" sequence="25" groups="base.group_system"/>
 
         <record model="ir.actions.act_window" id="action_product_input">
             <field name="name">Products</field>
         <menuitem name="Products for Input Operations"
                     parent="menu_point_config_product"
                     action="action_product_input"
-                    id="products_for_input_operations"/>
+                    id="products_for_input_operations"
+                    groups="base.group_system"/>
 
         <record model="ir.actions.act_window" id="action_product_output">
             <field name="name">Products</field>
         <menuitem name="Products for Output Operations"
                     parent="menu_point_config_product"
                     action="action_product_output"
-                    id="products_for_output_operations"/>
-            
-        <menuitem name="Register Management" parent="menu_point_root"
-            id="menu_point_config" sequence="3"/>
+                    id="products_for_output_operations"
+                    groups="base.group_system"/>
+
+<!--        <menuitem name="Register Management" parent="menu_point_root"-->
+<!--            id="menu_point_config" sequence="4"/>-->
         <menuitem
-            name="Input Operations" parent="menu_point_config"
+            name="Input Operations" parent="menu_point_of_sale"
             string="Refloat"
             action="action_box_entries"
-            id="menu_wizard_enter_jrnl" sequence="3" />
-            
+            id="menu_wizard_enter_jrnl" sequence="2" />
+
         <menuitem
-            name="Output Operations" parent="menu_point_config"
+            name="Output Operations" parent="menu_point_of_sale"
             string="Refloat"
             action="action_box_out"
             id="menu_wizard_enter_jrnl2" sequence="3" />
                     <field name="note" select="1" />
                     <field name="state" select="1"/>
                     <field name="amount_total" sum="Amount total"/>
-                    <field name="company_id"/>
+                    <field name="company_id" groups="base.group_multi_company"/>
                 </tree>
             </field>
         </record>
         </record>
 
         <!--  Miscelleanous Operations/Reporting -->
-        <menuitem name="Reporting" parent="menu_point_root" id="menu_point_rep" sequence="5"/>
+        <menuitem name="Reporting" parent="menu_point_root" id="menu_point_rep" sequence="20"/>
         <menuitem name="Registers" parent="menu_point_rep" id="menu_point_report_register" sequence="0" />
         <menuitem name="Sales" parent="menu_point_rep" id="menu_point_report_sale" sequence="1" />
 
 
         <menuitem icon="STOCK_PRINT" action="action_report_pos_payment_repport_date"
                 id="menu_pos_payment_report_date" parent="menu_trans_pos_tree" sequence="5" groups="base.group_extended"/>
+
         <menuitem icon="STOCK_PRINT" action="action_report_pos_payment_report_user"
                 id="menu_pos_payment_report_user" parent="menu_trans_pos_tree_today" sequence="6" groups="base.group_extended"/>
         <menuitem icon="STOCK_PRINT" action="action_pos_sales_user_today"