Merge with trunk-server

bzr revid: ysa@tinyerp.com-20101230092459-b1xlf2trdw76zn6k
This commit is contained in:
Yogesh Sakhreliya 2010-12-30 14:54:59 +05:30
commit 4862a5f846
36 changed files with 1195 additions and 592 deletions

View File

@ -47,8 +47,8 @@ import logging
logger = netsvc.Logger()
_ad = os.path.abspath(opj(tools.config['root_path'], 'addons')) # default addons path (base)
ad_paths= map(lambda m: os.path.abspath(m.strip()),tools.config['addons_path'].split(','))
_ad = os.path.abspath(opj(tools.ustr(tools.config['root_path']), u'addons')) # default addons path (base)
ad_paths= map(lambda m: os.path.abspath(tools.ustr(m.strip())), tools.config['addons_path'].split(','))
sys.path.insert(1, _ad)
@ -819,12 +819,18 @@ def load_modules(db, force_demo=False, status=None, update_module=False):
report = tools.assertion_report()
# NOTE: Try to also load the modules that have been marked as uninstallable previously...
STATES_TO_LOAD = ['installed', 'to upgrade', 'uninstallable']
if 'base' in tools.config['update']:
cr.execute("update ir_module_module set state=%s where name=%s", ('to upgrade', 'base'))
graph = create_graph(cr, ['base'], force)
if not graph:
logger.notifyChannel('init', netsvc.LOG_CRITICAL, 'module base cannot be loaded! (hint: verify addons-path)')
raise osv.osv.except_osv(_('Could not load base module'), _('module base cannot be loaded! (hint: verify addons-path)'))
has_updates = load_module_graph(cr, graph, status, perform_checks=(not update_module), report=report, skip_cleanup=True)
if tools.config['load_language']:
for lang in tools.config['load_language'].split(','):
tools.load_language(cr, lang)
if update_module:
modobj = pool.get('ir.module.module')
logger.notifyChannel('init', netsvc.LOG_INFO, 'updating modules list')

View File

@ -89,6 +89,7 @@
'test/base_test.yml',
'test/test_context.xml',
'test/bug_lp541545.xml',
'test/test_osv_expression.yml',
],
'installable': True,
'active': True,

View File

@ -1022,7 +1022,6 @@
<!-- Currencies -->
<record id="EUR" model="res.currency">
<field name="name">EUR</field>
<field name="code">EUR</field>
<field name="symbol"></field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1075,7 +1074,6 @@
</record>
<record id="USD" model="res.currency">
<field name="name">USD</field>
<field name="code">USD</field>
<field name="symbol">$</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1089,7 +1087,6 @@
<record id="VEB" model="res.currency">
<field name="name">Bs</field>
<field name="code">VEB</field>
<field name="symbol">Bs</field>
<field name="rounding">2.95</field>
<field name="accuracy">4</field>
@ -1103,7 +1100,6 @@
<record id="CAD" model="res.currency">
<field name="name">CAD</field>
<field name="code">CAD</field>
<field name="symbol">$</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1118,7 +1114,6 @@
<record id="CHF" model="res.currency">
<field name="name">CHF</field>
<field name="code">CHF</field>
<field name="symbol">CHF</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1132,7 +1127,6 @@
<record id="BRL" model="res.currency">
<field name="name">BRL</field>
<field name="code">BRL</field>
<field name="symbol">R$</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1146,7 +1140,6 @@
<record id="CNY" model="res.currency">
<field name="name">CNY</field>
<field name="code">CNY</field>
<field name="symbol">¥</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1161,7 +1154,6 @@
<record id="COP" model="res.currency">
<field name="name">COP</field>
<field name="code">COP</field>
<field name="symbol">$</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1175,7 +1167,6 @@
<record id="CZK" model="res.currency">
<field name="name"></field>
<field name="code">CZK</field>
<field name="symbol"></field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1189,7 +1180,6 @@
<record id="DKK" model="res.currency">
<field name="name">kr</field>
<field name="code">DKK</field>
<field name="symbol">kr</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1204,7 +1194,6 @@
<record id="HUF" model="res.currency">
<field name="name">Ft</field>
<field name="code">HUF</field>
<field name="symbol">Ft</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1218,7 +1207,6 @@
<record id="IDR" model="res.currency">
<field name="name">Rp</field>
<field name="code">IDR</field>
<field name="symbol">Rp</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1237,7 +1225,6 @@
<record id="LVL" model="res.currency">
<field name="name">Ls</field>
<field name="code">LVL</field>
<field name="symbol">Ls</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1252,7 +1239,6 @@
<record id="NOK" model="res.currency">
<field name="name">kr</field>
<field name="code">NOK</field>
<field name="symbol">kr</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1264,10 +1250,21 @@
<field eval="time.strftime('%Y-01-01')" name="name"/>
</record>
<record id="XPF" model="res.currency">
<field name="name">XPF</field>
<field name="symbol">XPF</field>
<field name="rounding">1.00</field>
<field name="accuracy">4</field>
<field name="company_id" ref="main_company"/>
</record>
<record id="rateXPF" model="res.currency.rate">
<field name="rate">119.331742</field>
<field name="currency_id" ref="XPF"/>
<field eval="time.strftime('%Y-01-01')" name="name"/>
</record>
<record id="PAB" model="res.currency">
<field name="name">PAB</field>
<field name="code">PAB</field>
<field name="symbol">B/.</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1281,7 +1278,6 @@
<record id="PLN" model="res.currency">
<field name="name"></field>
<field name="code">PLN</field>
<field name="symbol"></field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1295,7 +1291,6 @@
<record id="SEK" model="res.currency">
<field name="name">kr</field>
<field name="code">SEK</field>
<field name="symbol">kr</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1309,7 +1304,6 @@
<record id="GBP" model="res.currency">
<field name="name">GBP</field>
<field name="code">GBP</field>
<field name="symbol"></field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1323,7 +1317,6 @@
<record id="ARS" model="res.currency">
<field name="name">ARS</field>
<field name="code">ARS</field>
<field name="symbol">$</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1337,7 +1330,6 @@
<record id="INR" model="res.currency">
<field name="name">Rs</field>
<field name="code">INR</field>
<field name="symbol">Rs</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1351,7 +1343,6 @@
<record id="AUD" model="res.currency">
<field name="name">AUD</field>
<field name="code">AUD</field>
<field name="symbol">$</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1365,7 +1356,6 @@
<record id="UAH" model="res.currency">
<field name="name">UAH</field>
<field name="code">UAH</field>
<field name="symbol"></field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1379,7 +1369,6 @@
<record id="VND" model="res.currency">
<field name="name">VND</field>
<field name="code">VND</field>
<field name="symbol"></field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1393,7 +1382,6 @@
<record id="HKD" model="res.currency">
<field name="name">HKD</field>
<field name="code">HKD</field>
<field name="symbol">$</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1407,7 +1395,6 @@
<record id="JPY" model="res.currency">
<field name="name">JPY</field>
<field name="code">JPY</field>
<field name="symbol">¥</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1421,7 +1408,6 @@
<record id="BGN" model="res.currency">
<field name="name">BGN</field>
<field name="code">BGN</field>
<field name="symbol">лв</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1435,7 +1421,6 @@
<record id="EEK" model="res.currency">
<field name="name">EEK</field>
<field name="code">EEK</field>
<field name="symbol">kr</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1449,7 +1434,6 @@
<record id="LTL" model="res.currency">
<field name="name">LTL</field>
<field name="code">LTL</field>
<field name="symbol">Lt</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1463,7 +1447,6 @@
<record id="RON" model="res.currency">
<field name="name">RON</field>
<field name="code">RON</field>
<field name="symbol">kr</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1477,7 +1460,6 @@
<record id="HRK" model="res.currency">
<field name="name">HRK</field>
<field name="code">HRK</field>
<field name="symbol">kn</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1491,7 +1473,6 @@
<record id="RUB" model="res.currency">
<field name="name">RUB</field>
<field name="code">RUB</field>
<field name="symbol">руб</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1505,7 +1486,6 @@
<record id="TRY" model="res.currency">
<field name="name">TRY</field>
<field name="code">TRY</field>
<field name="symbol">TL</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1519,7 +1499,6 @@
<record id="KRW" model="res.currency">
<field name="name">KRW</field>
<field name="code">KRW</field>
<field name="symbol"></field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1533,7 +1512,6 @@
<record id="MXN" model="res.currency">
<field name="name">MXN</field>
<field name="code">MXN</field>
<field name="symbol">$</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1547,7 +1525,6 @@
<record id="MYR" model="res.currency">
<field name="name">MYR</field>
<field name="code">MYR</field>
<field name="symbol">RM</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1561,7 +1538,6 @@
<record id="NZD" model="res.currency">
<field name="name">NZD</field>
<field name="code">NZD</field>
<field name="symbol">$</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1575,7 +1551,6 @@
<record id="PHP" model="res.currency">
<field name="name">PHP</field>
<field name="code">PHP</field>
<field name="symbol">Php</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1589,7 +1564,6 @@
<record id="SGD" model="res.currency">
<field name="name">SGD</field>
<field name="code">SGD</field>
<field name="symbol">$</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1603,7 +1577,6 @@
<record id="THB" model="res.currency">
<field name="name">THB</field>
<field name="code">THB</field>
<field name="symbol">฿</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1617,7 +1590,6 @@
<record id="ZAR" model="res.currency">
<field name="name">ZAR</field>
<field name="code">ZAR</field>
<field name="symbol">R</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
@ -1636,7 +1608,6 @@
<record id="CRC" model="res.currency">
<field name="name">CRC</field>
<field name="code">CRC</field>
<field name="rounding">0.01</field>
<field name="accuracy">4</field>
<field name="symbol">¢</field>

