Merging from mga

add new field to have company wise seprate currency
new development in to the Server Action

bzr revid: mga@tinyerp.com-20080826102010-jcw66debw18mbp20
This commit is contained in:
mga@tinyerp.com 2008-08-26 15:50:10 +05:30
commit 4d9214cff5
6 changed files with 27 additions and 5 deletions

View File

@ -151,6 +151,9 @@
<separator colspan="4" string="Your Logo - Use a size of about 450x150 pixels."/>
<field colspan="4" name="logo" widget="image"/>
</page>
<page string="Currency">
<field colspan="4" name="currency_ids" nolabel="1"/>
</page>
<page string="Header/Footer">
<field colspan="4" name="rml_header" nolabel="1"/>
</page>

View File

@ -1065,7 +1065,8 @@
<page string="Create / Write" attrs="{'invisible':[('state','=','python'),('state','=','dummy'),('state','=','trigger'), ('state','=','sms'), ('state','=','email'), ('state','=','client_action'), ('state','=','other')]}">
<separator colspan="4" string="Fields Mapping"/>
<field name="srcmodel_id" select="2"/>
<field name="otype"/>
<field name="srcmodel_id" select="2" attrs="{'readonly':[('type','!=','new'),('type','!=','object_create')]}"/>
<field name="fields_lines" nolabel="1" select="2" colspan="4">
<tree string="Field Mappings" editable="top">
<field name="col1" domain="[('model_id','=',parent.srcmodel_id)]"/>
@ -1075,7 +1076,7 @@
<form string="Field Mapping">
<field name="col1" domain="[('model_id','=',parent.srcmodel_id)]"/>
<field name="type"/>
<field name="value" colapsn="4"/>
<field name="value" colsapan="4"/>
</form>
</field>
</page>

View File

@ -380,8 +380,12 @@ class actions_server(osv.osv):
'child_ids': fields.one2many('ir.actions.actions', 'parent_id', 'Others Actions'),
'usage': fields.char('Action Usage', size=32),
'type': fields.char('Report Type', size=32, required=True),
'srcmodel_id': fields.many2one('ir.model', 'Model', required=True),
'srcmodel_id': fields.many2one('ir.model', 'Model'),
'fields_lines': fields.one2many('ir.server.object.lines', 'server_id', 'Fields Mapping'),
'otype': fields.selection([
('copy','Create in Same Model'),
('new','Create in Other Model')
], 'Create Model', required=True, size=32, change_default=True),
}
_defaults = {
'state': lambda *a: 'dummy',
@ -522,7 +526,18 @@ class actions_server(osv.osv):
obj_pool.write(cr, uid, [context.get('active_id')], res)
if action.state == 'object_create':
pass
res = {}
for exp in action.fields_lines:
euq = exp.value
if exp.type == 'equation':
expr = self.merge_message(cr, uid, euq, action, context)
expr = eval(expr)
else:
expr = exp.value
res[exp.col1.name] = expr
obj_pool = self.pool.get(action.model_id.model)
id = context.get('active_id')
obj_pool.copy(cr, uid, id, res)
return False
actions_server()

View File

@ -46,6 +46,7 @@ class res_company(osv.osv):
'rml_header2' : fields.text('RML Internal Header'),
'logo' : fields.binary('Logo'),
'currency_id': fields.many2one('res.currency', 'Currency', required=True),
'currency_ids': fields.one2many('res.currency', 'company_id', 'Currency Rates'),
}
def _get_child_ids(self, cr, uid, uid2, context={}):

View File

@ -64,6 +64,7 @@ class res_currency(osv.osv):
'accuracy': fields.integer('Computational Accuracy'),
'rounding': fields.float('Rounding factor', digits=(12,6)),
'active': fields.boolean('Active'),
'company_id' : fields.many2one('res.company', 'Company'),
}
_defaults = {
'active': lambda *a: 1,

View File

@ -23,7 +23,8 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Currency">
<field colspan="4" name="name" select="1"/>
<field name="name" select="1"/>
<field name="company_id" select="2"/>
<field name="code" select="1"/>
<field name="rate"/>
<field name="rounding"/>