[Merge] Merge with main server.

bzr revid: mdi@tinyerp.com-20120613092004-q4s7k4hm8zyzfycq
This commit is contained in:
Divyesh Makwana (Open ERP)
2012-06-13 14:50:04 +05:30
4 changed files with 23 additions and 21 deletions
+1
View File
@@ -107,6 +107,7 @@ class view(osv.osv):
for view in self.browse(cr, uid, ids, context):
# RNG-based validation is not possible anymore with 7.0 forms
# TODO 7.0: provide alternative assertion-based validation!
# TODO 7.0: and do the tests on the result of fields_view_get instead of each arch.
view_docs = [etree.fromstring(view.arch.encode('utf8'))]
if view_docs[0].tag == 'data':
# A <data> element is a wrapper for multiple root nodes
+15 -1
View File
@@ -23,8 +23,9 @@ import logging
import re
import urllib
import zipimport
import base64
from openerp import modules, pooler, release, tools
from openerp import modules, pooler, release, tools, addons
from openerp.tools.parse_version import parse_version
from openerp.tools.translate import _
from openerp.osv import fields, osv, orm
@@ -160,6 +161,18 @@ class module(osv.osv):
res[key][k] = "\n".join(sorted(v))
return res
def _get_icon_image(self, cr, uid, ids, field_name=None, arg=None, context=None):
res = dict.fromkeys(ids, '')
for module in self.browse(cr, uid, ids, context=context):
path = addons.get_module_resource(module.name, 'static', 'src', 'img', 'icon.png')
if path:
image_file = tools.file_open(path, 'rb')
try:
res[module.id] = image_file.read().encode('base64')
finally:
image_file.close()
return res
_columns = {
'name': fields.char("Technical Name", size=128, readonly=True, required=True, select=True),
'category_id': fields.many2one('ir.module.category', 'Category', readonly=True, select=True),
@@ -211,6 +224,7 @@ class module(osv.osv):
'certificate' : fields.char('Quality Certificate', size=64, readonly=True),
'application': fields.boolean('Application', readonly=True),
'icon': fields.char('Icon URL', size=128),
'icon_image': fields.function(_get_icon_image, string='Icon', type="binary"),
}
_defaults = {
+6 -8
View File
@@ -122,9 +122,8 @@
<header>
<button name="button_install" states="uninstalled" string="Install" icon="terp-gtk-jump-to-ltr" type="object" class="oe_form_button_hi"/>
<button name="button_upgrade" states="installed" string="Upgrade" icon="terp-gtk-go-back-rtl" type="object" class="oe_form_button_hi"/>
<button name="button_uninstall" states="installed" string="Uninstall (beta)"
icon="terp-dialog-close" type="object"
confirm="Do you confirm the uninstallation of this module? This will permanently erase all data currently stored by the module!"/>
<button name="button_uninstall" states="installed" string="Uninstall (beta)" icon="terp-dialog-close" type="object"
confirm="Do you confirm the uninstallation of this module? This will permanently erase all data currently stored by the module!"/>
<button name="button_uninstall_cancel" states="to remove" string="Cancel Uninstall" icon="gtk-cancel" type="object"/>
<button name="button_upgrade_cancel" states="to upgrade" string="Cancel Upgrade" icon="gtk-cancel" type="object"/>
<button name="button_install_cancel" states="to install" string="Cancel Install" icon="gtk-cancel" type="object"/>
@@ -132,7 +131,7 @@
</header>
<sheet>
<div class="oe_right oe_form_button_box">
<field name="icon" widget='image'/>
<field name="icon_image" widget="image"/>
</div>
<div class="oe_form_title">
<label for="shortdesc" class="oe_form_readonly_hidden"/>
@@ -157,7 +156,6 @@
</page>
<page string="Technical Data">
<group col="4">
<field name="name"/>
<field name="demo"/>
<field name="application"/>
</group>
@@ -169,11 +167,11 @@
</field>
</page>
<page string="Features" attrs="{'invisible':[('state','!=','installed')]}">
<separator string="Created Menus"/>
<label for="menus_by_module" string="Created Menus"/>
<field name="menus_by_module"/>
<separator string="Created Views"/>
<label for="views_by_module" string="Created Views"/>
<field name="views_by_module"/>
<separator string="Defined Reports"/>
<label for="reports_by_module" string="Defined Reports"/>
<field name="reports_by_module"/>
</page>
</notebook>
+1 -12
View File
@@ -88,17 +88,6 @@ class res_company(osv.osv):
return result
def _get_bank_data(self, cr, uid, ids, field_names, arg, context=None):
""" Read the 'address' functional fields. """
result = {}
for company in self.browse(cr, uid, ids, context=context):
r = []
for bank in company.bank_ids:
if bank.footer:
r.append(bank.name_get(context=context)[0][1])
result[company.id] = ' | '.join(r)
return result
def _set_address_data(self, cr, uid, company_id, name, value, arg, context=None):
""" Write the 'address' functional fields. """
company = self.browse(cr, uid, company_id, context=context)
@@ -120,7 +109,7 @@ class res_company(osv.osv):
'partner_id': fields.many2one('res.partner', 'Partner', required=True),
'rml_header1': fields.char('Report Header / Company Slogan', size=200, help="Appears by default on the top right corner of your printed documents."),
'rml_footer1': fields.char('General Information Footer', size=200),
'rml_footer2': fields.function(_get_bank_data, type="char", string='Bank Accounts Footer', size=250, help="This field is computed automatically based on bank accounts defined, having the display on footer checkbox set."),
'rml_footer2': fields.char('Bank Accounts Footer', size=250, help="Write here your bank accounts for customer payments."),
'rml_header': fields.text('RML Header', required=True),
'rml_header2': fields.text('RML Internal Header', required=True),
'rml_header3': fields.text('RML Internal Header', required=True),