bzr revid: fp@openerp.com-20121114223547-oprwc2wo3d5e62uw
This commit is contained in:
Fabien Pinckaers 2012-11-14 23:35:47 +01:00
commit 511ddde903
4 changed files with 19 additions and 9 deletions

View File

@ -432,7 +432,7 @@ class account_invoice(osv.osv):
if t['state'] in ('draft', 'cancel') and t['internal_number']== False:
unlink_ids.append(t['id'])
else:
raise osv.except_osv(_('Invalid Action!'), _('You cannot delete an invoice which is open or paid. You should refund it instead.'))
raise osv.except_osv(_('Invalid Action!'), _('You can not delete an invoice which is not cancelled. You should refund it instead.'))
osv.osv.unlink(self, cr, uid, unlink_ids, context=context)
return True

View File

@ -72,12 +72,12 @@
<field name="date" readonly="1"/>
<field name="val_date" readonly="1"/>
<field name="name"/>
<field name="statement_id" readonly="1"/>
<field name="statement_id"/>
<field name="ref" readonly="1"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id)"/>
<field name="type" on_change="onchange_type(partner_id, type)"/>
<field name="account_id" domain="[('journal_id','=',journal_id)]"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('company_id', '=', parent.company_id), ('type', '&lt;&gt;', 'view')]"/>
<field name="account_id"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('type', '&lt;&gt;', 'view')]"/>
<field name="amount" readonly="1" sum="Total Amount"/>
<field name="globalisation_id" string="Glob. Id"/>
<field name="globalisation_amount" string="Glob. Am."/>
@ -100,8 +100,8 @@
<field name="ref" readonly="0"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id)"/>
<field name="type" on_change="onchange_type(partner_id, type)"/>
<field domain="[('journal_id', '=', journal_id), ('type', '&lt;&gt;', 'view')]" name="account_id"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('company_id', '=', parent.company_id), ('type', '&lt;&gt;', 'view')]"/>
<field domain="[('type', '&lt;&gt;', 'view')]" name="account_id"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('type', '&lt;&gt;', 'view')]"/>
<field name="amount"/>
<field name="globalisation_id"/>
<field name="sequence" readonly="0"/>

View File

@ -346,8 +346,13 @@ class audittrail_objects_proxy(object_proxy):
x2m_model_id = x2m_model_ids and x2m_model_ids[0] or False
assert x2m_model_id, _("'%s' Model does not exist..." %(field_obj._obj))
x2m_model = pool.get('ir.model').browse(cr, SUPERUSER_ID, x2m_model_id)
#recursive call on x2m fields that need to be checked too
data.update(self.get_data(cr, SUPERUSER_ID, pool, resource[field], x2m_model, method))
field_resource_ids = list(set(resource[field]))
if model.model == x2m_model.model:
# we need to remove current resource_id from the many2many to prevent an infinit loop
if resource_id in field_resource_ids:
field_resource_ids.remove(resource_id)
data.update(self.get_data(cr, SUPERUSER_ID, pool, field_resource_ids, x2m_model, method))
data[(model.id, resource_id)] = {'text':values_text, 'value': values}
return data
@ -408,6 +413,10 @@ class audittrail_objects_proxy(object_proxy):
x2m_new_values_ids = new_values.get(key, {'value': {}})['value'].get(field_name, [])
# We use list(set(...)) to remove duplicates.
res_ids = list(set(x2m_old_values_ids + x2m_new_values_ids))
if model.model == x2m_model.model:
# we need to remove current resource_id from the many2many to prevent an infinit loop
if resource_id in res_ids:
res_ids.remove(resource_id)
for res_id in res_ids:
lines.update(self.prepare_audittrail_log_line(cr, SUPERUSER_ID, pool, x2m_model, res_id, method, old_values, new_values, field_list))
# if the value value is different than the old value: record the change

View File

@ -283,10 +283,11 @@
<field name="model">stock.tracking</field>
<field name="field_parent">child_ids</field>
<field name="arch" type="xml">
<tree colors="grey:not active" string="Packs">
<tree colors="grey:active == False" string="Packs">
<field name="name"/>
<field name="serial"/>
<field name="date"/>
<field name="active" invisible="1"/>
</tree>
</field>
</record>