View File

@ -11,7 +11,7 @@
parent="base.menu_administration" sequence="2"
groups="base.group_extended"/>
<menuitem id="next_id_4" name="Low Level Objects"
parent="base.menu_custom" sequence="3"/>
parent="base.menu_custom" sequence="30"/>
<menuitem id="menu_low_workflow" name="Workflows" parent="base.next_id_4"/>
<menuitem id="menu_custom_action" name="Actions" parent="base.menu_custom" groups="base.group_extended" sequence="20"/>
<menuitem id="menu_config" name="Configuration" parent="base.menu_administration" sequence="1"/>

View File

@ -76,13 +76,15 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Change Password">
<field name="current_password" password="True" readonly="0" colspan="4"/>
<field name="new_password" password="True" readonly="0" colspan="4"/>
<field name="confirm_password" password="True" readonly="0" colspan="4"/>
<field name="current_password" password="True" readonly="0" colspan="4"/>
<field name="new_password" password="True" readonly="0" colspan="4"/>
<field name="confirm_password" password="True" readonly="0" colspan="4"/>
<label colspan="1" string=""/>
<label colspan="3" string="You must logout and login again after changing your password."/>
<separator colspan="4" />
<label align="0.0" colspan="2" string=""/>
<button colspan="1" icon="gtk-cancel" special="cancel" string="Cancel"/>
<button colspan="1" icon="gtk-execute" name="change_password" string="Change" type="object"/>
<button colspan="1" icon="gtk-ok" name="change_password" string="Change" type="object"/>
</form>
</field>
</record>
@ -106,7 +108,7 @@
<notebook colspan="4">
<page string="Current Activity">
<field name="company_id" widget="selection" readonly="0"
context="{'user_id': self, 'user_preference': 1}" groups="base.group_multi_company"
groups="base.group_multi_company"
on_change="on_change_company_id(company_id)" />
<field name="view" readonly="0"/>
<label string="" colspan="2"/>
@ -116,8 +118,6 @@
<page string="Preferences">
<field name="context_lang" completion="1" readonly="0"/>
<field name="context_tz" completion="1" readonly="0"/>
<label string="" colspan="1"/>
<label colspan="3" string="You must logout and login again after changing your password."/>
<field name="menu_tips" colspan="2" readonly="0"/>
<label string="" colspan="1"/>
<button name="%(action_view_change_password_form)d" string="Change Password" type="action" icon="gtk-execute"/>
@ -146,7 +146,7 @@
<group colspan="1" col="2">
<separator string="Contact" colspan="2"/>
<field name="company_id" required="1"
context="{'user_id': self, 'user_preference': 1}"
context="{'user_preference': 0}"
groups="base.group_multi_company"
/>
<field name="address_id"/>

File diff suppressed because it is too large Load Diff

View File

@ -937,7 +937,7 @@
<group expand="0" string="Group By...">
<filter string="Owner" icon="terp-personal" domain="[]" context="{'group_by':'create_uid'}"/>
<filter string="Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'type'}" groups="base.group_extended"/>
<filter string="Company" icon="terp-personal" domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Company" icon="terp-gtk-home" domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<separator orientation="vertical"/>
<filter string="Month" help="Creation Month" icon="terp-go-month" domain="[]" context="{'group_by':'create_date'}"/>
</group>
@ -1144,11 +1144,11 @@
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Fields">
<filter icon="terp-camera_test"
<filter icon="terp-gnome-cpu-frequency-applet+"
string="Required"
domain="[('required', '=', True)]"/>
<separator orientation="vertical"/>
<filter icon="terp-stock_align_left_24"
<filter icon="terp-dialog-close"
string="Readonly"
domain="[('readonly', '=', True)]"/>
<separator orientation="vertical"/>
@ -1264,7 +1264,7 @@
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Translations">
<filter icon="terp-document-new"
<filter icon="terp-gdu-smart-failing"
string="Untranslated"
domain="['|',('value', '=', False),('value','=','')]"/>
<separator orientation="vertical"/>

View File

@ -324,14 +324,24 @@ class ir_model_access(osv.osv):
r = cr.fetchone()[0]
if not r and raise_exception:
cr.execute('''select
g.name
from
ir_model_access a
left join ir_model m on (a.model_id=m.id)
left join res_groups g on (a.group_id=g.id)
where
m.model=%s and
a.group_id is not null and perm_''' + mode, (model_name, ))
groups = ', '.join(map(lambda x: x[0], cr.fetchall())) or '/'
msgs = {
'read': _('You can not read this document! (%s)'),
'write': _('You can not write in this document! (%s)'),
'create': _('You can not create this kind of document! (%s)'),
'unlink': _('You can not delete this document! (%s)'),
'read': _("You can not read this document (%s) ! Be sure your user belongs to one of these groups: %s."),
'write': _("You can not write in this document (%s) ! Be sure your user belongs to one of these groups: %s."),
'create': _("You can not create this document (%s) ! Be sure your user belongs to one of these groups: %s."),
'unlink': _("You can not delete this document (%s) ! Be sure your user belongs to one of these groups: %s."),
}
raise except_orm(_('AccessError'), msgs[mode] % model_name )
raise except_orm(_('AccessError'), msgs[mode] % (model_name, groups) )
return r
check = tools.cache()(check)

View File

