[IMP]: Improved code to use new object res.config.settings for application settings.
bzr revid: uco@tinyerp.com-20120305051133-rj71925yxncp432a
This commit is contained in:
parent
5218960e75
commit
05477792a4
|
@ -23,7 +23,7 @@ from osv import fields, osv
|
|||
from tools.translate import _
|
||||
|
||||
class account_configuration(osv.osv_memory):
|
||||
_inherit = 'res.config'
|
||||
_inherit = 'res.config.settings'
|
||||
|
||||
_columns = {
|
||||
'tax_policy': fields.selection([
|
||||
|
@ -108,4 +108,6 @@ class account_configuration(osv.osv_memory):
|
|||
users_obj.write(cr, uid, [uid], {'groups_id': [(3,group_id)]})
|
||||
ir_values_obj.set(cr, uid, 'default', False, 'groups_id', ['res.users'], [(3,group_id)])
|
||||
|
||||
account_configuration()
|
||||
account_configuration()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -113,7 +113,7 @@
|
|||
|
||||
<record id="view_contract_installation" model="ir.ui.view">
|
||||
<field name="name">Sales Application</field>
|
||||
<field name="model">res.config</field>
|
||||
<field name="model">res.config.settings</field>
|
||||
<field name="inherit_id" ref="sale.view_sales_config"/>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
from osv import fields, osv
|
||||
|
||||
class crm_configuration(osv.osv_memory):
|
||||
_inherit = 'res.config'
|
||||
_inherit = 'res.config.settings'
|
||||
|
||||
_columns = {
|
||||
'module_crm_caldav' : fields.boolean("Caldav Synchronization",
|
||||
|
@ -72,21 +72,6 @@ class crm_configuration(osv.osv_memory):
|
|||
'type': 'pop',
|
||||
}
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
ids = super(crm_configuration, self).create(cr, uid, vals, context=context)
|
||||
self.execute(cr, uid, [ids], vals, context)
|
||||
return ids
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
self.execute(cr, uid, ids, vals, context)
|
||||
return super(crm_configuration, self).write(cr, uid, ids, vals, context=context)
|
||||
|
||||
def execute(self, cr, uid, ids, vals, context=None):
|
||||
for method in dir(self):
|
||||
if method.startswith('set_'):
|
||||
getattr(self, method)(cr, uid, ids, vals, context)
|
||||
return True
|
||||
|
||||
def get_default_email_configurations(self, cr, uid, ids, context=None):
|
||||
ir_values_obj = self.pool.get('ir.values')
|
||||
fetchmail_obj = self.pool.get('fetchmail.server')
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
<record id="view_sales_config_crm" model="ir.ui.view">
|
||||
<field name="name">Sales Application</field>
|
||||
<field name="model">res.config</field>
|
||||
<field name="model">res.config.settings</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="base.res_config_view_for_all"/>
|
||||
<field name="inherit_id" ref="base.view_res_config_settings"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//form/group[@name='crm']/group[@name='plugin']" position="inside">
|
||||
<group col="2" colspan="2" name="emails">
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
from osv import fields, osv
|
||||
|
||||
class plugin_configuration(osv.osv_memory):
|
||||
_inherit = 'res.config'
|
||||
_inherit = 'res.config.settings'
|
||||
|
||||
_columns = {
|
||||
'module_plugin_thunderbird': fields.boolean('Thunderbird plugin',
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
<record id="view_sales_config_plugin" model="ir.ui.view">
|
||||
<field name="name">Sales Application</field>
|
||||
<field name="model">res.config</field>
|
||||
<field name="model">res.config.settings</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="base.res_config_view_for_all"/>
|
||||
<field name="inherit_id" ref="base.view_res_config_settings"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//form/group[@name='crm']/group[@name='plugin']" position="inside">
|
||||
<group col="4" colspan="2">
|
||||
|
@ -20,4 +20,4 @@
|
|||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</openerp>
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
<!-- Sales Configuration -->
|
||||
<record id="view_config_outlook_installer" model="ir.ui.view">
|
||||
<field name="name">Sales Application</field>
|
||||
<field name="model">res.config</field>
|
||||
<field name="model">res.config.settings</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="mail.view_sales_config_plugin"/>
|
||||
<field name="arch" type="xml">
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
<!-- Sales Configuration -->
|
||||
<record id="view_config_thunderbird_installer" model="ir.ui.view">
|
||||
<field name="name">Sales Application</field>
|
||||
<field name="model">res.config</field>
|
||||
<field name="model">res.config.settings</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="mail.view_sales_config_plugin"/>
|
||||
<field name="arch" type="xml">
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
from osv import fields, osv
|
||||
|
||||
class product_groups_configuration(osv.osv_memory):
|
||||
_inherit = 'res.config'
|
||||
_inherit = 'res.config.settings'
|
||||
|
||||
_columns = {
|
||||
'group_sale_pricelist_per_customer':fields.boolean("Pricelist per customer",
|
||||
|
|
|
@ -24,7 +24,7 @@ import pooler
|
|||
from tools.translate import _
|
||||
|
||||
class sale_configuration(osv.osv_memory):
|
||||
_inherit = 'res.config'
|
||||
_inherit = 'res.config.settings'
|
||||
|
||||
_columns = {
|
||||
'sale_orders': fields.boolean('Based on Sales Orders',
|
||||
|
@ -110,21 +110,6 @@ class sale_configuration(osv.osv_memory):
|
|||
'time_unit': lambda self, cr, uid, c: self.pool.get('product.uom').search(cr, uid, [('name', '=', _('Hour'))], context=c) and self.pool.get('product.uom').search(cr, uid, [('name', '=', _('Hour'))], context=c)[0] or False,
|
||||
}
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
ids = super(sale_configuration, self).create(cr, uid, vals, context=context)
|
||||
self.execute(cr, uid, [ids], vals, context)
|
||||
return ids
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
self.execute(cr, uid, ids, vals, context)
|
||||
return super(sale_configuration, self).write(cr, uid, ids, vals, context=context)
|
||||
|
||||
def execute(self, cr, uid, ids, vals, context=None):
|
||||
for method in dir(self):
|
||||
if method.startswith('set_'):
|
||||
getattr(self, method)(cr, uid, ids, vals, context)
|
||||
return True
|
||||
|
||||
def set_installed_modules(self, cr, uid, ids, vals, context=None):
|
||||
if vals.get('task_work'):
|
||||
vals.update({'module_project_timesheet': True, 'module_project_mrp': True})
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
<record id="view_sales_config" model="ir.ui.view">
|
||||
<field name="name">Sales Application</field>
|
||||
<field name="model">res.config</field>
|
||||
<field name="model">res.config.settings</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="base.res_config_view_for_all"/>
|
||||
<field name="inherit_id" ref="base.view_res_config_settings"/>
|
||||
<field name="arch" type="xml">
|
||||
<group name="sales" position="inside">
|
||||
<separator string="Picking and Invoice Policy" colspan="4"/>
|
||||
|
|
|
@ -82,8 +82,8 @@
|
|||
-
|
||||
I set order policy "Deliver & invoice on demand" as default policy.
|
||||
-
|
||||
!record {model: res.config, id: sale_configuration_0}:
|
||||
!record {model: res.config.settings, id: sale_configuration_0}:
|
||||
order_policy: 'manual'
|
||||
-
|
||||
!python {model: res.config}: |
|
||||
!python {model: res.config.settings}: |
|
||||
self.execute(cr, uid, [ref("sale_configuration_0")], {})
|
||||
|
|
Loading…
Reference in New Issue