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
caab9eae
Commit
caab9eae
authored
14 years ago
by
Harshad Modi
Browse files
Options
Downloads
Patches
Plain Diff
[REMERGE] stock: change product cost wizard
bzr revid: hmo@tinyerp.com-20100430150049-wxw84css10mkrm1n
parent
64af6d44
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/stock/wizard/stock_change_standard_price.py
+10
-62
10 additions, 62 deletions
addons/stock/wizard/stock_change_standard_price.py
with
10 additions
and
62 deletions
addons/stock/wizard/stock_change_standard_price.py
+
10
−
62
View file @
caab9eae
...
...
@@ -91,68 +91,16 @@ class change_standard_price(osv.osv_memory):
"""
rec_id
=
context
and
context
.
get
(
'
active_id
'
,
False
)
prod_obj
=
self
.
pool
.
get
(
'
product.template
'
)
location_obj
=
self
.
pool
.
get
(
'
stock.location
'
)
lot_obj
=
self
.
pool
.
get
(
'
stock.report.prodlots
'
)
move_obj
=
self
.
pool
.
get
(
'
account.move
'
)
move_line_obj
=
self
.
pool
.
get
(
'
account.move.line
'
)
data_obj
=
self
.
pool
.
get
(
'
ir.model.data
'
)
res
=
self
.
read
(
cr
,
uid
,
ids
[
0
],
[
'
new_price
'
])
new_price
=
res
.
get
(
'
new_price
'
,[])
data
=
prod_obj
.
browse
(
cr
,
uid
,
rec_id
)
diff
=
data
.
standard_price
-
new_price
prod_obj
.
write
(
cr
,
uid
,
rec_id
,
{
'
standard_price
'
:
new_price
})
loc_ids
=
location_obj
.
search
(
cr
,
uid
,
[(
'
account_id
'
,
'
<>
'
,
False
),(
'
usage
'
,
'
=
'
,
'
internal
'
)])
lot_ids
=
lot_obj
.
search
(
cr
,
uid
,
[(
'
location_id
'
,
'
in
'
,
loc_ids
),(
'
product_id
'
,
'
=
'
,
rec_id
)])
qty
=
0
debit
=
0.0
credit
=
0.0
stock_input_acc
=
data
.
property_stock_account_input
.
id
or
data
.
categ_id
.
property_stock_account_input_categ
.
id
stock_output_acc
=
data
.
property_stock_account_output
.
id
or
data
.
categ_id
.
property_stock_account_output_categ
.
id
for
lots
in
lot_obj
.
browse
(
cr
,
uid
,
lot_ids
):
qty
+=
lots
.
name
if
stock_input_acc
and
stock_output_acc
and
lot_ids
:
move_id
=
move_obj
.
create
(
cr
,
uid
,
{
'
journal_id
'
:
data
.
categ_id
.
property_stock_journal
.
id
})
if
diff
>
0
:
credit
=
qty
*
diff
move_line_obj
.
create
(
cr
,
uid
,
{
'
name
'
:
data
.
name
,
'
account_id
'
:
stock_input_acc
,
'
credit
'
:
credit
,
'
move_id
'
:
move_id
})
for
lots
in
lot_obj
.
browse
(
cr
,
uid
,
lot_ids
):
credit
=
lots
.
name
*
diff
move_line_obj
.
create
(
cr
,
uid
,
{
'
name
'
:
'
Expense
'
,
'
account_id
'
:
lots
.
location_id
.
account_id
.
id
,
'
debit
'
:
credit
,
'
move_id
'
:
move_id
})
elif
diff
<
0
:
debit
=
qty
*
-
diff
move_line_obj
.
create
(
cr
,
uid
,
{
'
name
'
:
data
.
name
,
'
account_id
'
:
stock_output_acc
,
'
debit
'
:
debit
,
'
move_id
'
:
move_id
})
for
lots
in
lot_obj
.
browse
(
cr
,
uid
,
lot_ids
):
debit
=
lots
.
name
*
-
diff
move_line_obj
.
create
(
cr
,
uid
,
{
'
name
'
:
'
Income
'
,
'
account_id
'
:
lots
.
location_id
.
account_id
.
id
,
'
credit
'
:
debit
,
'
move_id
'
:
move_id
})
else
:
raise
osv
.
except_osv
(
_
(
'
Warning!
'
),
_
(
'
No Change in Price.
'
))
else
:
pass
assert
rec_id
,
_
(
'
Active ID is not set in Context
'
)
prod_obj
=
self
.
pool
.
get
(
'
product.product
'
)
res
=
self
.
browse
(
cr
,
uid
,
ids
)
datas
=
{
'
new_price
'
:
res
[
0
].
new_price
,
'
stock_output_account
'
:
res
[
0
].
stock_account_output
.
id
,
'
stock_input_account
'
:
res
[
0
].
stock_account_input
.
id
,
'
stock_journal
'
:
res
[
0
].
stock_journal
.
id
}
prod_obj
.
do_change_standard_price
(
cr
,
uid
,
[
rec_id
],
datas
,
context
)
return
{}
change_standard_price
()
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