[IMP] improved code to set default accounts in l10n_us,l10n_ma and added new currency_id field to set currency based on select coa, fixed installation time error of l10n_ve
bzr revid: tpa@tinyerp.com-20130903070707-7ib7qi5yubhr11u8
This commit is contained in:
parent
641f19aedf
commit
3bbe2330af
|
@ -2808,6 +2808,7 @@ class account_chart_template(osv.osv):
|
|||
'parent_id': fields.many2one('account.chart.template', 'Parent Chart Template'),
|
||||
'code_digits': fields.integer('# of Digits', required=True, help="No. of Digits to use for account code"),
|
||||
'visible': fields.boolean('Can be Visible?', help="Set this to False if you don't want this template to be used actively in the wizard that generate Chart of Accounts from templates, this is useful when you want to generate accounts of this template only when loading its child template."),
|
||||
'currency_id': fields.many2one('res.currency', 'Currency'),
|
||||
'complete_tax_set': fields.boolean('Complete Set of Taxes', help='This boolean helps you to choose if you want to propose to the user to encode the sale and purchase rates or choose from list of taxes. This last choice assumes that the set of tax defined on this template is complete'),
|
||||
'account_root_id': fields.many2one('account.account.template', 'Root Account', domain=[('parent_id','=',False)]),
|
||||
'tax_code_root_id': fields.many2one('account.tax.code.template', 'Root Tax Code', domain=[('parent_id','=',False)]),
|
||||
|
@ -3068,12 +3069,6 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
|||
'complete_tax_set': fields.boolean('Complete Set of Taxes', help='This boolean helps you to choose if you want to propose to the user to encode the sales and purchase rates or use the usual m2o fields. This last choice assumes that the set of tax defined for the chosen template is complete'),
|
||||
}
|
||||
|
||||
def onchange_company_id(self, cr, uid, ids, company_id, context=None):
|
||||
currency_id = False
|
||||
if company_id:
|
||||
currency_id = self.pool.get('res.company').browse(cr, uid, company_id, context=context).currency_id.id
|
||||
return {'value': {'currency_id': currency_id}}
|
||||
|
||||
def onchange_tax_rate(self, cr, uid, ids, rate=False, context=None):
|
||||
return {'value': {'purchase_tax_rate': rate or False}}
|
||||
|
||||
|
@ -3083,7 +3078,8 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
|||
res['value'] = {'complete_tax_set': False, 'sale_tax': False, 'purchase_tax': False}
|
||||
if chart_template_id:
|
||||
data = self.pool.get('account.chart.template').browse(cr, uid, chart_template_id, context=context)
|
||||
res['value'].update({'complete_tax_set': data.complete_tax_set})
|
||||
currency_id = data.currency_id.id or self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.currency_id.id
|
||||
res['value'].update({'complete_tax_set': data.complete_tax_set, 'currency_id': currency_id})
|
||||
if data.complete_tax_set:
|
||||
# default tax is given by the lowest sequence. For same sequence we will take the latest created as it will be the case for tax created while isntalling the generic chart of account
|
||||
sale_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id"
|
||||
|
@ -3115,7 +3111,11 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
|||
ids = self.pool.get('account.chart.template').search(cr, uid, [('visible', '=', True)], context=context)
|
||||
if ids:
|
||||
if 'chart_template_id' in fields:
|
||||
res.update({'only_one_chart_template': len(ids) == 1, 'chart_template_id': ids[0]})
|
||||
#in order to set default chart which was last created set max of ids.
|
||||
chart_id = max(ids)
|
||||
if context.get("default_charts"):
|
||||
chart_id = self.pool.get('ir.model.data').search_read(cr, uid, [('model','=','account.chart.template'),('module','=',context.get("default_charts"))], ['res_id'], context=context)[0]['res_id']
|
||||
res.update({'only_one_chart_template': len(ids) == 1, 'chart_template_id': chart_id})
|
||||
if 'sale_tax' in fields:
|
||||
sale_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id"
|
||||
, "=", ids[0]), ('type_tax_use', 'in', ('sale','all'))], order="sequence")
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
</form>
|
||||
<footer position="replace">
|
||||
<footer>
|
||||
<button name="action_next" type="object" string="Continue" class="oe_highlight"/>
|
||||
<button name="action_next" context="{'default_charts':charts}" type="object" string="Continue" class="oe_highlight"/>
|
||||
</footer>
|
||||
</footer>
|
||||
<separator string="title" position="replace">
|
||||
|
|
|
@ -2125,7 +2125,7 @@
|
|||
<field name="chart_template_id" widget="selection" on_change="onchange_chart_template_id(chart_template_id)" domain="[('visible','=', True)]"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="company_id" widget="selection" on_change="onchange_company_id(company_id)"/> <!-- we assume that this wizard will be run only by administrators and as this field may cause problem if hidden (because of the default company of the user removed from the selection because already configured), we simply choosed to remove the group "multi company" of it -->
|
||||
<field name="company_id" widget="selection"/> <!-- we assume that this wizard will be run only by administrators and as this field may cause problem if hidden (because of the default company of the user removed from the selection because already configured), we simply choosed to remove the group "multi company" of it -->
|
||||
<field name="currency_id" class="oe_inline"/>
|
||||
<field name="sale_tax" attrs="{'invisible': [('complete_tax_set', '!=', True)]}" domain="[('chart_template_id', '=', chart_template_id),('parent_id','=',False),('type_tax_use','in',('sale','all'))]"/>
|
||||
<label for="sale_tax_rate" string="Sale Tax" attrs="{'invisible': [('complete_tax_set', '=', True)]}"/>
|
||||
|
|
|
@ -742,7 +742,8 @@
|
|||
<field name="account_root_id" ref="pcg_0"/>
|
||||
<field name="tax_code_root_id" ref="vat_ma_tax_root"/>
|
||||
<field name="bank_account_view_id" ref="pcg_514"/>
|
||||
|
||||
<field name="property_account_receivable" ref="pcg_3488"/>
|
||||
<field name="property_account_payable" ref="pcg_4488"/>
|
||||
</record>
|
||||
|
||||
<record model="account.tax.template" id="tva_exo">
|
||||
|
|
|
@ -6,51 +6,60 @@
|
|||
<field name="name">Basic Chart of Account</field>
|
||||
<field name="visible" eval="False" />
|
||||
<field name="complete_tax_set" eval="False" />
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
</record>
|
||||
|
||||
<record id="account_chart_template_cogs" model="account.chart.template">
|
||||
<field name="name">Cost of Goods sold</field>
|
||||
<field name="visible" eval="False" />
|
||||
<field name="parent_id" ref="account_chart_template_basic"/>
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
<field name="complete_tax_set" eval="False" />
|
||||
</record>
|
||||
<record id="account_chart_template_advertising" model="account.chart.template">
|
||||
<field name="name">Advertising</field>
|
||||
<field name="complete_tax_set" eval="False" />
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
<field name="parent_id" ref="account_chart_template_cogs"/>
|
||||
</record>
|
||||
<record id="account_chart_template_agriculture" model="account.chart.template">
|
||||
<field name="name">Agriculture</field>
|
||||
<field name="complete_tax_set" eval="False" />
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
<field name="parent_id" ref="account_chart_template_basic"/>
|
||||
</record>
|
||||
<record id="account_chart_template_construction" model="account.chart.template">
|
||||
<field name="name">Construction Trades (Plumber, Electrician, HVAC, etc.)</field>
|
||||
<field name="complete_tax_set" eval="False" />
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
<field name="parent_id" ref="account_chart_template_cogs"/>
|
||||
</record>
|
||||
|
||||
<record id="account_chart_template_financial_service" model="account.chart.template">
|
||||
<field name="name">Financial Services other than Accounting or Bookkeeping</field>
|
||||
<field name="complete_tax_set" eval="False" />
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
<field name="parent_id" ref="account_chart_template_cogs"/>
|
||||
</record>
|
||||
|
||||
<record id="account_chart_template_general_service" model="account.chart.template">
|
||||
<field name="name">General Service-Based Business</field>
|
||||
<field name="complete_tax_set" eval="False" />
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
<field name="parent_id" ref="account_chart_template_cogs"/>
|
||||
</record>
|
||||
|
||||
<record id="account_chart_template_legal_service" model="account.chart.template">
|
||||
<field name="name">Legal Services</field>
|
||||
<field name="complete_tax_set" eval="False" />
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
<field name="parent_id" ref="account_chart_template_basic"/>
|
||||
</record>
|
||||
|
||||
<record id="account_chart_template_general_product" model="account.chart.template">
|
||||
<field name="name">General Product-Based Business</field>
|
||||
<field name="complete_tax_set" eval="False" />
|
||||
<field name="currency_id" ref="base.USD"/>
|
||||
<field name="parent_id" ref="account_chart_template_basic"/>
|
||||
</record>
|
||||
</data>
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
<field name="account_root_id" ref="coa_basic"/>
|
||||
<field name="bank_account_view_id" ref="cash_expenditure"/>
|
||||
<field name="tax_code_root_id" ref="tax_code_chart_root"/>
|
||||
<field name="property_account_receivable" ref="account_receivable"/>
|
||||
<field name="property_account_payable" ref="account_payable"/>
|
||||
</record>
|
||||
<record id="account_chart_template_advertising" model="account.chart.template">
|
||||
<field name="bank_account_view_id" ref="cash_expenditure"/>
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
<record id="tax0sale" model="account.tax.template">
|
||||
<record id="tax0all" model="account.tax.template">
|
||||
<field name="chart_template_id" ref="ve_chart_template_amd"/>
|
||||
<field name="name">Exento</field>
|
||||
<field name="amount">0.00000</field>
|
||||
<field name="type">percent</field>
|
||||
<field name="type_tax_use">sale</field>
|
||||
<field name="type_tax_use">all</field>
|
||||
<field name="collected_id" ref="account_activa_account_2172003"/>
|
||||
<field name="paid_id" ref="account_activa_account_2172003"/>
|
||||
<field name="base_code_id" ref="vat_code_base_due"/>
|
||||
|
@ -54,19 +54,6 @@
|
|||
<field name="ref_base_code_id" ref="vat_code_receivable_net"/>
|
||||
<field name="ref_tax_code_id" ref="vat_code_payable"/>
|
||||
</record>
|
||||
<record id="tax0purchase" model="account.tax.template">
|
||||
<field name="chart_template_id" ref="ve_chart_template_amd"/>
|
||||
<field name="name">Exento</field>
|
||||
<field name="amount">0.00000</field>
|
||||
<field name="type">percent</field>
|
||||
<field name="type_tax_use">purchase</field>
|
||||
<field name="collected_id" ref="account_activa_account_2172003"/>
|
||||
<field name="paid_id" ref="account_activa_account_2172003"/>
|
||||
<field name="base_code_id" ref="vat_code_base_due"/>
|
||||
<field name="tax_code_id" ref="vat_code_due_tva"/>
|
||||
<field name="ref_base_code_id" ref="vat_code_receivable_net"/>
|
||||
<field name="ref_tax_code_id" ref="vat_code_payable"/>
|
||||
</record>
|
||||
<record id="tax1purchase" model="account.tax.template">
|
||||
<field name="chart_template_id" ref="ve_chart_template_amd"/>
|
||||
<field name="name">IVA (12.0%) compras</field>
|
||||
|
|
Loading…
Reference in New Issue