[IMP] Removed the wizard to install chart of accounts -> install automatically
If installation from SaaS, we know the country of the main company so that we can install the chart of account by default if it exists for this country. If not from SaaS, you get the wizard like before. bzr revid: fp@tinyerp.com-20111123141616-jrz846u7hd3rubbc
This commit is contained in:
parent
90041e5d81
commit
ccfadbdd90
|
@ -125,6 +125,7 @@ module named account_voucher.
|
|||
"wizard/account_report_balance_sheet_view.xml",
|
||||
"edi/invoice_action_data.xml",
|
||||
"account_bank_view.xml",
|
||||
"account_pre_install.yml"
|
||||
],
|
||||
'demo_xml': [
|
||||
'demo/account_demo.xml',
|
||||
|
|
|
@ -861,19 +861,6 @@ class account_fiscalyear(osv.osv):
|
|||
}
|
||||
_order = "date_start"
|
||||
|
||||
def _check_fiscal_year(self, cr, uid, ids, context=None):
|
||||
current_fiscal_yr = self.browse(cr, uid, ids, context=context)[0]
|
||||
obj_fiscal_ids = self.search(cr, uid, [('company_id', '=', current_fiscal_yr.company_id.id)], context=context)
|
||||
obj_fiscal_ids.remove(ids[0])
|
||||
data_fiscal_yr = self.browse(cr, uid, obj_fiscal_ids, context=context)
|
||||
|
||||
for old_fy in data_fiscal_yr:
|
||||
if old_fy.company_id.id == current_fiscal_yr['company_id'].id:
|
||||
# Condition to check if the current fiscal year falls in between any previously defined fiscal year
|
||||
if old_fy.date_start <= current_fiscal_yr['date_start'] <= old_fy.date_stop or \
|
||||
old_fy.date_start <= current_fiscal_yr['date_stop'] <= old_fy.date_stop:
|
||||
return False
|
||||
return True
|
||||
|
||||
def _check_duration(self, cr, uid, ids, context=None):
|
||||
obj_fy = self.browse(cr, uid, ids[0], context=context)
|
||||
|
@ -882,8 +869,7 @@ class account_fiscalyear(osv.osv):
|
|||
return True
|
||||
|
||||
_constraints = [
|
||||
(_check_duration, 'Error! The start date of the fiscal year must be before his end date.', ['date_start','date_stop']),
|
||||
(_check_fiscal_year, 'Error! You can not define overlapping fiscal years for the same company.',['date_start', 'date_stop'])
|
||||
(_check_duration, 'Error! The start date of the fiscal year must be before his end date.', ['date_start','date_stop'])
|
||||
]
|
||||
|
||||
def create_period3(self, cr, uid, ids, context=None):
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
<record id="category_accounting_configuration" model="ir.actions.todo.category">
|
||||
<field name="name">Accounting</field>
|
||||
<field name="sequence">5</field>
|
||||
</record>
|
||||
</record>
|
||||
|
||||
<record id="account_configuration_installer_todo" model="ir.actions.todo">
|
||||
<field name="action_id" ref="action_account_configuration_installer"/>
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
-
|
||||
I configure automatically if the country is set on the company, mainly for online offers.
|
||||
-
|
||||
!python {model: account.installer}: |
|
||||
modules = self.pool.get('ir.module.module')
|
||||
wizards = self.pool.get('ir.actions.todo')
|
||||
wiz = wizards.browse(cr, uid, ref('account.account_configuration_installer_todo'))
|
||||
part = self.pool.get('res.partner').browse(cr, uid, ref('base.main_partner'))
|
||||
# if we know the country and the wizard has not yet been executed, we do it
|
||||
if (part.country.id) and (wiz.state=='open'):
|
||||
mod = 'l10n_'+part.country.code.lower()
|
||||
ids = modules.search(cr, uid, [ ('name','=',mod) ], context=context)
|
||||
if ids:
|
||||
wizards.write(cr, uid, [ref('account.account_configuration_installer_todo')], {
|
||||
'state': 'done'
|
||||
})
|
||||
wiz_id = self.create(cr, uid, {
|
||||
'charts': mod
|
||||
})
|
||||
self.execute_simple(cr, uid, [wiz_id])
|
||||
modules.state_update(cr, uid, ids,
|
||||
'to install', ['uninstalled'], context=context)
|
|
@ -7,7 +7,7 @@
|
|||
-->
|
||||
|
||||
<record id="data_fiscalyear" model="account.fiscalyear">
|
||||
<field eval="'Fiscal Year '+time.strftime('%Y')" name="name"/>
|
||||
<field eval="'Fiscal Year X '+time.strftime('%Y')" name="name"/>
|
||||
<field eval="'FY'+time.strftime('%Y')" name="code"/>
|
||||
<field eval="time.strftime('%Y')+'-01-01'" name="date_start"/>
|
||||
<field eval="time.strftime('%Y')+'-12-31'" name="date_stop"/>
|
||||
|
@ -20,7 +20,7 @@
|
|||
|
||||
<record id="period_1" model="account.period">
|
||||
<field eval="'01/'+time.strftime('%Y')" name="code"/>
|
||||
<field eval="'01/'+time.strftime('%Y')" name="name"/>
|
||||
<field eval="'X 01/'+time.strftime('%Y')" name="name"/>
|
||||
<field eval="True" name="special"/>
|
||||
<field name="fiscalyear_id" ref="data_fiscalyear"/>
|
||||
<field eval="time.strftime('%Y')+'-01-01'" name="date_start"/>
|
||||
|
@ -29,7 +29,7 @@
|
|||
</record>
|
||||
<record id="period_2" model="account.period">
|
||||
<field eval="'02/'+time.strftime('%Y')" name="code"/>
|
||||
<field eval="'02/'+time.strftime('%Y')" name="name"/>
|
||||
<field eval="'X 02/'+time.strftime('%Y')" name="name"/>
|
||||
<field eval="True" name="special"/>
|
||||
<field name="fiscalyear_id" ref="data_fiscalyear"/>
|
||||
<field eval="time.strftime('%Y')+'-02-01'" name="date_start"/>
|
||||
|
@ -38,7 +38,7 @@
|
|||
</record>
|
||||
<record id="period_3" model="account.period">
|
||||
<field eval="'03/'+time.strftime('%Y')" name="code"/>
|
||||
<field eval="'03/'+time.strftime('%Y')" name="name"/>
|
||||
<field eval="'X 03/'+time.strftime('%Y')" name="name"/>
|
||||
<field eval="True" name="special"/>
|
||||
<field name="fiscalyear_id" ref="data_fiscalyear"/>
|
||||
<field eval="time.strftime('%Y')+'-03-01'" name="date_start"/>
|
||||
|
@ -47,7 +47,7 @@
|
|||
</record>
|
||||
<record id="period_4" model="account.period">
|
||||
<field eval="'04/'+time.strftime('%Y')" name="code"/>
|
||||
<field eval="'04/'+time.strftime('%Y')" name="name"/>
|
||||
<field eval="'X 04/'+time.strftime('%Y')" name="name"/>
|
||||
<field eval="True" name="special"/>
|
||||
<field name="fiscalyear_id" ref="data_fiscalyear"/>
|
||||
<field eval="time.strftime('%Y')+'-04-01'" name="date_start"/>
|
||||
|
@ -56,7 +56,7 @@
|
|||
</record>
|
||||
<record id="period_5" model="account.period">
|
||||
<field eval="'05/'+time.strftime('%Y')" name="code"/>
|
||||
<field eval="'05/'+time.strftime('%Y')" name="name"/>
|
||||
<field eval="'X 05/'+time.strftime('%Y')" name="name"/>
|
||||
<field eval="True" name="special"/>
|
||||
<field name="fiscalyear_id" ref="data_fiscalyear"/>
|
||||
<field eval="time.strftime('%Y')+'-05-01'" name="date_start"/>
|
||||
|
@ -65,7 +65,7 @@
|
|||
</record>
|
||||
<record id="period_6" model="account.period">
|
||||
<field eval="'06/'+time.strftime('%Y')" name="code"/>
|
||||
<field eval="'06/'+time.strftime('%Y')" name="name"/>
|
||||
<field eval="'X 06/'+time.strftime('%Y')" name="name"/>
|
||||
<field name="fiscalyear_id" ref="data_fiscalyear"/>
|
||||
<field eval="True" name="special"/>
|
||||
<field eval="time.strftime('%Y')+'-06-01'" name="date_start"/>
|
||||
|
@ -74,7 +74,7 @@
|
|||
</record>
|
||||
<record id="period_7" model="account.period">
|
||||
<field eval="'07/'+time.strftime('%Y')" name="code"/>
|
||||
<field eval="'07/'+time.strftime('%Y')" name="name"/>
|
||||
<field eval="'X 07/'+time.strftime('%Y')" name="name"/>
|
||||
<field eval="True" name="special"/>
|
||||
<field name="fiscalyear_id" ref="data_fiscalyear"/>
|
||||
<field eval="time.strftime('%Y')+'-07-01'" name="date_start"/>
|
||||
|
@ -83,7 +83,7 @@
|
|||
</record>
|
||||
<record id="period_8" model="account.period">
|
||||
<field eval="'08/'+time.strftime('%Y')" name="code"/>
|
||||
<field eval="'08/'+time.strftime('%Y')" name="name"/>
|
||||
<field eval="'X 08/'+time.strftime('%Y')" name="name"/>
|
||||
<field eval="True" name="special"/>
|
||||
<field name="fiscalyear_id" ref="data_fiscalyear"/>
|
||||
<field eval="time.strftime('%Y')+'-08-01'" name="date_start"/>
|
||||
|
@ -92,7 +92,7 @@
|
|||
</record>
|
||||
<record id="period_9" model="account.period">
|
||||
<field eval="'09/'+time.strftime('%Y')" name="code"/>
|
||||
<field eval="'09/'+time.strftime('%Y')" name="name"/>
|
||||
<field eval="'X 09/'+time.strftime('%Y')" name="name"/>
|
||||
<field eval="True" name="special"/>
|
||||
<field name="fiscalyear_id" ref="data_fiscalyear"/>
|
||||
<field eval="time.strftime('%Y')+'-09-01'" name="date_start"/>
|
||||
|
@ -101,7 +101,7 @@
|
|||
</record>
|
||||
<record id="period_10" model="account.period">
|
||||
<field eval="'10/'+time.strftime('%Y')" name="code"/>
|
||||
<field eval="'10/'+time.strftime('%Y')" name="name"/>
|
||||
<field eval="'X 10/'+time.strftime('%Y')" name="name"/>
|
||||
<field eval="True" name="special"/>
|
||||
<field name="fiscalyear_id" ref="data_fiscalyear"/>
|
||||
<field eval="time.strftime('%Y')+'-10-01'" name="date_start"/>
|
||||
|
@ -110,7 +110,7 @@
|
|||
</record>
|
||||
<record id="period_11" model="account.period">
|
||||
<field eval="'11/'+time.strftime('%Y')" name="code"/>
|
||||
<field eval="'11/'+time.strftime('%Y')" name="name"/>
|
||||
<field eval="'X 11/'+time.strftime('%Y')" name="name"/>
|
||||
<field eval="True" name="special"/>
|
||||
<field name="fiscalyear_id" ref="data_fiscalyear"/>
|
||||
<field eval="time.strftime('%Y')+'-11-01'" name="date_start"/>
|
||||
|
@ -119,7 +119,7 @@
|
|||
</record>
|
||||
<record id="period_12" model="account.period">
|
||||
<field eval="'12/'+time.strftime('%Y')" name="code"/>
|
||||
<field eval="'12/'+time.strftime('%Y')" name="name"/>
|
||||
<field eval="'X 12/'+time.strftime('%Y')" name="name"/>
|
||||
<field eval="True" name="special"/>
|
||||
<field name="fiscalyear_id" ref="data_fiscalyear"/>
|
||||
<field eval="time.strftime('%Y')+'-12-01'" name="date_start"/>
|
||||
|
@ -129,6 +129,6 @@
|
|||
|
||||
<record id="base.user_demo" model="res.users">
|
||||
<field name="groups_id" eval="[(4,ref('account.group_account_user'))]"/>
|
||||
</record>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -111,6 +111,10 @@ class account_installer(osv.osv_memory):
|
|||
return {}
|
||||
|
||||
def execute(self, cr, uid, ids, context=None):
|
||||
self.execute_simple(cr, uid, ids, context)
|
||||
super(account_installer, self).execute(cr, uid, ids, context=context)
|
||||
|
||||
def execute_simple(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
fy_obj = self.pool.get('account.fiscalyear')
|
||||
|
@ -219,7 +223,6 @@ class account_installer(osv.osv_memory):
|
|||
fy_obj.create_period(cr, uid, [fiscal_id])
|
||||
elif res['period'] == '3months':
|
||||
fy_obj.create_period3(cr, uid, [fiscal_id])
|
||||
super(account_installer, self).execute(cr, uid, ids, context=context)
|
||||
|
||||
def modules_to_install(self, cr, uid, ids, context=None):
|
||||
modules = super(account_installer, self).modules_to_install(
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
|
||||
|
||||
<!--
|
||||
Resource: product.uom
|
||||
-->
|
||||
Resource: product.uom
|
||||
-->
|
||||
<record id="product_uom_unit" model="product.uom">
|
||||
<field name="category_id" ref="product_uom_categ_unit"/>
|
||||
<field name="name">PCE</field>
|
||||
|
|
Loading…
Reference in New Issue