[FIX] account: when generating objects from templates, set the default taxes as a super user + use of set_default() instead of deprecated set(key='default') (on ir.values)

bzr revid: qdp-launchpad@openerp.com-20120828095345-erwdm59r3wspqbah
This commit is contained in:
Quentin (OpenERP) 2012-08-28 11:53:45 +02:00
parent 6f58426c10
commit 0fb11f25c4
1 changed files with 3 additions and 5 deletions

View File

@ -3345,13 +3345,11 @@ class wizard_multi_charts_accounts(osv.osv_memory):
# Install all the templates objects and generate the real objects
acc_template_ref, taxes_ref, tax_code_ref = self._install_template(cr, uid, obj_wizard.chart_template_id.id, company_id, code_digits=obj_wizard.code_digits, obj_wizard=obj_wizard, context=context)
# write values of default taxes for product
# write values of default taxes for product as super user
if obj_wizard.sale_tax and taxes_ref:
ir_values_obj.set(cr, uid, key='default', key2=False, name="taxes_id", company=company_id,
models =[('product.product',False)], value=[taxes_ref[obj_wizard.sale_tax.id]])
ir_values_obj.set_default(cr, 1, 'product.product', "taxes_id", [taxes_ref[obj_wizard.sale_tax.id]], for_all_users=True, company=company_id)
if obj_wizard.purchase_tax and taxes_ref:
ir_values_obj.set(cr, uid, key='default', key2=False, name="supplier_taxes_id", company=company_id,
models =[('product.product',False)], value=[taxes_ref[obj_wizard.purchase_tax.id]])
ir_values_obj.set_default(cr, 1, 'product.product', "supplier_taxes_id", [taxes_ref[obj_wizard.purchase_tax.id]], for_all_users=True, company=company_id)
# Create Bank journals
self._create_bank_journals_from_o2m(cr, uid, obj_wizard, company_id, acc_template_ref, context=context)