[MERGE] Latest trunk
authorvta vta@openerp.com <>
Wed, 26 Dec 2012 18:20:41 +0000 (19:20 +0100)
committervta vta@openerp.com <>
Wed, 26 Dec 2012 18:20:41 +0000 (19:20 +0100)
bzr revid: vta@openerp.com-20121226182041-q05byjif0e3ghz9w

addons/crm/crm_lead_view.xml
addons/document/document.py
addons/document/document_view.xml
addons/hr_evaluation/hr_evaluation_view.xml
addons/lunch/lunch.py
addons/sale/sale_view.xml

index 2bab40e..24837cf 100644 (file)
                             <label for="section_id"/>
                             <div>
                                 <field name="section_id"/>
-                                <button name="case_escalate" string="Escalate" type="object" states="draft,open,pending"/>
+                                <button name="case_escalate" string="Escalate" type="object" attrs="{'invisible': ['|', ('section_id','=',False), ('state', 'not in', ['draft','open','pending'])]}"/>
                             </div>
                             <field name="type" invisible="1"/>
                         </group>
                                 <label for="section_id"/>
                                 <div>
                                     <field name="section_id" widget="selection"/>
-                                    <button name="case_escalate" string="Escalate" type="object" class="oe_link"
-                                        attrs="{'invisible': [('section_id', '=', False)]}"/>
+                                    <button name="case_escalate" string="Escalate" type="object" class="oe_link" attrs="{'invisible': ['|', ('section_id','=',False), ('state', 'not in', ['draft','open','pending'])]}"/>
                                 </div>
                             </group>
                             <group>
index 6cb2cab..1671b6b 100644 (file)
@@ -117,8 +117,22 @@ class document_file(osv.osv):
         # take partner from uid
         if vals.get('res_id', False) and vals.get('res_model', False) and not vals.get('partner_id', False):
             vals['partner_id'] = self.__get_partner_id(cr, uid, vals['res_model'], vals['res_id'], context)
+        if vals.get('datas', False):
+            vals['file_type'], vals['index_content'] = self._index(cr, uid, vals['datas'].decode('base64'), vals.get('datas_fname', False), None)
         return super(document_file, self).create(cr, uid, vals, context)
 
+    def write(self, cr, uid, ids, vals, context=None):
+        if context is None:
+            context = {}
+        if vals.get('datas', False):
+            vals['file_type'], vals['index_content'] = self._index(cr, uid, vals['datas'].decode('base64'), vals.get('datas_fname', False), None)
+        return super(document_file, self).write(cr, uid, ids, vals, context)
+
+    def _index(self, cr, uid, data, datas_fname, file_type):
+        mime, icont = cntIndex.doIndex(data, datas_fname,  file_type or None, None)
+        icont_u = ustr(icont)
+        return mime, icont_u
+
     def __get_partner_id(self, cr, uid, res_model, res_id, context=None):
         """ A helper to retrieve the associated partner from any res_model+id
             It is a hack that will try to discover if the mentioned record is
index 4c2456d..68f294b 100644 (file)
         <field name="inherit_id" ref="base.view_attachment_form"/>
         <field name="arch" type="xml">
             <xpath expr="//field[@name='datas_fname']" position="replace">
-                <field name="datas_fname" invisible="1" on_change="onchange_file(datas_fname)"/>
+                <field name="datas_fname" invisible="1"/>
             </xpath>
             <field name="url" position="after">
                 <field name="user_id"/>
index 54baee5..52b288f 100644 (file)
             <field name="arch" type="xml">
             <xpath expr="//group[@name='active_group']" position="before">
                 <group string="Appraisals">
-                    <field name="evaluation_plan_id" on_change="onchange_evaluation_plan_id(evaluation_plan_id, evaluation_date)"/>
+                    <field name="evaluation_plan_id"/>
                     <field name="evaluation_date"/>
                 </group>
             </xpath>
index 0a693f5..f61ecc8 100644 (file)
@@ -94,9 +94,8 @@ class lunch_order(osv.Model):
         """
         today = datetime.now().isoweekday()
         assert 1 <= today <= 7, "Should be between 1 and 7"
-        mapping = dict((idx, name) for idx, name in enumerate('monday tuestday wednesday thursday friday saturday sunday'.split()))
-        if today in mapping:
-            return mapping[today]
+        mapping = dict((idx, name) for idx, name in enumerate('days monday tuesday wednesday thursday friday saturday sunday'.split()))
+        return alert[mapping[today]]
 
     def can_display_alert(self, alert):
         """ 
index 0edda45..18fdb73 100644 (file)
                             <field name="partner_id" on_change="onchange_partner_id(partner_id, context)" domain="[('customer','=',True)]" context="{'search_default_customer':1, 'show_address': 1}" options='{"always_reload": True}'/>
                             <field name="partner_invoice_id" groups="sale.group_delivery_invoice_address" context="{'default_type':'invoice'}"/>
                             <field name="partner_shipping_id" groups="sale.group_delivery_invoice_address" context="{'default_type':'delivery'}"/>
-                            <field name="project_id" context="{'partner_id':partner_id, 'pricelist_id':pricelist_id, 'default_name':name}" groups="sale.group_analytic_accounting" domain="[('type','in',['view','normal','contract'])]"/>
+                            <field name="project_id" context="{'partner_id':partner_id, 'pricelist_id':pricelist_id, 'default_name':name, 'default_type': 'contract'}" groups="sale.group_analytic_accounting" domain="[('type','in',['view','normal','contract'])]"/>
                         </group>
                         <group>
                             <field name="date_order"/>
                                 <div class="oe_subtotal_footer_separator oe_inline">
                                     <label for="amount_total" />
                                     <button name="button_dummy"
-                                        states="draft" string="(update)" type="object" class="oe_edit_only oe_link"/>
+                                        states="draft,sent" string="(update)" type="object" class="oe_edit_only oe_link"/>
                                 </div>
                                 <field name="amount_total" nolabel="1" class="oe_subtotal_footer_separator" widget='monetary' options="{'currency_field': 'currency_id'}"/>
                             </group>