← Back to team overview

openerp-dev-web team mailing list archive

lp:~openerp-dev/openobject-addons/trunk-configuration-rework-todo-aag into lp:~openerp-dev/openobject-addons/trunk-configuration-rework

 

Atik Agewan(OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-configuration-rework-todo-aag into lp:~openerp-dev/openobject-addons/trunk-configuration-rework.

Requested reviews:
  Rucha (Open ERP) (rpa-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-configuration-rework-todo-aag/+merge/62440


Hello 

 changes of TODO:
 Improve res.company form view,hr_holidays,delivery,user preferences wiz.


Thanks
 
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-configuration-rework-todo-aag/+merge/62440
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-configuration-rework.
=== modified file 'base_setup/base_setup_installer.xml'
--- base_setup/base_setup_installer.xml	2011-05-18 12:37:22 +0000
+++ base_setup/base_setup_installer.xml	2011-05-26 09:47:55 +0000
@@ -217,11 +217,11 @@
           <field name="type">form</field>
           <field name="inherit_id" ref="base.view_company_form" />
           <field name="arch" type="xml">
-                <field name="rml_footer2" position="after">
-                     <newline/>
-                     <separator string="" colspan="4"/>
-                     <group colspan="4" col="2">
-                     <button name="preview_report" string="Preview Report" type="object" icon="gtk-print"/>
+                <field name="rml_header" position="before">
+                     <group colspan="4" col="8">
+                        <label string="" colspan="7"/>
+                        <button name="preview_report" string="Preview Report" type="object" icon="gtk-print"/>
+                        <separator string="" colspan="8"/>
                      </group>
                 </field>
           </field>

=== modified file 'base_setup/installer.py'
--- base_setup/installer.py	2011-05-25 12:50:26 +0000
+++ base_setup/installer.py	2011-05-26 09:47:55 +0000
@@ -231,7 +231,10 @@
         return res
 
     def execute(self, cr, uid, ids, context=None):
+        user_obj = self.pool.get('res.users')
+        user_ids = user_obj.search(cr, uid, [], context=context)
         for o in self.browse(cr, uid, ids, context=context):
+            user_obj.write(cr , uid, user_ids ,{'context_tz' : o.context_tz, 'context_lang' : o.context_lang, 'view' : o.view, 'menu_tips' : o.menu_tips}, context=context)
             ir_values_obj = self.pool.get('ir.values')
             ir_values_obj.set(cr, uid, 'default', False, 'context_tz', ['res.users'], o.context_tz)
             ir_values_obj.set(cr, uid, 'default', False, 'context_lang', ['res.users'], o.context_lang)

=== modified file 'delivery/delivery.py'
--- delivery/delivery.py	2011-01-14 00:11:01 +0000
+++ delivery/delivery.py	2011-05-26 09:47:55 +0000
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
-#    
+#
 #    OpenERP, Open Source Management Solution
 #    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
 #
@@ -15,7 +15,7 @@
 #    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/>.     
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
 
@@ -64,11 +64,21 @@
         'product_id': fields.many2one('product.product', 'Delivery Product', required=True),
         'grids_id': fields.one2many('delivery.grid', 'carrier_id', 'Delivery Grids'),
         'price' : fields.function(get_price, method=True,string='Price'),
-        'active': fields.boolean('Active', help="If the active field is set to False, it will allow you to hide the delivery carrier without removing it.")
+        'active': fields.boolean('Active', help="If the active field is set to False, it will allow you to hide the delivery carrier without removing it."),
+        'normal_price': fields.float('Normal Price'),
+        'international_price': fields.boolean('Use Detailed Pricelist'),
+        'free_if_more_than': fields.boolean('Free If More Than'),
+        'pricelist_ids': fields.one2many('delivery.grid', 'carrier_id', 'Price List'),
+        'amount': fields.float('Amount'),
+
     }
+
     _defaults = {
-        'active': lambda *args:1
+        'active': lambda *args:1,
+        'international_price': lambda *args: False,
+        'free_if_more_than': lambda *args: False
     }
+
     def grid_get(self, cr, uid, ids, contact_id, context=None):
         contact = self.pool.get('res.partner.address').browse(cr, uid, contact_id, context=context)
         for carrier in self.browse(cr, uid, ids, context=context):
@@ -86,6 +96,74 @@
                     continue
                 return grid.id
         return False
+
+    def create_grid_lines(self, cr, uid, ids, vals, context=None):
+        if context == None:
+            context = {}
+        grid_line_pool = self.pool.get('delivery.grid.line')
+        grid_pool = self.pool.get('delivery.grid')
+        for record in self.browse(cr, uid, ids, context=context):
+            grid_id = grid_pool.search(cr, uid, [('carrier_id', '=', record.id)], context=context)
+            if not grid_id:
+                record_data = {
+                    'name': vals.get('name', False),
+                    'carrier_id': record.id,
+                    'seqeunce': 10,
+                }
+                new_grid_id = grid_pool.create(cr, uid, record_data, context=context)
+                grid_id = [new_grid_id]
+
+            if record.free_if_more_than:
+                grid_lines = []
+                for line in grid_pool.browse(cr, uid, grid_id[0]).line_ids:
+                    if line.type == 'price':
+                        grid_lines.append(line.id)
+                grid_line_pool.unlink(cr, uid, grid_lines, context=context)
+                data = {
+                    'grid_id': grid_id and grid_id[0],
+                    'name': _('Free if more than %d') % record.amount,
+                    'type': 'price',
+                    'operator': '>=',
+                    'max_value': record.amount,
+                    'standard_price': 0.0,
+                    'list_price': 0.0,
+                }
+                grid_line_pool.create(cr, uid, data, context=context)
+            else:
+                _lines = []
+                for line in grid_pool.browse(cr, uid, grid_id[0], context=context).line_ids:
+                    if line.type == 'price':
+                        _lines.append(line.id)
+                grid_line_pool.unlink(cr, uid, _lines, context=context)
+
+            if record.normal_price:
+                default_data = {
+                    'grid_id': grid_id and grid_id[0],
+                    'name': _('Default price'),
+                    'type': 'price',
+                    'operator': '>=',
+                    'max_value': 0.0,
+                    'standard_price': record.normal_price,
+                    'list_price': record.normal_price,
+                }
+                grid_line_pool.create(cr, uid, default_data, context=context)
+
+        return True
+
+    def write(self, cr, uid, ids, vals, context=None):
+        if context == None:
+            context = {}
+        res_id = super(delivery_carrier, self).write(cr, uid, ids, vals, context=context)
+        self.create_grid_lines(cr, uid, ids, vals, context=context)
+        return res_id
+
+    def create(self, cr, uid, vals, context=None):
+        if context == None:
+            context = {}
+        res_id = super(delivery_carrier, self).create(cr, uid, vals, context=context)
+        self.create_grid_lines(cr, uid, [res_id], vals, context=context)
+        return res_id
+
 delivery_carrier()
 
 class delivery_grid(osv.osv):
@@ -151,13 +229,17 @@
     _columns = {
         'name': fields.char('Name', size=32, required=True),
         'grid_id': fields.many2one('delivery.grid', 'Grid',required=True),
-        'type': fields.selection([('weight','Weight'),('volume','Volume'),('wv','Weight * Volume'), ('price','Price')], 'Variable', required=True),
+        'type': fields.selection([('weight','Weight'),('volume','Volume'),\
+                                  ('wv','Weight * Volume'), ('price','Price'),\
+                                  ('country', 'Country')],\
+                                  'Variable', required=True),
         'operator': fields.selection([('==','='),('<=','<='),('>=','>=')], 'Operator', required=True),
         'max_value': fields.float('Maximum Value', required=True),
         'price_type': fields.selection([('fixed','Fixed'),('variable','Variable')], 'Price Type', required=True),
         'variable_factor': fields.selection([('weight','Weight'),('volume','Volume'),('wv','Weight * Volume'), ('price','Price')], 'Variable Factor', required=True),
         'list_price': fields.float('Sale Price', required=True),
         'standard_price': fields.float('Cost Price', required=True),
+        'country_id': fields.many2one('res.country', 'Country'),
     }
     _defaults = {
         'type': lambda *args: 'weight',
@@ -167,6 +249,11 @@
     }
     _order = 'list_price'
 
+    def on_change_type(self, cr, uid, ids, type):
+        if type == 'country':
+            return {'value': {'operator': '=='}}
+        return {}
+
 
 delivery_grid_line()
 

=== modified file 'delivery/delivery_view.xml'
--- delivery/delivery_view.xml	2011-01-14 00:11:01 +0000
+++ delivery/delivery_view.xml	2011-05-26 09:47:55 +0000
@@ -4,9 +4,6 @@
         <!-- Delivery Carriers -->
         <menuitem id="menu_delivery" name="Delivery" parent="stock.menu_stock_configuration" sequence="4"/>
 
-
-
-
         <record id="view_delivery_carrier_tree" model="ir.ui.view">
             <field name="name">delivery.carrier.tree</field>
             <field name="model">delivery.carrier</field>
@@ -25,10 +22,24 @@
             <field name="type">form</field>
             <field name="arch" type="xml">
                 <form string="Carrier">
-                    <field name="name" select="1"/>
-                    <field name="active" select="1"/>
-                    <field name="partner_id" select="1"/>
-                    <field name="product_id" select="1"/>
+                    <group colspan="4" col="4" name="general">
+                        <field name="name" select="1"/>
+                        <field name="active" select="1"/>
+                        <field name="partner_id" select="1"/>
+                        <field name="product_id" select="1"/>
+                        <separator string="Pricing Information" colspan="6"/>
+                        <group colspan="2" col="4">
+                            <field name="normal_price" select="1" colspan="4"/>
+                            <newline/>
+                            <field name="free_if_more_than"/>
+                            <field name="amount" attrs="{'invisible':[('free_if_more_than','=',False)]}"/>
+                        </group>
+                        <newline/>
+                        <field name="international_price"/>
+                        <newline/>
+                        
+                    </group>
+                    <field name="pricelist_ids" nolabel="1" attrs="{'invisible':[('international_price','=',False)]}"/>
                 </form>
             </field>
         </record>
@@ -40,6 +51,15 @@
             <field name="view_mode">tree,form</field>
             <field name="help">Create and manage the delivery methods you need for your sales activities. Each delivery method can be assigned to a price list which computes the price of the delivery according to the products sold or delivered.</field>
         </record>
+
+        <record id="action_delivery_carrier_form1" model="ir.actions.act_window">
+            <field name="name">Delivery Method</field>
+            <field name="type">ir.actions.act_window</field>
+            <field name="res_model">delivery.carrier</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">form</field>
+        </record>
+
         <menuitem action="action_delivery_carrier_form" id="menu_action_delivery_carrier_form" parent="menu_delivery" groups="base.group_extended"/>
 
         <!-- Delivery Grids -->
@@ -98,13 +118,18 @@
             <field name="type">form</field>
             <field name="arch" type="xml">
                 <form string="Grid Lines">
-                    <field colspan="4" name="name" select="1"/>
-                    <field name="type" string="Condition"/>
-                    <field name="operator" nolabel="1"/>
-                    <field name="max_value" nolabel="1"/>
+                    <group colspan="5" col="5">
+                        <field colspan="4" name="name" select="1"/>
+                        <newline/>
+                        <field name="type" string="Condition" on_change="on_change_type(type)"/>
+                        <field name="operator" nolabel="1" attrs="{'readonly':[('type','=','country')]}"/>
+                        <field name="max_value" nolabel="1" attrs="{'invisible':[('type','=','country')]}"/>
+                        <field name="country_id" attrs="{'invisible':[('type','!=','country')], 'required':[('type','=','country')]}" nolabel="1"/>
+                    </group>
+                    <newline/>
                     <field name="list_price"/>
                     <field name="standard_price" groups="base.group_extended"/>
-                    <field name="price_type"  />
+                    <field name="price_type"/>
                     <field name="variable_factor" attrs="{'invisible':[('price_type','=','fixed')]}"/>
                 </form>
             </field>
@@ -118,7 +143,8 @@
                     <field name="name"/>
                     <field name="type"/>
                     <field name="operator"/>
-                    <field name="max_value"/>
+                    <field name="country_id" nolabel="1" attrs="{'invisible':[('type','!=','country')]}"/>
+                    <field name="max_value" nolabel="1" attrs="{'invisible':[('type','=','country')]}"/>
                     <field name="list_price"/>
                     <field name="standard_price" groups="base.group_extended"/>
                 </tree>
@@ -286,6 +312,12 @@
             </field>
         </record>
 
+       <record id="delivery_method_form_view_todo" model="ir.actions.todo">
+           <field name="action_id" ref="action_delivery_carrier_form1"/>
+           <field name="sequence">10</field>
+           <field name="type">normal</field>
+           <field name="state">skip</field>
+       </record>
 
     </data>
 </openerp>

=== modified file 'hr_holidays/hr_holidays.py'
--- hr_holidays/hr_holidays.py	2011-05-12 12:39:20 +0000
+++ hr_holidays/hr_holidays.py	2011-05-26 09:47:55 +0000
@@ -342,6 +342,13 @@
         return True
 
    def _get_remaining_days(self, cr, uid, ids, name, args, context=None):
+        module_obj = self.pool.get('ir.module.module')
+        hr_id = module_obj.search(cr, uid, [('name', '=', 'hr')], context=context)
+        hr_state = module_obj.browse(cr, uid, hr_id[0], context=context).state
+        false_ids = self.pool.get('hr.holidays.status').search(cr, uid, [('limit', '=', False)], context=context)
+        if hr_state == 'installed':
+            if len(false_ids) != 1 :
+                raise osv.except_osv(('warning !'),_("You should have only one leave type without allowing override limit, %s Found !") % (len(false_ids)))
         cr.execute("SELECT sum(h.number_of_days_temp) as days, h.employee_id from hr_holidays h join hr_holidays_status s on (s.id=h.holiday_status_id) where h.type='add' and h.state='validate' and s.limit=False  group by h.employee_id")
         res = cr.dictfetchall()
         remaining = {}

=== modified file 'hr_holidays/hr_holidays_data.xml'
--- hr_holidays/hr_holidays_data.xml	2011-04-07 09:27:30 +0000
+++ hr_holidays/hr_holidays_data.xml	2011-05-26 09:47:55 +0000
@@ -5,7 +5,7 @@
     <!-- Casual leave -->
     <record model="hr.holidays.status" id="holiday_status_cl">
       <field name="name">Legal Leaves</field>
-      <field name="limit">False</field>
+      <field name="limit">True</field>
       <field name="color_name">black</field>
     </record>
 
@@ -20,7 +20,6 @@
     <!-- Compensatory Days -->
     <record model="hr.holidays.status" id="holiday_status_comp">
       <field name="name">Compensatory Days</field>
-      <field name="limit">False</field>
       <field name="color_name">brown</field>
     </record>
 

=== modified file 'hr_holidays/hr_holidays_view.xml'
--- hr_holidays/hr_holidays_view.xml	2011-05-12 12:39:20 +0000
+++ hr_holidays/hr_holidays_view.xml	2011-05-26 09:47:55 +0000
@@ -451,7 +451,7 @@
             <field name="arch" type="xml">
                 <tree string="Assign Leaves" editable="top">
                     <field name="name" string="Employee"/>
-                    <field name="remaining_leaves"/>
+                    <field name="remaining_leaves" string="Remaining Legal Leaves"/>
                 </tree>
             </field>
         </record>  

=== modified file 'point_of_sale/point_of_sale_view.xml'
--- point_of_sale/point_of_sale_view.xml	2011-04-07 07:19:56 +0000
+++ point_of_sale/point_of_sale_view.xml	2011-05-26 09:47:55 +0000
@@ -639,12 +639,12 @@
             <field name="type">form</field>
             <field name="inherit_id" ref="base.view_company_form"/>
             <field name="arch" type="xml">
-                <notebook position="inside">
-                    <page string="Other">
-                      <field  name="company_discount" colspan="4"/>
-                      <field  name="max_diff" colspan="4"/>
-                    </page>
-                </notebook>
+                    <field name="currency_id" position="after">
+                        <separator string="Other Information" colspan="4"/>
+                        <field  name="company_discount" />
+                        <newline/>
+                        <field  name="max_diff" />
+                     </field>
             </field>
            </record>
 


Follow ups