@ -158,7 +158,7 @@ class ir_translation(osv.osv):
WHERE lang=%s
AND type in %s
AND src=%s"""
params = (lang or '', types, source)
params = (lang or '', types, tools.ustr(source))
if name:
query += " AND name=%s"
params += (tools.ustr(name),)

View File

@ -286,10 +286,10 @@ class ir_ui_menu(osv.osv):
string='Complete Name', type='char', size=128),
'icon': fields.selection(tools.icons, 'Icon', size=64),
'icon_pict': fields.function(_get_icon_pict, method=True, type='char', size=32),
'web_icon': fields.char('Icon File', size=128),
'web_icon_hover':fields.char('Icon Over File', size=128),
'web_icon_data': fields.function(_get_image_icon, string='Web Icons', type='binary', method=True, readonly=True, store=True, multi='icon'),
'web_icon_hover_data':fields.function(_get_image_icon, string='Web Icons Over', type='binary', method=True, readonly=True, store=True,multi='icon'),
'web_icon': fields.char('Web Icon File', size=128),
'web_icon_hover':fields.char('Web Icon File (hover)', size=128),
'web_icon_data': fields.function(_get_image_icon, string='Web Icon Image', type='binary', method=True, readonly=True, store=True, multi='icon'),
'web_icon_hover_data':fields.function(_get_image_icon, string='Web Icon Image (hover)', type='binary', method=True, readonly=True, store=True, multi='icon'),
'action': fields.function(_action, fnct_inv=_action_inv,
method=True, type='reference', string='Action',
selection=[

View File

@ -182,7 +182,7 @@
<field name="action"/>
<newline/>
<group expand="0" string="Group By...">
<filter string="Workflow" icon="terp-stock_align_left_24" domain="[]" context="{'group_by':'wkf_id'}"/>
<filter string="Workflow" icon="terp-stage" domain="[]" context="{'group_by':'wkf_id'}"/>
</group>
</search>
</field>

View File

@ -475,7 +475,7 @@ class module(osv.osv):
categs = categs[1:]
self.write(cr, uid, [mod_browse.id], {'category_id': p_id})
def update_translations(self, cr, uid, ids, filter_lang=None, context=None):
def update_translations(self, cr, uid, ids, filter_lang=None, context={}):
logger = logging.getLogger('i18n')
if not filter_lang:
pool = pooler.get_pool(cr.dbname)
@ -495,15 +495,23 @@ class module(osv.osv):
for lang in filter_lang:
iso_lang = tools.get_iso_codes(lang)
f = addons.get_module_resource(mod.name, 'i18n', iso_lang + '.po')
context2 = context and context.copy() or {}
if f and '_' in iso_lang:
iso_lang2 = iso_lang.split('_')[0]
f2 = addons.get_module_resource(mod.name, 'i18n', iso_lang2 + '.po')
if f2:
logger.info('module %s: loading base translation file %s for language %s', mod.name, iso_lang2, lang)
tools.trans_load(cr.dbname, f2, lang, verbose=False, context=context)
context2['overwrite'] = True
# Implementation notice: we must first search for the full name of
# the language derivative, like "en_UK", and then the generic,
# like "en".
if (not f) and '_' in iso_lang:
f = addons.get_module_resource(mod.name, 'i18n', iso_lang.split('_')[0] + '.po')
iso_lang = iso_lang.split('_')[0]
f = addons.get_module_resource(mod.name, 'i18n', iso_lang + '.po')
if f:
logger.info('module %s: loading translation file for language %s', mod.name, iso_lang)
tools.trans_load(cr.dbname, f, lang, verbose=False, context=context)
logger.info('module %s: loading translation file (%s) for language %s', mod.name, iso_lang, lang)
tools.trans_load(cr.dbname, f, lang, verbose=False, context=context2)
elif iso_lang != 'en':
logger.warning('module %s: no translation for language %s', mod.name, iso_lang)

View File

@ -21,7 +21,7 @@
<field name="name">Start Configuration</field>
<field name="model_id" ref="model_base_module_configuration"/>
<field name="state">code</field>
<field name="code">action = obj.start([])</field>
<field name="code">action = obj.start()</field>
</record>
<menuitem name="Start Configuration"

View File

@ -29,7 +29,7 @@
<filter string="Customer" name="customer" icon="terp-personal" domain="[('is_customer_add','=','1')]" />
<filter string="Supplier" name="supplier" icon="terp-personal" domain="[('is_supplier_add','=','1')]" />
<separator orientation="vertical"/>
<field name="partner_id" />
<field name="partner_id" string="Partner"/>
<field name="name" />
<field name="country_id" />
</group>

View File

@ -20,7 +20,7 @@
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="sms_send" string="Send SMS" type="object" icon="gtk-go-forward"/>
<button name="sms_send" string="Send SMS" type="object" icon="terp-mail-message-new"/>
</group>
</form>
</field>

View File

@ -17,7 +17,7 @@
<separator string="" colspan="6"/>
<group colspan="6" col="4" >
<button special="cancel" string="Cancel" icon="gtk-cancel" />
<button name="mass_mail_send" string="Send Email" type="object" icon="gtk-go-forward"/>
<button name="mass_mail_send" string="Send Email" type="object" icon="terp-mail-message-new"/>
</group>
</form>
</field>

View File

@ -98,13 +98,7 @@ class res_company(osv.osv):
context = {}
user_preference = context.get('user_preference', False)
if user_preference:
# TODO: improve this as soon as the client sends the proper
# combination of active_id and active_model we'll be able to
# use active_id here to restrict to the user being modified instead
# of current user.
user_id = context.get('user_id', uid)
user = self.pool.get('res.users').browse(cr, uid, user_id, context=context)
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
cmp_ids = list(set([user.company_id.id] + [cmp.id for cmp in user.company_ids]))
return cmp_ids
return super(res_company, self)._search(cr, uid, args, offset=offset, limit=limit, order=order,

View File

@ -9,7 +9,7 @@
<field name="priority" eval="8"/>
<field name="arch" type="xml">
<tree string="Multi Company">
<field name="company_id" groups="base.group_multi_company"/>
<field name="company_id"/>
<field name="object_id"/>
<field name="field_id"/>
<field name="expression" />
@ -29,7 +29,7 @@
<group col="6" colspan="4">
<field name="name" colspan="6"/>
<separator string="Matching" colspan="6"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="company_id"/>
<field name="object_id"/>
<field name="field_id" domain="[('model_id','=',object_id)]"/>
<separator string="Condition" colspan="6"/>

View File

@ -13,7 +13,7 @@
<label align="0.0" string="description" width="200" colspan="2"/>
</group>
<separator string="vsep" orientation="vertical" colspan="1" rowspan="12"/>
<group colspan="4">
<group colspan="6">
<separator string="title" colspan="4"/>
<group string="res_config_contents"/>
</group>
@ -61,13 +61,13 @@
<field name="arch" type="xml">
<form>
<group colspan="4" col="8">
<group colspan="3" width="220" height="250">
<group colspan="1" width="220" height="250">
<field name="config_logo" widget="image" width="220" height="130" nolabel="1" colspan="1"/>
<newline/>
<label align="0.0" string="description" width="200" colspan="2"/>
</group>
<separator string="vsep" orientation="vertical" colspan="1" rowspan="12"/>
<group colspan="4">
<group colspan="6">
<separator string="title" colspan="4"/>
<group colspan="8"/>
</group>

View File

@ -7,12 +7,12 @@
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Logs">
<filter icon="terp-stock_align_left_24" string="Read" domain="[('read','=',True)]" name="read"/>
<filter icon="terp-stock_align_left_24" string="Unread" domain="[('read','&lt;&gt;',True)]" name="unread"/>
<filter icon="terp-camera_test" string="Read" domain="[('read','=',True)]" name="read"/>
<filter icon="terp-gtk-jump-to-ltr" string="Unread" domain="[('read','&lt;&gt;',True)]" name="unread"/>
<separator orientation="vertical"/>
<filter icon="terp-stock_align_left_24" string="My Logs" domain="[('user_id','=',uid)]" name="my"/>
<filter icon="terp-personal" string="My Logs" domain="[('user_id','=',uid)]" name="my"/>
<filter icon="terp-stock_align_left_24" string="System Logs"
domain="[('res_model','=','publisher_warranty.contract')]" name="sys"/>
domain="[('res_model','=','publisher_warranty.contract')]" name="sys"/>
<separator orientation="vertical"/>
<field name="name"/>
<field name="user_id"/>

View File

@ -578,8 +578,8 @@ class change_user_password(osv.osv_memory):
_name = 'change.user.password'
_columns = {
'current_password':fields.char('Current Password', size=64, required=True, help="Enter your current password."),
'new_password': fields.char('New Password', size=64, required=True, help="Enter new password."),
'confirm_password': fields.char('Confirm Password', size=64, required=True, help="Enter new password again for confirmation."),
'new_password': fields.char('New Password', size=64, required=True, help="Enter the new password."),
'confirm_password': fields.char('Confirm Password', size=64, required=True, help="Enter the new password again for confirmation."),
}
_defaults={
'current_password' : '',
@ -588,16 +588,22 @@ class change_user_password(osv.osv_memory):
}
def change_password(self, cr, uid, ids, context=None):
user_obj = self.pool.get('res.users')
if ids:
current_password = user_obj.browse(cr, uid, uid, context).password
password_rec = self.browse(cr, uid, ids[0], context)
for form_id in ids:
password_rec = self.browse(cr, uid, form_id, context)
if password_rec.new_password != password_rec.confirm_password:
raise osv.except_osv(_('Warning !'), _('New password and confirm password does not match !'))
elif current_password != password_rec.current_password:
raise osv.except_osv(_('Warning !'), _('Current password does not match !'))
else:
user_obj.write(cr, uid, [uid], {'password': password_rec.new_password}, context)
raise osv.except_osv(_('Error !'), _('The new and confirmation passwords do not match, please double-check them.'))
# Validate current password without reading it from database,
# as it could be stored differently (LDAP, encrypted/hashed, etc.)
is_correct_password = False
try:
user_obj = self.pool.get('res.users')
is_correct_password = user_obj.check(cr.dbname, uid, password_rec.current_password)
except Exception:
pass
if not is_correct_password:
raise osv.except_osv(_('Error !'), _('The current password does not match, please double-check it.'))
user_obj.write(cr, uid, [uid], {'password': password_rec.new_password}, context=context)
return {}
change_user_password()

View File

@ -43,4 +43,71 @@
-
Filtering on invalid value across x2many relationship should return an empty set
-
!assert {model: res.partner, search: "[('address.city','=','foo')]", count: 0, string: "Searching for address.city = foo should give empty results"}
!assert {model: res.partner, search: "[('address.city','=','foo')]", count: 0, string: "Searching for address.city = foo should give empty results"}
-
Check if many2one works with empty search list
-
!assert {model: res.partner, search: "[('company_id','in', [])]", count: 0, string: "Searching for company_id in [] should be empty!" }
-
For the sake of the following tests, I will create a second company
-
!record {model: res.company, id: ymltest_company2}:
name: Acme 2
-
And create a few partners with that company or no company
-
!python {model: res.partner }: |
for r in range(4):
self.create(cr, uid, { 'name': 'P of Acme %d' % r,
'company_id': ref('ymltest_company2') })
for r in range(4):
self.create(cr, uid, { 'name': 'P of All %d' % r,
'company_id': False })
-
Check if many2one works with negative empty list
-
!python {model: res.partner }: |
all_ids = self.search(cr, uid, [])
all_ids.sort()
res_ids = self.search(cr, uid,['|',('company_id','not in', []), ('company_id','=',False)])
res_ids.sort()
assert all_ids == res_ids, "not in [] fails"
-
Check that many2one will pick the correct records with a list
-
!python {model: res.partner }: |
res_ids = self.search(cr, uid, [('company_id', 'in', [False,])])
assert len(res_ids) >= 4, "We created 4 partners w/company, why find %d? %r" % \
(len(res_ids), res_ids)
-
Check that many2one will exclude the correct records with a list
-
!python {model: res.partner }: |
# assuming that the default company is #1
res_ids = self.search(cr, uid, [('company_id', 'not in', [1])])
assert len(res_ids) >= 4, "We should have found 4 records at least, only have %d! %r" % \
(len(res_ids), res_ids)
-
Check that we exclude the correct records, + False
-
!python {model: res.partner }: |
# assuming that the default company is #1
res_ids = self.search(cr, uid, ['|', ('company_id', 'not in', [1]), ('company_id', '=', False)])
assert len(res_ids) >= 8, "We should have found 8 records at least, only have %d! %r" % \
(len(res_ids), res_ids)
-
Check that multi-level expressions also work
-
!python {model: res.partner }: |
res_ids = self.search(cr, uid, [('company_id.partner_id', 'in', [])])
assert res_ids == [], "Searching an empty set should return empty result, not %r" % res_ids
-
Check that multi-level expressions with negative op work
-
!python {model: res.partner }: |
all_ids = self.search(cr, uid, [('company_id', '!=', False)])
all_ids.sort()
res_ids = self.search(cr, uid, [('company_id.partner_id', 'not in', [])])
res_ids.sort()
assert res_ids == all_ids, "Searching against empty set failed, returns %r" % res_ids

View File

@ -119,13 +119,17 @@ if not ( tools.config["stop_after_init"] or \
if tools.config['db_name']:
for dbname in tools.config['db_name'].split(','):
db,pool = pooler.get_db_and_pool(dbname, update_module=tools.config['init'] or tools.config['update'], pooljobs=False)
cr = db.cursor()
if tools.config["test_file"]:
logger.info('loading test file %s', tools.config["test_file"])
cr = db.cursor()
tools.convert_yaml_import(cr, 'base', file(tools.config["test_file"]), {}, 'test', True)
cr.rollback()
pool.get('ir.cron')._poolJobs(db.dbname)
cr.close()
#----------------------------------------------------------
# translation stuff
#----------------------------------------------------------
@ -147,9 +151,11 @@ if tools.config["translate_out"]:
sys.exit(0)
if tools.config["translate_in"]:
context = {'overwrite': tools.config["overwrite_existing_translations"]}
tools.trans_load(tools.config["db_name"],
tools.config["translate_in"],
tools.config["language"])
tools.config["language"],
context=context)
sys.exit(0)
#----------------------------------------------------------------------------------

View File

@ -143,13 +143,19 @@ class expression(object):
if len(fargs) > 1:
if field._type == 'many2one':
right = field_obj.search(cr, uid, [(fargs[1], operator, right)], context=context)
self.__exp[i] = (fargs[0], 'in', right)
if right == []:
self.__exp[i] = ( 'id', '=', 0 )
else:
self.__exp[i] = (fargs[0], 'in', right)
# Making search easier when there is a left operand as field.o2m or field.m2m
if field._type in ['many2many','one2many']:
right = field_obj.search(cr, uid, [(fargs[1], operator, right)], context=context)
right1 = table.search(cr, uid, [(fargs[0],'in', right)], context=context)
self.__exp[i] = ('id', 'in', right1)
if right1 == []:
self.__exp[i] = ( 'id', '=', 0 )
else:
self.__exp[i] = ('id', 'in', right1)
if not isinstance(field,fields.property):
continue
@ -313,6 +319,13 @@ class expression(object):
if not isinstance(ele, basestring):
m2o_str = False
break
elif right == []:
m2o_str = False
if operator in ('not in', '!=', '<>'):
# (many2one not in []) should return all records
self.__exp[i] = self.__DUMMY_LEAF
else:
self.__exp[i] = ('id','=',0)
else:
new_op = '='
if operator in ['not like','not ilike','not in','<>','!=']:

View File

@ -59,8 +59,10 @@ from query import Query
import tools
from tools.safe_eval import safe_eval as eval
regex_order = re.compile('^(([a-z0-9_]+|"[a-z0-9_]+")( *desc| *asc)?( *, *|))+$', re.I)
# List of etree._Element subclasses that we choose to ignore when parsing XML.
from tools import SKIPPED_ELEMENT_TYPES
regex_order = re.compile('^(([a-z0-9_]+|"[a-z0-9_]+")( *desc| *asc)?( *, *|))+$', re.I)
POSTGRES_CONFDELTYPES = {
'RESTRICT': 'r',
@ -70,10 +72,6 @@ POSTGRES_CONFDELTYPES = {
'SET DEFAULT': 'd',
}
# List of etree._Element subclasses that we choose to ignore when parsing view architecture.
# We include the *Base ones just in case, currently they seem to be subclasses of the _* ones.
SKIPPED_ELEMENT_TYPES = (etree._Comment, etree._ProcessingInstruction, etree.CommentBase, etree.PIBase)
def last_day_of_current_month():
today = datetime.date.today()
last_day = str(calendar.monthrange(today.year, today.month)[1])
@ -518,8 +516,7 @@ class orm_template(object):
self._table = self._name.replace('.', '_')
def browse(self, cr, uid, select, context=None, list_class=None, fields_process=None):
"""
Fetch records as objects allowing to use dot notation to browse fields and relations
"""Fetch records as objects allowing to use dot notation to browse fields and relations
:param cr: database cursor
:param user: current user id
@ -687,8 +684,10 @@ class orm_template(object):
:param filename: optional file to store partial import state for recovery
:rtype: tuple
This method is used when importing data via client menu
Example of fields to import for a sale.order
This method is used when importing data via client menu.
Example of fields to import for a sale.order::
.id, (=database_id)
partner_id, (=name_search)
order_line/.id, (=database_id)
@ -3907,7 +3906,9 @@ class orm(orm_template):
order_field = order_split[0].strip()
order_direction = order_split[1].strip() if len(order_split) == 2 else ''
inner_clause = None
if order_field in self._columns:
if order_field == 'id':
order_by_clause = '"%s"."%s"' % (self._table, order_field)
elif order_field in self._columns:
order_column = self._columns[order_field]
if order_column._classic_read:
inner_clause = '"%s"."%s"' % (self._table, order_field)

View File

@ -16,7 +16,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/>.
#
##############################################################################
@ -34,7 +34,7 @@ the reportlab engine.
This file could be customized per distro (although most Linux/Unix ones)
should have the same filenames, only need the code below).
Due to an awful configuration that ships with reportlab at many Linux
Due to an awful configuration that ships with reportlab at many Linux
and Ubuntu distros, we have to override the search path, too.
"""
@ -56,26 +56,26 @@ CustomTTFonts = [ ('Helvetica',"DejaVu Sans", "DejaVuSans.ttf", 'normal'),
('Courier',"FreeMono BoldOblique", "FreeMonoBoldOblique.ttf", 'bolditalic'),]
TTFSearchPath_Linux = (
TTFSearchPath_Linux = [
'/usr/share/fonts/truetype', # SuSE
'/usr/share/fonts/dejavu', '/usr/share/fonts/liberation', # Fedora, RHEL
'/usr/share/fonts/truetype/*', # Ubuntu,
'/usr/share/fonts/TTF/*', # at Mandriva/Mageia
)
]
TTFSearchPath_Windows = (
TTFSearchPath_Windows = [
'c:/winnt/fonts',
'c:/windows/fonts'
)
]
TTFSearchPath_Darwin = (
TTFSearchPath_Darwin = [
#mac os X - from
#http://developer.apple.com/technotes/tn/tn2024.html
'~/Library/Fonts',
'/Library/Fonts',
'/Network/Library/Fonts',
'/System/Library/Fonts',
)
]
TTFSearchPathMap = {
'Darwin': TTFSearchPath_Darwin,
@ -89,7 +89,7 @@ __foundFonts = None
def FindCustomFonts():
"""Fill the __foundFonts list with those filenames, whose fonts
can be found in the reportlab ttf font path.
This process needs only be done once per loading of this module,
it is cached. But, if the system admin adds some font in the
meanwhile, the server must be restarted eventually.
@ -131,7 +131,7 @@ def FindCustomFonts():
def SetCustomFonts(rmldoc):
""" Map some font names to the corresponding TTF fonts
The ttf font may not even have the same name, as in
Times -> Liberation Serif.
This function is called once per report, so it should

View File

@ -65,7 +65,7 @@ def _open_image(filename, path=None):
except IOError:
pass
raise IOError("File %s cannot be found in image path" % filename)
class NumberedCanvas(canvas.Canvas):
def __init__(self, *args, **kwargs):
canvas.Canvas.__init__(self, *args, **kwargs)
@ -243,7 +243,8 @@ class _rml_doc(object):
for font in node.findall('registerFont'):
name = font.get('fontName').encode('ascii')
fname = font.get('fontFile').encode('ascii')
pdfmetrics.registerFont(TTFont(name, fname ))
if name not in pdfmetrics._fonts:
pdfmetrics.registerFont(TTFont(name, fname))
addMapping(name, 0, 0, name) #normal
addMapping(name, 0, 1, name) #italic
addMapping(name, 1, 0, name) #bold
@ -254,7 +255,8 @@ class _rml_doc(object):
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
pdfmetrics.registerFont(TTFont(fontname, filename ))
if fontname not in pdfmetrics._fonts:
pdfmetrics.registerFont(TTFont(fontname, filename))
if (mode == 'all'):
addMapping(face, 0, 0, fontname) #normal
addMapping(face, 0, 1, fontname) #italic
@ -899,7 +901,7 @@ class _rml_template(object):
ps = map(lambda x:x.strip(), node.get('pageSize').replace(')', '').replace('(', '').split(','))
pageSize = ( utils.unit_get(ps[0]),utils.unit_get(ps[1]) )
self.doc_tmpl = TinyDocTemplate(out, pagesize=pageSize, **utils.attr_get(node, ['leftMargin','rightMargin','topMargin','bottomMargin'], {'allowSplitting':'int','showBoundary':'bool','title':'str','author':'str'}))
self.doc_tmpl = TinyDocTemplate(out, pagesize=pageSize, **utils.attr_get(node, ['leftMargin','rightMargin','topMargin','bottomMargin'], {'allowSplitting':'int','showBoundary':'bool','rotation':'int','title':'str','author':'str'}))
self.page_templates = []
self.styles = doc.styles
self.doc = doc

View File

@ -58,6 +58,8 @@ class configmanager(object):
'xmlrpcs': True,
'translate_in': None,
'translate_out': None,
'overwrite_existing_translations': False,
'load_language': None,
'language': None,
'pg_path': None,
'admin_passwd': 'admin',
@ -94,7 +96,7 @@ class configmanager(object):
'publisher_warranty_url': 'http://services.openerp.com/publisher-warranty/',
}
self.blacklist_for_save = set(["publisher_warranty_url"])
self.blacklist_for_save = set(["publisher_warranty_url", "load_language"])
self.misc = {}
self.config_file = fname
@ -209,12 +211,16 @@ class configmanager(object):
"Option '-l' is mandatory in case of importation"
)
group.add_option('--load-language', dest="load_language",
help="specifies the languages for the translations you want to be loaded")
group.add_option('-l', "--language", dest="language",
help="specify the language of the translation file. Use it with --i18n-export or --i18n-import")
group.add_option("--i18n-export", dest="translate_out",
help="export all sentences to be translated to a CSV file, a PO file or a TGZ archive and exit")
group.add_option("--i18n-import", dest="translate_in",
help="import a CSV or a PO file with translations and exit. The '-l' option is required.")
group.add_option("--i18n-overwrite", dest="overwrite_existing_translations", action="store_true", default=False,
help="overwrites existing translation terms on importing a CSV or a PO file.")
group.add_option("--modules", dest="translate_modules",
help="specify modules to export. Use in combination with --i18n-export")
group.add_option("--addons-path", dest="addons_path",
@ -240,6 +246,9 @@ class configmanager(object):
die(opt.translate_in and (not opt.language or not opt.db_name),
"the i18n-import option cannot be used without the language (-l) and the database (-d) options")
die(opt.overwrite_existing_translations and (not opt.translate_in),
"the i18n-overwrite option cannot be used without the i18n-import option")
die(opt.translate_out and (not opt.db_name),
"the i18n-export option cannot be used without the database (-d) option")
@ -285,7 +294,8 @@ class configmanager(object):
self.options[arg] = getattr(opt, arg)
keys = [
'language', 'translate_out', 'translate_in', 'debug_mode', 'smtp_ssl',
'language', 'translate_out', 'translate_in', 'overwrite_existing_translations',
'debug_mode', 'smtp_ssl', 'load_language',
'stop_after_init', 'logrotate', 'without_demo', 'netrpc', 'xmlrpc', 'syslog',
'list_db', 'xmlrpcs',
'test_file', 'test_disable', 'test_commit', 'test_report_directory'
@ -443,7 +453,7 @@ class configmanager(object):
loglevelnames = dict(zip(self._LOGLEVELS.values(), self._LOGLEVELS.keys()))
p.add_section('options')
for opt in sorted(self.options.keys()):
if opt in ('version', 'language', 'translate_out', 'translate_in', 'init', 'update'):
if opt in ('version', 'language', 'translate_out', 'translate_in', 'overwrite_existing_translations', 'init', 'update'):
continue
if opt in self.blacklist_for_save:
continue

View File

@ -45,10 +45,12 @@ import netsvc
import osv
import pooler
from config import config
from osv.orm import except_orm, SKIPPED_ELEMENT_TYPES
from tools.translate import _
from yaml_import import convert_yaml_import
# List of etree._Element subclasses that we choose to ignore when parsing XML.
from tools import SKIPPED_ELEMENT_TYPES
# Import of XML records requires the unsafe eval as well,
# almost everywhere, which is ok because it supposedly comes
# from trusted data, but at least we make it obvious now.
@ -865,7 +867,7 @@ form: module.record_id""" % (xml_id,)
self.__logger.error('Parse error in %s:%d: \n%s',
rec.getroottree().docinfo.URL,
rec.sourceline,
etree.tostring(rec).strip())
etree.tostring(rec).strip(), exc_info=True)
self.cr.rollback()
raise
return True
@ -945,7 +947,7 @@ def convert_csv_import(cr, module, fname, csvcontent, idref=None, mode='init',
result, rows, warning_msg, dummy = pool.get(model).import_data(cr, uid, fields, datas,mode, module, noupdate, filename=fname_partial)
if result < 0:
# Report failed import and abort module install
raise except_orm(_('Module loading failed'), _('Loading %s/%s failed:\n %s') % (module, fname, warning_msg))
raise Exception(_('Module loading failed: file %s/%s could not be processed:\n %s') % (module, fname, warning_msg))
if config.get('import_partial'):
data = pickle.load(file(config.get('import_partial')))
data[fname_partial] = 0

View File

@ -44,6 +44,7 @@ from email.Header import Header
from email.Utils import formatdate, COMMASPACE
from email import Encoders
from itertools import islice, izip
from lxml import etree
from which import which
if sys.version_info[:2] < (2, 4):
from threadinglocal import local
@ -60,6 +61,10 @@ from lru import LRU
_logger = logging.getLogger('tools')
# List of etree._Element subclasses that we choose to ignore when parsing XML.
# We include the *Base ones just in case, currently they seem to be subclasses of the _* ones.
SKIPPED_ELEMENT_TYPES = (etree._Comment, etree._ProcessingInstruction, etree.CommentBase, etree.PIBase)
# initialize a database with base/base.sql
def init_db(cr):
import addons
@ -257,7 +262,7 @@ def file_open(name, mode="r", subdir='addons', pathinfo=False):
return fo
if os.path.splitext(name)[1] == '.rml':
raise IOError, 'Report %s doesn\'t exist or deleted : ' %str(name)
raise IOError, 'File not found : '+str(name)
raise IOError, 'File not found : %s' % name
#----------------------------------------------------------

View File

@ -33,14 +33,14 @@ import tarfile
import tempfile
import threading
from os.path import join
import logging
from datetime import datetime
from lxml import etree
import tools, pooler
import tools
import netsvc
from tools.misc import UpdateableStr
from tools.misc import SKIPPED_ELEMENT_TYPES
_LOCALE2WIN32 = {
'af_ZA': 'Afrikaans_South Africa',
@ -159,7 +159,7 @@ class GettextAlias(object):
# find current DB based on thread/worker db name (see netsvc)
db_name = getattr(threading.currentThread(), 'dbname', None)
if db_name:
return pooler.get_db_only(dbname)
return pooler.get_db_only(db_name)
def _get_cr(self, frame):
is_new_cr = False
@ -219,6 +219,7 @@ class GettextAlias(object):
logger.debug('no translation language detected, skipping translation for "%r" ', source)
except Exception:
logger.debug('translation went wrong for "%r", skipped', source)
# if so, double-check the root/base translations filenames
finally:
if cr and is_new_cr:
cr.close()
@ -468,12 +469,13 @@ def trans_export(lang, modules, buffer, format, dbname=None):
_process(format, modules, trans, buffer, lang, newlang)
del trans
def trans_parse_xsl(de):
res = []
for n in de:
if n.get("t"):
for m in [j for j in n if j.text]:
for m in n:
if isinstance(m, SKIPPED_ELEMENT_TYPES) or not m.text:
continue
l = m.text.strip().replace('\n',' ')
if len(l):
res.append(l.encode("utf8"))
@ -483,7 +485,9 @@ def trans_parse_xsl(de):
def trans_parse_rml(de):
res = []
for n in de:
for m in [j for j in n if j.text]:
for m in n:
if isinstance(m, SKIPPED_ELEMENT_TYPES) or not m.text:
continue
string_list = [s.replace('\n', ' ').strip() for s in re.split('\[\[.+?\]\]', m.text)]
for s in string_list:
if s:
@ -749,6 +753,10 @@ def trans_generate(lang, modules, dbname=None):
else :
path_list = [root_path,] + apaths
# Also scan these non-addon paths
for bin_path in ['osv', 'report' ]:
path_list.append(os.path.join(tools.config['root_path'], bin_path))
logger.debug("Scanning modules at paths: ", path_list)
mod_paths = []
@ -768,6 +776,8 @@ def trans_generate(lang, modules, dbname=None):
if module in installed_modules:
frelativepath = str("addons" + frelativepath)
ite = re_dquotes.finditer(code_string)
code_offset = 0
code_line = 1
for i in ite:
src = i.group(1)
if src.startswith('""'):
@ -775,11 +785,18 @@ def trans_generate(lang, modules, dbname=None):
src = src[2:-2]
else:
src = join_dquotes.sub(r'\1', src)
# try to count the lines from the last pos to our place:
code_line += code_string[code_offset:i.start(1)].count('\n')
# now, since we did a binary read of a python source file, we
# have to expand pythonic escapes like the interpreter does.
src = src.decode('string_escape')
push_translation(module, terms_type, frelativepath, 0, encode(src))
push_translation(module, terms_type, frelativepath, code_line, encode(src))
code_line += i.group(1).count('\n')
code_offset = i.end() # we have counted newlines up to the match end
ite = re_quotes.finditer(code_string)
code_offset = 0 #reset counters
code_line = 1
for i in ite:
src = i.group(1)
if src.startswith("''"):
@ -787,8 +804,11 @@ def trans_generate(lang, modules, dbname=None):
src = src[2:-2]
else:
src = join_quotes.sub(r'\1', src)
code_line += code_string[code_offset:i.start(1)].count('\n')
src = src.decode('string_escape')
push_translation(module, terms_type, frelativepath, 0, encode(src))
push_translation(module, terms_type, frelativepath, code_line, encode(src))
code_line += i.group(1).count('\n')
code_offset = i.end() # we have counted newlines up to the match end
for path in path_list:
logger.debug("Scanning files of modules at %s", path)
@ -900,7 +920,7 @@ def trans_load_data(db_name, fileobj, fileformat, lang, lang_name=None, verbose=
args.append(('res_id', '=', dic['res_id']))
ids = trans_obj.search(cr, uid, args)
if ids:
if context.get('overwrite'):
if context.get('overwrite') and dic['value']:
trans_obj.write(cr, uid, ids, {'value': dic['value']})
else:
trans_obj.create(cr, uid, dic)
@ -952,5 +972,18 @@ def resetlocale():
except locale.Error:
continue
def load_language(cr, lang):
"""Loads a translation terms for a language.
Used mainly to automate language loading at db initialization.
:param lang: language ISO code with optional _underscore_ and l10n flavor (ex: 'fr', 'fr_BE', but not 'fr-BE')
:type lang: str
"""
pool = pooler.get_pool(cr.dbname)
language_installer = pool.get('base.language.install')
uid = 1
oid = language_installer.create(cr, uid, {'lang': lang})
language_installer.lang_install(cr, uid, [oid], context=None)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

665
setup.nsi
View File

@ -1,266 +1,399 @@
##############################################################################
#
# Copyright (c) 2004-2008 Tiny SPRL (http://tiny.be) All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
###############################################################################
!ifndef VERSION
!error "Do not forget to specify the version of OpenERP - /DVERSION=<VERSION>"
!endif
!include "MUI.nsh"
;--------------------------------
;General
;Name and file
Name "OpenERP Server"
OutFile "openerp-server-setup-${VERSION}.exe"
SetCompressor lzma
SetCompress auto
;Default installation folder
InstallDir "$PROGRAMFILES\OpenERP Server"
;Get installation folder from registry if available
InstallDirRegKey HKLM "Software\OpenERP Server" ""
BrandingText "OpenERP Server ${VERSION}"
;Vista redirects $SMPROGRAMS to all users without this
RequestExecutionLevel admin
;--------------------------------
;Variables
Var MUI_TEMP
Var STARTMENU_FOLDER
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
!define REGKEY "SOFTWARE\$(^Name)"
!define MUI_LANGDLL_REGISTRY_ROOT HKLM
!define MUI_LANGDLL_REGISTRY_KEY ${REGKEY}
!define MUI_LANGDLL_REGISTRY_VALUENAME InstallerLanguage
!insertmacro MUI_RESERVEFILE_LANGDLL
;--------------------------------
;Pages
!define MUI_ICON ".\pixmaps\openerp-icon.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP ".\pixmaps\openerp-intro.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP ".\pixmaps\openerp-intro.bmp"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
!define MUI_HEADER_TRANSPARENT_TEXT ""
!define MUI_HEADERIMAGE_BITMAP ".\pixmaps\openerp-slogan.bmp"
!define MUI_LICENSEPAGE_TEXT_BOTTOM "$(LicenseText)"
!define MUI_LICENSEPAGE_BUTTON "$(LicenseNext)"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "doc\License.rtf"
!insertmacro MUI_PAGE_DIRECTORY
;Start Menu Folder Page Configuration
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\OpenERP Server"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "OpenERP Server"
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_CHECKED
!define MUI_FINISHPAGE_RUN_TEXT "$(FinishPageText)"
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
!define MUI_FINISHPAGE_SHOWREADME $INSTDIR\README.txt
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "French"
!macro CreateInternetShortcut FILENAME URL
WriteINIStr "${FILENAME}.url" "InternetShortcut" "URL" "${URL}"
!macroend
;--------------------------------
;Installer Sections
Function .onInit
!ifndef ALLINONE
;Language selection dialog
Push ""
Push ${LANG_ENGLISH}
Push English
Push ${LANG_FRENCH}
Push French
Push A ; A means auto count languages
; for the auto count to work the first empty push (Push "") must remain
LangDLL::LangDialog "Installer Language" "Please select the language of the installer"
Pop $LANGUAGE
StrCmp $LANGUAGE "cancel" 0 +2
Abort
!endif
ClearErrors
ReadRegStr $0 HKLM "Software\OpenERP Server" ""
IfErrors DoInstall 0
MessageBox MB_OK "$(CannotInstallServerText)"
Quit
DoInstall:
FunctionEnd
Section "OpenERP Server" SecOpenERPServer
nsExec::Exec "net stop openerp-service"
sleep 2
SetOutPath "$INSTDIR"
;ADD YOUR OWN FILES HERE...
File /r "dist\*"
SetOutPath "$INSTDIR\service"
File /r "win32\dist\*"
File "win32\start.bat"
File "win32\stop.bat"
;Store installation folder
WriteRegStr HKLM "Software\OpenERP Server" "" $INSTDIR
!ifndef ALLINONE
;Create uninstaller
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenERP Server" "DisplayName" "OpenERP Server ${VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenERP Server" "UninstallString" "$INSTDIR\Uninstall.exe"
!else
WriteRegStr HKLM "Software\OpenERP AllInOne" "UninstallServer" "$INSTDIR\Uninstall.exe"
!endif
WriteUninstaller "$INSTDIR\Uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
;Create shortcuts
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\OpenERP Server.lnk" "$INSTDIR\openerp-server.exe"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Start service.lnk" "$INSTDIR\service\start.bat"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Stop service.lnk" "$INSTDIR\service\stop.bat"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Edit config.lnk" "notepad.exe" "$INSTDIR\openerp-server.conf"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\View log.lnk" "notepad.exe" "$INSTDIR\openerp-server.log"
!ifndef ALLINONE
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\uninstall.exe"
!endif
!insertmacro CreateInternetShortcut "$SMPROGRAMS\$STARTMENU_FOLDER\Forum" "http://www.openerp.com/forum"
!insertmacro CreateInternetShortcut "$SMPROGRAMS\$STARTMENU_FOLDER\Translation" "https://translations.launchpad.net/openobject"
!insertmacro MUI_STARTMENU_WRITE_END
nsExec::Exec '"$INSTDIR\openerp-server.exe" --stop-after-init --logfile "$INSTDIR\openerp-server.log" -s'
nsExec::Exec '"$INSTDIR\service\OpenERPServerService.exe" -auto -install'
SectionEnd
;Descriptions
;--------------------------------
;Uninstaller Section
Section "Uninstall"
nsExec::Exec "net stop openerp-service"
sleep 2
nsExec::Exec '"$INSTDIR\service\OpenERPServerService.exe" -remove'
sleep 2
RMDIR /r "$INSTDIR"
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
Delete "$SMPROGRAMS\$MUI_TEMP\Forum.url"
Delete "$SMPROGRAMS\$MUI_TEMP\Translation.url"
!ifndef ALLINONE
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
!endif
Delete "$SMPROGRAMS\$MUI_TEMP\OpenERP Server.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\Start service.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\Stop service.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\Edit config.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\View log.lnk"
;Delete empty start menu parent diretories
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
startMenuDeleteLoop:
ClearErrors
RMDir $MUI_TEMP
GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
IfErrors startMenuDeleteLoopDone
StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
startMenuDeleteLoopDone:
!ifndef ALLINONE
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\OpenERP Server"
!else
DeleteRegKey HKLM "Software\OpenERP AllInOne\UninstallServer"
!endif
DeleteRegKey /ifempty HKLM "Software\OpenERP Server"
SectionEnd
Function LaunchLink
nsExec::Exec "net start openerp-service"
FunctionEnd
LangString LicenseText ${LANG_ENGLISH} "Usually, a proprietary license is provided with the software: limited number of users, limited in time usage, etc. This Open Source license is the opposite: it garantees you the right to use, copy, study, distribute and modify Open ERP for free."
LangString LicenseText ${LANG_FRENCH} "Normalement, une licence propriétaire est fournie avec le logiciel: limitation du nombre d'utilisateurs, limitation dans le temps, etc. Cette licence Open Source est l'opposé: Elle vous garantie le droit d'utiliser, de copier, d'étudier, de distribuer et de modifier Open ERP librement."
LangString LicenseNext ${LANG_ENGLISH} "Next >"
LangString LicenseNext ${LANG_FRENCH} "Suivant >"
LangString FinishPageText ${LANG_ENGLISH} "Start OpenERP Server"
LangString FinishPageText ${LANG_FRENCH} "Lancer le serveur OpenERP"
;Language strings
LangString DESC_SecOpenERPServer ${LANG_ENGLISH} "OpenERP Server."
LangString DESC_SecOpenERPServer ${LANG_FRENCH} "Serveur OpenERP."
LangString CannotInstallServerText ${LANG_ENGLISH} "Can not install the Open ERP Server because a previous installation already exists on this system. Please uninstall your current installation and relaunch this setup wizard."
LangString CannotInstallServerText ${LANG_FRENCH} "Ne peut pas installer le serveur Open ERP parce qu'une installation existe déjà  sur ce système. S'il vous plait, désinstallez votre installation actuelle et relancer l'installeur."
;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecOpenERPServer} $(DESC_SecOpenERPServer)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
#####################################################################################
#
# Copyright (c) 2004-TODAY OpenERP S.A. (http://www.openerp.com) All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#####################################################################################
!include 'MUI2.nsh'
!include 'FileFunc.nsh'
!include 'LogicLib.nsh'
!include 'Sections.nsh'
!define PUBLISHER 'OpenERP S.A.'
!ifndef MAJOR_VERSION
!define MAJOR_VERSION '6'
!endif
!ifndef MINOR_VERSION
!define MINOR_VERSION '0'
!endif
!ifndef REVISION_VERSION
!define REVISION_VERSION '0'
!endif
!ifndef BUILD_VERSION
!define VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${REVISION_VERSION}"
!else
!define VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${REVISION_VERSION}-${BUILD_VERSION}"
!endif
!define PRODUCT_NAME "OpenERP Server"
!define DISPLAY_NAME "${PRODUCT_NAME} ${MAJOR_VERSION}.${MINOR_VERSION}"
!define UNINSTALL_REGISTRY_ROOT HKLM
!define UNINSTALL_REGISTRY_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${DISPLAY_NAME}"
!define REGISTRY_KEY "Software\${DISPLAY_NAME}"
!define DEFAULT_POSTGRESQL_HOSTNAME 'localhost'
!define DEFAULT_POSTGRESQL_PORT 5432
!define DEFAULT_POSTGRESQL_USERNAME 'openpg'
!define DEFAULT_POSTGRESQL_PASSWORD 'openpgpwd'
Name '${DISPLAY_NAME}'
Caption "${PRODUCT_NAME} ${VERSION} Setup"
OutFile "openerp-server-setup-${VERSION}.exe"
SetCompressor /final /solid lzma
SetCompress auto
ShowInstDetails show
XPStyle on
InstallDir "$PROGRAMFILES\OpenERP ${MAJOR_VERSION}.${MINOR_VERSION}\Server"
InstallDirRegKey HKCU "${REGISTRY_KEY}" ""
BrandingText '${PRODUCT_NAME} ${VERSION}'
RequestExecutionLevel admin
#VIAddVersionKey "ProductName" "${PRODUCT_NAME}"
#VIAddVersionKey "CompanyName" "${PUBLISHER}"
#VIAddVersionKey "FileDescription" "Installer of ${DISPLAY_NAME}"
#VIAddVersionKey "LegalCopyright" "${PUBLISHER}"
#VIAddVersionKey "LegalTrademark" "OpenERP is a trademark of ${PUBLISHER}"
#VIAddVersionKey "FileVersion" "${MAJOR_VERSION}.${MINOR_VERSION}.${REVISION_VERSION}"
#VIProductVersion "${MAJOR_VERSION}.${MINOR_VERSION}.${REVISION_VERSION}"
!insertmacro GetParameters
!insertmacro GetOptions
Var Option_AllInOne
Var HasPostgreSQL
Var cmdLineParams
Var TextPostgreSQLHostname
Var TextPostgreSQLPort
Var TextPostgreSQLUsername
Var TextPostgreSQLPassword
Var HWNDPostgreSQLHostname
Var HWNDPostgreSQLPort
Var HWNDPostgreSQLUsername
Var HWNDPostgreSQLPassword
Var MUI_TEMP
Var STARTMENU_FOLDER
!define MUI_ABORTWARNING
!define MUI_ICON ".\pixmaps\openerp-icon.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP ".\pixmaps\openerp-intro.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP ".\pixmaps\openerp-intro.bmp"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP ".\pixmaps\openerp-slogan.bmp"
!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
!define MUI_HEADER_TRANSPARENT_TEXT ""
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "doc\License.rtf"
!define MUI_COMPONENTSPAGE_SMALLDESC
!insertmacro MUI_PAGE_DIRECTORY
Page Custom ShowPostgreSQL LeavePostgreSQL
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${REGISTRY_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${DISPLAY_NAME}"
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE_LINK $(DESC_FinishPage_Link)
!define MUI_FINISHPAGE_LINK_LOCATION "http://www.openerp.com/contact"
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "French"
!insertmacro MUI_RESERVEFILE_LANGDLL
!macro CreateInternetShortcut FILENAME URL
WriteINIStr "${FILENAME}.url" "InternetShortcut" "URL" "${URL}"
!macroend
; English
LangString DESC_FinishPage_Link ${LANG_ENGLISH} "Contact OpenERP for Partnership and/or Support"
LangString WARNING_HostNameIsEmpty ${LANG_ENGLISH} "The hostname for the connection to the PostgreSQL Server is empty"
LangString WARNING_UserNameIsEmpty ${LANG_ENGLISH} "The username for the connection to the PostgreSQL Server is empty"
LangString WARNING_PasswordIsEmpty ${LANG_ENGLISH} "The password for the connection to the PostgreSQL Server is empty"
LangString WARNING_PortIsWrong ${LANG_ENGLISH} "The port for the connexion to the PostgreSQL Server is wrong (default: 5432)"
LangString DESC_PostgreSQLPage ${LANG_ENGLISH} "Configure the information for the PostgreSQL connection"
LangString DESC_PostgreSQL_Hostname ${LANG_ENGLISH} "Hostname"
LangString DESC_PostgreSQL_Port ${LANG_ENGLISH} "Port"
LangString DESC_PostgreSQL_Username ${LANG_ENGLISH} "Username"
LangString DESC_PostgreSQL_Password ${LANG_ENGLISH} "Password"
; French
LangString DESC_FinishPage_Link ${LANG_FRENCH} "Contactez OpenERP pour un Partenariat et/ou du Support"
LangString WARNING_HostNameIsEmpty ${LANG_FRENCH} "L'adresse pour la connection au serveur PostgreSQL est vide"
LangString WARNING_UserNameIsEmpty ${LANG_FRENCH} "Le nom d'utilisateur pour la connection au serveur PostgreSQL est vide"
LangString WARNING_PasswordIsEmpty ${LANG_FRENCH} "Le mot de passe pour la connection au serveur PostgreSQL est vide"
LangString WARNING_PortIsWrong ${LANG_FRENCH} "Le port pour la connection au serveur PostgreSQL est erroné (défaut: 5432)"
LangString DESC_PostgreSQLPage ${LANG_FRENCH} "Configurez les informations de connection pour le serveur PostgreSQL"
LangString DESC_PostgreSQL_Hostname ${LANG_FRENCH} "Hôte"
LangString DESC_PostgreSQL_Port ${LANG_FRENCH} "Port"
LangString DESC_PostgreSQL_Username ${LANG_FRENCH} "Utilisateur"
LangString DESC_PostgreSQL_Password ${LANG_FRENCH} "Mot de passe"
Section -StopService
nsExec::Exec "net stop openerp-server-6.0"
sleep 2
SectionEnd
Section OpenERP_Server SectionOpenERP_Server
SetOutPath '$INSTDIR'
File /r "dist\*"
SetOutPath "$INSTDIR\service"
File /r "win32\dist\*"
File "win32\start.bat"
File "win32\stop.bat"
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
;Create shortcuts
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\OpenERP Server.lnk" "$INSTDIR\openerp-server.exe"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Start service.lnk" "$INSTDIR\service\start.bat"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Stop service.lnk" "$INSTDIR\service\stop.bat"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Edit config.lnk" "notepad.exe" "$INSTDIR\openerp-server.conf"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\View log.lnk" "notepad.exe" "$INSTDIR\openerp-server.log"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\uninstall.exe"
!insertmacro CreateInternetShortcut "$SMPROGRAMS\$STARTMENU_FOLDER\Forum" "http://www.openerp.com/forum"
!insertmacro CreateInternetShortcut "$SMPROGRAMS\$STARTMENU_FOLDER\Translation" "https://translations.launchpad.net/openobject"
!insertmacro MUI_STARTMENU_WRITE_END
FileOpen $9 '$INSTDIR\install.log' w
FileWrite $9 "Hostname $TextPostgreSQLHostname$\r$\n"
FileWrite $9 "Port $TextPostgreSQLPort$\r$\n"
FileWrite $9 "Username $TextPostgreSQLUsername$\r$\n"
FileWrite $9 "Password $TextPostgreSQLPassword$\r$\n"
FileClose $9
# If there is a previous install of the OpenERP Server, keep the login/password from the config file
WriteIniStr "$INSTDIR\openerp-server.conf" "options" "db_host" $TextPostgreSQLHostname
WriteIniStr "$INSTDIR\openerp-server.conf" "options" "db_user" $TextPostgreSQLUsername
WriteIniStr "$INSTDIR\openerp-server.conf" "options" "db_password" $TextPostgreSQLPassword
WriteIniStr "$INSTDIR\openerp-server.conf" "options" "db_port" $TextPostgreSQLPort
nsExec::Exec '"$INSTDIR\openerp-server.exe" --stop-after-init --logfile "$INSTDIR\openerp-server.log" -s'
nsExec::Exec '"$INSTDIR\service\OpenERPServerService.exe" -auto -install'
SectionEnd
Section -RestartServer
nsExec::Exec "net start openerp-server-6.0"
sleep 2
SectionEnd
Section -Post
WriteRegExpandStr HKLM "${UNINSTALL_REGISTRY_KEY}" "UninstallString" "$INSTDIR\Uninstall.exe"
WriteRegExpandStr HKLM "${UNINSTALL_REGISTRY_KEY}" "InstallLocation" "$INSTDIR"
WriteRegStr HKLM "${UNINSTALL_REGISTRY_KEY}" "DisplayName" "${DISPLAY_NAME}"
WriteRegStr HKLM "${UNINSTALL_REGISTRY_KEY}" "DisplayVersion" "${MAJOR_VERSION}.${MINOR_VERSION}"
WriteRegStr HKLM "${UNINSTALL_REGISTRY_KEY}" "Publisher" "${PUBLISHER}"
WriteRegDWORD HKLM "${UNINSTALL_REGISTRY_KEY}" "Version" "${VERSION}"
WriteRegDWORD HKLM "${UNINSTALL_REGISTRY_KEY}" "VersionMajor" "${MAJOR_VERSION}.${MINOR_VERSION}"
WriteRegDWORD HKLM "${UNINSTALL_REGISTRY_KEY}" "VersionMinor" "${REVISION_VERSION}"
WriteRegStr HKLM "${UNINSTALL_REGISTRY_KEY}" "HelpLink" "support@openerp.com"
WriteRegStr HKLM "${UNINSTALL_REGISTRY_KEY}" "HelpTelephone" "+32.81.81.37.00"
WriteRegStr HKLM "${UNINSTALL_REGISTRY_KEY}" "URLInfoAbout" "http://www.openerp.com"
WriteRegStr HKLM "${UNINSTALL_REGISTRY_KEY}" "Contact" "sales@openerp.com"
WriteRegDWORD HKLM "${UNINSTALL_REGISTRY_KEY}" "NoModify" "1"
WriteRegDWORD HKLM "${UNINSTALL_REGISTRY_KEY}" "NoRepair" "1"
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
Section "Uninstall"
; Stop the NT Service
nsExec::Exec "net stop openerp-server-6.0"
sleep 2
; Uninstall the OpenERP Service
nsExec::Exec '"$INSTDIR\service\OpenERPServerService.exe" -remove'
sleep 2
Rmdir /r "$INSTDIR"
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
Delete "$SMPROGRAMS\$MUI_TEMP\Forum.url"
Delete "$SMPROGRAMS\$MUI_TEMP\Translation.url"
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\OpenERP Server.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\Start service.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\Stop service.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\Edit config.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\View log.lnk"
;
;Delete empty start menu parent diretories
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
startMenuDeleteLoop:
ClearErrors
RMDir $MUI_TEMP
GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
IfErrors startMenuDeleteLoopDone
StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
startMenuDeleteLoopDone:
; Clean the Registry
DeleteRegKey HKLM "${UNINSTALL_REGISTRY_KEY}"
SectionEnd
Function .onInit
Push $R0
${GetParameters} $cmdLineParams
ClearErrors
Pop $R0
StrCpy $Option_AllInOne 0
StrCpy $HasPostgreSQL 0
StrCpy $TextPostgreSQLHostname ${DEFAULT_POSTGRESQL_HOSTNAME}
StrCpy $TextPostgreSQLPort ${DEFAULT_POSTGRESQL_PORT}
StrCpy $TextPostgreSQLUsername ${DEFAULT_POSTGRESQL_USERNAME}
StrCpy $TextPostgreSQLPassword ${DEFAULT_POSTGRESQL_PASSWORD}
Push $R0
${GetOptions} $cmdLineParams '/allinone' $R0
IfErrors +2 0
StrCpy $Option_AllInOne 1
Pop $R0
StrCmp $Option_AllInOne 1 AllInOneMode
StrCmp $Option_AllInOne 0 NoAllInOneMode
AllInOneMode:
MessageBox MB_OK|MB_ICONINFORMATION "All In One"
NoAllInOneMode:
!insertmacro MUI_LANGDLL_DISPLAY
ClearErrors
EnumRegKey $0 HKLM "SOFTWARE\PostgreSQL" 0
IfErrors DoInstallPostgreSQL 0
StrCpy $HasPostgreSQL 1
DoInstallPostgreSQL:
FunctionEnd
Function PostgreSQLOnBack
FunctionEnd
Function ShowPostgreSQL
SectionGetFlags ${SectionOpenERP_Server} $0
IntOp $0 $0 & ${SF_SELECTED}
IntCmp $0 ${SF_SELECTED} LaunchPostgreSQLConfiguration
Abort
LaunchPostgreSQLConfiguration:
nsDialogs::Create /NOUNLOAD 1018
Pop $0
${If} $0 == error
Abort
${EndIf}
GetFunctionAddress $0 PostgreSQLOnBack
nsDialogs::OnBack $0
${NSD_CreateLabel} 0 0 100% 10u $(DESC_PostgreSQLPage)
Pop $0
${NSD_CreateLabel} 0 45 60u 12u $(DESC_PostgreSQL_Hostname)
Pop $0
${NSD_CreateText} 100 45 150u 12u $TextPostgreSQLHostname
Pop $HWNDPostgreSQLHostname
${NSD_CreateLabel} 0 75 60u 12u $(DESC_PostgreSQL_Port)
Pop $0
${NSD_CreateNumber} 100 75 150u 12u $TextPostgreSQLPort
Pop $HWNDPostgreSQLPort
${NSD_CreateLabel} 0 105 60u 12u $(DESC_PostgreSQL_Username)
Pop $0
${NSD_CreateText} 100 105 150u 12u $TextPostgreSQLUsername
Pop $HWNDPostgreSQLUsername
${NSD_CreateLabel} 0 135 60u 12u $(DESC_PostgreSQL_Password)
Pop $0
${NSD_CreateText} 100 135 150u 12u $TextPostgreSQLPassword
Pop $HWNDPostgreSQLPassword
nsDialogs::Show
FunctionEnd
Function LeavePostgreSQL
# Before to leave the PostgreSQL configuration screen, we check the values
# from the inputs, to be sure we have the right values
${NSD_GetText} $HWNDPostgreSQLHostname $TextPostgreSQLHostname
${NSD_GetText} $HWNDPostgreSQLPort $TextPostgreSQLPort
${NSD_GetText} $HWNDPostgreSQLUsername $TextPostgreSQLUsername
${NSD_GetText} $HWNDPostgreSQLPassword $TextPostgreSQLPassword
StrLen $1 $TextPostgreSQLHostname
${If} $1 == 0
MessageBox MB_ICONEXCLAMATION|MB_OK $(WARNING_HostNameIsEmpty)
Abort
${EndIf}
${If} $TextPostgreSQLPort <= 0
${OrIf} $TextPostgreSQLPort > 65535
MessageBox MB_ICONEXCLAMATION|MB_OK $(WARNING_PortIsWrong)
Abort
${EndIf}
StrLen $1 $TextPostgreSQLUsername
${If} $1 == 0
MessageBox MB_ICONEXCLAMATION|MB_OK $(WARNING_UserNameIsEmpty)
Abort
${EndIf}
StrLen $1 $TextPostgreSQLPassword
${If} $1 == 0
MessageBox MB_ICONEXCLAMATION|MB_OK $(WARNING_PasswordIsEmpty)
Abort
${EndIf}
FunctionEnd

View File

@ -33,7 +33,7 @@ import glob
from pprint import pprint as pp
from setuptools import setup as official_setup, find_packages
from setuptools import setup, find_packages
from setuptools.command.install import install
from distutils.sysconfig import get_python_lib
@ -169,21 +169,18 @@ options = {
"optimize": 2,
"dist_dir": 'dist',
"packages": [
"lxml", "lxml.builder", "lxml._elementpath", "lxml.etree",
"lxml.objectify", "decimal", "xml", "xml", "xml.dom", "xml.xpath",
"encodings", "dateutil", "wizard", "pychart", "PIL", "pyparsing",
"pydot", "asyncore","asynchat", "reportlab", "vobject",
"HTMLParser", "select", "mako", "poplib",
"imaplib", "smtplib", "email", "yaml", "DAV",
],
"lxml", "lxml.builder", "lxml._elementpath", "lxml.etree",
"lxml.objectify", "decimal", "xml", "xml", "xml.dom", "xml.xpath",
"encodings", "dateutil", "wizard", "pychart", "PIL", "pyparsing",
"pydot", "asyncore","asynchat", "reportlab", "vobject",
"HTMLParser", "select", "mako", "poplib",
"imaplib", "smtplib", "email", "yaml", "DAV",
"uuid",
],
"excludes" : ["Tkconstants","Tkinter","tcl"],
}
}
def setup(**kwargs):
#pp(kwargs)
return official_setup(**kwargs)
setup(name = name,
version = version,
description = description,
@ -225,13 +222,8 @@ setup(name = name,
'reportlab',
'caldav',
'pyyaml',
#'django',
'pywebdav'
#'cx_Oracle',
#'mysqldb',
'feedparser',
#'bsddb3',
'egenix-mx-base'
],
extras_require={
'SSL' : ['pyopenssl'],

View File

@ -34,10 +34,10 @@ import thread
class OpenERPServerService(win32serviceutil.ServiceFramework):
# required info
_svc_name_ = "openerp-service"
_svc_display_name_ = "OpenERP Server"
_svc_name_ = "openerp-server-6.0"
_svc_display_name_ = "OpenERP Server 6.0"
# optionnal info
_svc_description_ = "OpenERP Server service"
_svc_description_ = "OpenERP Server 6.0 service"
def __init__(self, args):
win32serviceutil.ServiceFramework.__init__(self, args)

View File

@ -1,7 +1,7 @@
@PATH=%WINDIR%\system32;%WINDIR%;%WINDIR%\System32\Wbem;.
@net stop openerp-service
@net stop openerp-server-6.0
@net start openerp-service
@net start openerp-server-6.0
cls

View File

@ -1,5 +1,5 @@
@PATH=%WINDIR%\system32;%WINDIR%;%WINDIR%\System32\Wbem;.
@net stop openerp-service
@net stop openerp-server-6.0
cls