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
7a69b329
Commit
7a69b329
authored
10 years ago
by
Josse Colpaert
Browse files
Options
Downloads
Patches
Plain Diff
[FIX] Basic patches for product_extended
parent
0f9a9fba
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
addons/product_extended/product_extended.py
+13
-12
13 additions, 12 deletions
addons/product_extended/product_extended.py
with
13 additions
and
12 deletions
addons/product_extended/product_extended.py
+
13
−
12
View file @
7a69b329
...
...
@@ -36,15 +36,15 @@ class product_product(osv.osv):
testdict
=
{}
for
prod_id
in
ids
:
bom_obj
=
self
.
pool
.
get
(
'
mrp.bom
'
)
bom_ids
=
bom_obj
.
search
(
cr
,
uid
,
[(
'
product_id
'
,
'
=
'
,
prod_id
),
(
'
bom_line_ids
'
,
'
!=
'
,
False
)],
context
=
context
)
if
bom_ids
:
bom_id
=
bom_ids
[
0
]
bom_id
=
bom_obj
.
_bom_find
(
cr
,
uid
,
False
,
product_id
=
prod_id
,
context
=
context
)
if
bom_id
:
# In recursive mode, it will first compute the prices of child boms
if
recursive
:
#Search the products that are components of this bom of prod_id
boms
=
bom_obj
.
search
(
cr
,
uid
,
[(
'
bom_id
'
,
'
=
'
,
bom_id
)],
context
=
context
)
bom
=
bom_obj
.
browse
(
cr
,
uid
,
bom_id
,
context
=
context
)
#Call compute_price on these subproducts
prod_set
=
set
([
x
.
product_id
.
id
for
x
in
bom
_obj
.
browse
(
cr
,
uid
,
boms
,
context
=
context
)
])
prod_set
=
set
([
x
.
product_id
.
id
for
x
in
bom
.
bom_line_ids
])
res
=
self
.
compute_price
(
cr
,
uid
,
list
(
prod_set
),
recursive
=
recursive
,
test
=
test
,
real_time_accounting
=
real_time_accounting
,
context
=
context
)
if
test
:
testdict
.
update
(
res
)
...
...
@@ -63,10 +63,10 @@ class product_product(osv.osv):
context
=
{}
price
=
0
uom_obj
=
self
.
pool
.
get
(
"
product.uom
"
)
if
bom
.
bom_line_ids
:
for
sbom
in
bom
.
bom_line_ids
:
my_qty
=
sbom
.
bom_line_ids
and
1.0
or
sbom
.
product_qty
price
+=
uom_obj
.
_compute_price
(
cr
,
uid
,
sbom
.
product_id
.
uom_id
.
id
,
sbom
.
product_id
.
standard_price
,
sbom
.
product_uom
.
id
)
*
my_qty
tmpl_obj
=
self
.
pool
.
get
(
'
product.template
'
)
for
sbom
in
bom
.
bom_line_ids
:
my_qty
=
sbom
.
product_qty
price
+=
uom_obj
.
_compute_price
(
cr
,
uid
,
sbom
.
product_id
.
uom_id
.
id
,
sbom
.
product_id
.
standard_price
,
sbom
.
product_uom
.
id
)
*
my_qty
if
bom
.
routing_id
:
for
wline
in
bom
.
routing_id
.
workcenter_lines
:
...
...
@@ -79,15 +79,16 @@ class product_product(osv.osv):
#Convert on product UoM quantities
if
price
>
0
:
price
=
uom_obj
.
_compute_price
(
cr
,
uid
,
bom
.
product_uom
.
id
,
price
/
bom
.
product_qty
,
bom
.
product_id
.
uom_id
.
id
)
product
=
self
.
pool
.
get
(
"
product.product
"
).
browse
(
cr
,
uid
,
bom
.
product_id
.
id
,
context
=
context
)
product
=
tmpl_obj
.
browse
(
cr
,
uid
,
bom
.
product_tmpl_id
.
id
,
context
=
context
)
if
not
test
:
if
(
product
.
valuation
!=
"
real_time
"
or
not
real_time_accounting
):
self
.
write
(
cr
,
uid
,
[
bom
.
product
_id
.
id
],
{
'
standard_price
'
:
price
},
context
=
context
)
tmpl_obj
.
write
(
cr
,
uid
,
[
product
.
id
],
{
'
standard_price
'
:
price
},
context
=
context
)
else
:
#Call wizard function here
wizard_obj
=
self
.
pool
.
get
(
"
stock.change.standard.price
"
)
ctx
=
context
.
copy
()
ctx
.
update
({
'
active_id
'
:
bom
.
product
_
id
.
id
})
ctx
.
update
({
'
active_id
'
:
product
.
id
,
'
active_model
'
:
'
product.template
'
})
wiz_id
=
wizard_obj
.
create
(
cr
,
uid
,
{
'
new_price
'
:
price
},
context
=
ctx
)
wizard_obj
.
change_price
(
cr
,
uid
,
[
wiz_id
],
context
=
ctx
)
return
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