Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Coopdevs OCB mirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coopdevs
Odoo
Coopdevs OCB mirror
Commits
6dab2645
Commit
6dab2645
authored
14 years ago
by
Naresh Choksy
Browse files
Options
Downloads
Patches
Plain Diff
[IMP]:account chart configurable
bzr revid: nch@tinyerp.com-20100511121950-rreasht5mqx0d1g6
parent
71f2ead1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
addons/account/installer.py
+73
-6
73 additions, 6 deletions
addons/account/installer.py
with
73 additions
and
6 deletions
addons/account/installer.py
+
73
−
6
View file @
6dab2645
...
@@ -198,6 +198,10 @@ class account_installer(osv.osv_memory):
...
@@ -198,6 +198,10 @@ class account_installer(osv.osv_memory):
new_account
=
obj_acc
.
create
(
cr
,
uid
,
vals
)
new_account
=
obj_acc
.
create
(
cr
,
uid
,
vals
)
acc_template_ref
[
account_template
.
id
]
=
new_account
acc_template_ref
[
account_template
.
id
]
=
new_account
if
account_template
.
name
==
'
Bank Current Account
'
:
if
account_template
.
name
==
'
Bank Current Account
'
:
view_id_cash
=
self
.
pool
.
get
(
'
account.journal.view
'
).
search
(
cr
,
uid
,[(
'
name
'
,
'
=
'
,
'
Cash Journal View
'
)])[
0
]
view_id_cur
=
self
.
pool
.
get
(
'
account.journal.view
'
).
search
(
cr
,
uid
,[(
'
name
'
,
'
=
'
,
'
Multi-Currency Cash Journal View
'
)])[
0
]
ref_acc_bank
=
obj_multi
.
bank_account_view_id
cash_result
=
mod_obj
.
_get_id
(
cr
,
uid
,
'
account
'
,
'
conf_account_type_cash
'
)
cash_result
=
mod_obj
.
_get_id
(
cr
,
uid
,
'
account
'
,
'
conf_account_type_cash
'
)
cash_type_id
=
mod_obj
.
read
(
cr
,
uid
,
[
cash_result
],
[
'
res_id
'
])[
0
][
'
res_id
'
]
cash_type_id
=
mod_obj
.
read
(
cr
,
uid
,
[
cash_result
],
[
'
res_id
'
])[
0
][
'
res_id
'
]
...
@@ -209,20 +213,62 @@ class account_installer(osv.osv_memory):
...
@@ -209,20 +213,62 @@ class account_installer(osv.osv_memory):
record
=
self
.
browse
(
cr
,
uid
,
ids
,
context
=
context
)[
0
]
record
=
self
.
browse
(
cr
,
uid
,
ids
,
context
=
context
)[
0
]
code_cnt
=
1
code_cnt
=
1
vals_seq
=
{
'
name
'
:
_
(
'
Bank Journal
'
),
'
code
'
:
'
account.journal
'
,
}
seq_id
=
obj_sequence
.
create
(
cr
,
uid
,
vals_seq
)
#create the bank journal
vals_journal
=
{}
vals_journal
[
'
name
'
]
=
_
(
'
Bank Journal
'
)
vals_journal
[
'
code
'
]
=
_
(
'
BNK
'
)
vals_journal
[
'
sequence_id
'
]
=
seq_id
vals_journal
[
'
type
'
]
=
'
cash
'
if
vals
.
get
(
'
currency_id
'
,
False
):
vals_journal
[
'
view_id
'
]
=
view_id_cur
vals_journal
[
'
currency
'
]
=
vals
.
get
(
'
currency_id
'
,
False
)
else
:
vals_journal
[
'
view_id
'
]
=
view_id_cash
vals_journal
[
'
default_credit_account_id
'
]
=
new_account
vals_journal
[
'
default_debit_account_id
'
]
=
new_account
obj_journal
.
create
(
cr
,
uid
,
vals_journal
)
for
val
in
record
.
bank_accounts_id
:
for
val
in
record
.
bank_accounts_id
:
if
val
.
account_type
==
'
cash
'
:
type
=
cash_type_id
if
val
.
account_type
==
'
cash
'
:
type
=
cash_type_id
elif
val
.
account_type
==
'
bank
'
:
type
=
bank_type_id
elif
val
.
account_type
==
'
bank
'
:
type
=
bank_type_id
else
:
type
=
check_type_id
else
:
type
=
check_type_id
vals
=
{
'
name
'
:
val
.
acc_name
or
''
,
vals
_bnk
=
{
'
name
'
:
val
.
acc_name
or
''
,
'
currency_id
'
:
val
.
currency_id
.
id
or
False
,
'
currency_id
'
:
val
.
currency_id
.
id
or
False
,
'
code
'
:
str
(
110400
+
code_cnt
),
'
code
'
:
str
(
110400
+
code_cnt
),
'
type
'
:
'
other
'
,
'
type
'
:
'
other
'
,
'
user_type
'
:
type
,
'
user_type
'
:
type
,
'
parent_id
'
:
new_account
,
'
parent_id
'
:
new_account
,
'
company_id
'
:
company_id
.
id
}
'
company_id
'
:
company_id
.
id
}
obj_acc
.
create
(
cr
,
uid
,
vals
)
child_bnk_acc
=
obj_acc
.
create
(
cr
,
uid
,
vals_bnk
)
vals_seq_child
=
{
'
name
'
:
_
(
vals_bnk
[
'
name
'
]),
'
code
'
:
'
account.journal
'
,
}
seq_id
=
obj_sequence
.
create
(
cr
,
uid
,
vals_seq_child
)
#create the bank journal
vals_journal
=
{}
vals_journal
[
'
name
'
]
=
vals_bnk
[
'
name
'
]
+
'
Journal
'
vals_journal
[
'
code
'
]
=
_
(
vals_bnk
[
'
name
'
][:
3
])
vals_journal
[
'
sequence_id
'
]
=
seq_id
vals_journal
[
'
type
'
]
=
'
cash
'
if
vals
.
get
(
'
currency_id
'
,
False
):
vals_journal
[
'
view_id
'
]
=
view_id_cur
vals_journal
[
'
currency
'
]
=
vals_bnk
.
get
(
'
currency_id
'
,
False
)
else
:
vals_journal
[
'
view_id
'
]
=
view_id_cash
vals_journal
[
'
default_credit_account_id
'
]
=
child_bnk_acc
vals_journal
[
'
default_debit_account_id
'
]
=
child_bnk_acc
obj_journal
.
create
(
cr
,
uid
,
vals_journal
)
code_cnt
+=
1
code_cnt
+=
1
#reactivate the parent_store functionnality on account_account
#reactivate the parent_store functionnality on account_account
self
.
pool
.
_init
=
False
self
.
pool
.
_init
=
False
self
.
pool
.
get
(
'
account.account
'
).
_parent_store_compute
(
cr
)
self
.
pool
.
get
(
'
account.account
'
).
_parent_store_compute
(
cr
)
...
@@ -341,6 +387,7 @@ class account_installer(osv.osv_memory):
...
@@ -341,6 +387,7 @@ class account_installer(osv.osv_memory):
def
execute
(
self
,
cr
,
uid
,
ids
,
context
=
None
):
def
execute
(
self
,
cr
,
uid
,
ids
,
context
=
None
):
super
(
account_installer
,
self
).
execute
(
cr
,
uid
,
ids
,
context
=
context
)
super
(
account_installer
,
self
).
execute
(
cr
,
uid
,
ids
,
context
=
context
)
record
=
self
.
browse
(
cr
,
uid
,
ids
,
context
=
context
)[
0
]
record
=
self
.
browse
(
cr
,
uid
,
ids
,
context
=
context
)[
0
]
company_id
=
self
.
pool
.
get
(
'
res.users
'
).
browse
(
cr
,
uid
,[
uid
],
context
)[
0
].
company_id
for
res
in
self
.
read
(
cr
,
uid
,
ids
):
for
res
in
self
.
read
(
cr
,
uid
,
ids
):
if
record
.
charts
==
'
configurable
'
:
if
record
.
charts
==
'
configurable
'
:
fp
=
tools
.
file_open
(
opj
(
'
account
'
,
'
configurable_account_chart.xml
'
))
fp
=
tools
.
file_open
(
opj
(
'
account
'
,
'
configurable_account_chart.xml
'
))
...
@@ -355,16 +402,36 @@ class account_installer(osv.osv_memory):
...
@@ -355,16 +402,36 @@ class account_installer(osv.osv_memory):
tax_val
=
{}
tax_val
=
{}
default_tax
=
[]
default_tax
=
[]
if
s_tax
*
100
>
0.0
:
if
s_tax
*
100
>
0.0
:
vals_tax_code
=
{
'
name
'
:
'
VAT%s%%
'
%
(
s_tax
*
100
),
'
code
'
:
'
VAT%s%%
'
%
(
s_tax
*
100
),
'
company_id
'
:
company_id
.
id
,
'
sign
'
:
1
,
}
new_tax_code
=
self
.
pool
.
get
(
'
account.tax.code
'
).
create
(
cr
,
uid
,
vals_tax_code
)
sales_tax
=
obj_tax
.
create
(
cr
,
uid
,
sales_tax
=
obj_tax
.
create
(
cr
,
uid
,
{
'
name
'
:
'
%s%%
'
%
(
s_tax
*
100
),
{
'
name
'
:
'
VAT%s%%
'
%
(
s_tax
*
100
),
'
amount
'
:
s_tax
'
description
'
:
'
VAT%s%%
'
%
(
s_tax
*
100
),
'
amount
'
:
s_tax
,
'
base_code_id
'
:
new_tax_code
,
'
tax_code_id
'
:
new_tax_code
})
})
tax_val
.
update
({
'
taxes_id
'
:[(
6
,
0
,[
sales_tax
])]})
tax_val
.
update
({
'
taxes_id
'
:[(
6
,
0
,[
sales_tax
])]})
default_tax
.
append
((
'
taxes_id
'
,
sales_tax
))
default_tax
.
append
((
'
taxes_id
'
,
sales_tax
))
if
p_tax
*
100
>
0.0
:
if
p_tax
*
100
>
0.0
:
vals_tax_code
=
{
'
name
'
:
'
VAT%s%%
'
%
(
p_tax
*
100
),
'
code
'
:
'
VAT%s%%
'
%
(
p_tax
*
100
),
'
company_id
'
:
company_id
.
id
,
'
sign
'
:
1
,
}
new_tax_code
=
self
.
pool
.
get
(
'
account.tax.code
'
).
create
(
cr
,
uid
,
vals_tax_code
)
purchase_tax
=
obj_tax
.
create
(
cr
,
uid
,
purchase_tax
=
obj_tax
.
create
(
cr
,
uid
,
{
'
name
'
:
'
%s%%
'
%
(
p_tax
*
100
),
{
'
name
'
:
'
VAT%s%%
'
%
(
p_tax
*
100
),
'
amount
'
:
p_tax
'
description
'
:
'
VAT%s%%
'
%
(
p_tax
*
100
),
'
amount
'
:
p_tax
,
'
base_code_id
'
:
new_tax_code
,
'
tax_code_id
'
:
new_tax_code
})
})
tax_val
.
update
({
'
supplier_taxes_id
'
:[(
6
,
0
,[
purchase_tax
])]})
tax_val
.
update
({
'
supplier_taxes_id
'
:[(
6
,
0
,[
purchase_tax
])]})
default_tax
.
append
((
'
supplier_taxes_id
'
,
purchase_tax
))
default_tax
.
append
((
'
supplier_taxes_id
'
,
purchase_tax
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment