[IMP] account: added an option to enable/disable the check_total feature on supplier invoices

bzr revid: qdp-launchpad@openerp.com-20121024091313-s6k3ekmsen5ntez4
This commit is contained in:
Quentin (OpenERP) 2012-10-24 11:13:13 +02:00
parent 4cf7382905
commit ff6966da8b
5 changed files with 17 additions and 2 deletions

View File

@ -865,8 +865,11 @@ class account_invoice(osv.osv):
self.check_tax_lines(cr, uid, inv, compute_taxes, ait_obj)
# I disabled the check_total feature
#if inv.type in ('in_invoice', 'in_refund') and abs(inv.check_total - inv.amount_total) >= (inv.currency_id.rounding/2.0):
# raise osv.except_osv(_('Bad total !'), _('Please verify the price of the invoice !\nThe real total does not match the computed total.'))
group_check_total_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'group_supplier_inv_check_total')[1]
group_check_total = self.pool.get('res.groups').browse(cr, uid, group_check_total_id, context=context)
if group_check_total and uid in [x.id for x in group_check_total.users]:
if (inv.type in ('in_invoice', 'in_refund') and abs(inv.check_total - inv.amount_total) >= (inv.currency_id.rounding/2.0)):
raise osv.except_osv(_('Bad total !'), _('Please verify the price of the invoice !\nThe encoded total does not match the computed total.'))
if inv.payment_term:
total_fixed = total_percent = 0

View File

@ -186,6 +186,7 @@
<field name="journal_id" groups="account.group_account_user"
on_change="onchange_journal_id(journal_id, context)" widget="selection"/>
<field name="currency_id" groups="base.group_multi_currency"/>
<field name="check_total" groups="account.group_supplier_inv_check_total"/>
</group>
</group>
<notebook>

View File

@ -120,6 +120,8 @@ class account_config_settings(osv.osv_memory):
'group_analytic_accounting': fields.boolean('Analytic accounting',
implied_group='analytic.group_analytic_accounting',
help="Allows you to use the analytic accounting."),
'group_check_supplier_invoice_total': fields.boolean('Check the Total of Supplier Invoices',
implied_group="account.group_supplier_inv_check_total"),
}
def _default_company(self, cr, uid, context=None):

View File

@ -220,6 +220,10 @@
<field name="module_account_check_writing" class="oe_inline"/>
<label for="module_account_check_writing"/>
</div>
<div>
<field name="group_check_supplier_invoice_total" class="oe_inline"/>
<label for="group_check_supplier_invoice_total"/>
</div>
</div>
</group>
<separator string="Bank &amp; Cash"/>

View File

@ -26,6 +26,11 @@
<field name="category_id" ref="base.module_category_hidden"/>
</record>
<record id="group_supplier_inv_check_total" model="res.groups">
<field name="name">Check Total on supplier invoices</field>
<field name="category_id" ref="base.module_category_hidden"/>
</record>
<record id="account_move_comp_rule" model="ir.rule">
<field name="name">Account Entry</field>
<field name="model_id" ref="model_account_move"/>