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
a10da2ab
Commit
a10da2ab
authored
10 years ago
by
Raphaël Valyi
Committed by
Martin Trigaux
10 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[FIX] mrp_repair: pass context in product_id_change calls
parent
3d908c33
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
addons/mrp_repair/mrp_repair.py
+6
-4
6 additions, 4 deletions
addons/mrp_repair/mrp_repair.py
addons/mrp_repair/mrp_repair_view.xml
+4
-4
4 additions, 4 deletions
addons/mrp_repair/mrp_repair_view.xml
with
10 additions
and
8 deletions
addons/mrp_repair/mrp_repair.py
+
6
−
4
View file @
a10da2ab
...
...
@@ -495,7 +495,7 @@ class mrp_repair(osv.osv):
class
ProductChangeMixin
(
object
):
def
product_id_change
(
self
,
cr
,
uid
,
ids
,
pricelist
,
product
,
uom
=
False
,
product_uom_qty
=
0
,
partner_id
=
False
,
guarantee_limit
=
False
):
product_uom_qty
=
0
,
partner_id
=
False
,
guarantee_limit
=
False
,
context
=
None
):
"""
On change of product it sets product quantity, tax account, name,
uom of product, unit price and price subtotal.
@param pricelist: Pricelist of current record.
...
...
@@ -508,16 +508,18 @@ class ProductChangeMixin(object):
"""
result
=
{}
warning
=
{}
ctx
=
context
and
context
.
copy
()
or
{}
ctx
[
'
uom
'
]
=
uom
if
not
product_uom_qty
:
product_uom_qty
=
1
result
[
'
product_uom_qty
'
]
=
product_uom_qty
if
product
:
product_obj
=
self
.
pool
.
get
(
'
product.product
'
).
browse
(
cr
,
uid
,
product
)
product_obj
=
self
.
pool
.
get
(
'
product.product
'
).
browse
(
cr
,
uid
,
product
,
context
=
ctx
)
if
partner_id
:
partner
=
self
.
pool
.
get
(
'
res.partner
'
).
browse
(
cr
,
uid
,
partner_id
)
result
[
'
tax_id
'
]
=
self
.
pool
.
get
(
'
account.fiscal.position
'
).
map_tax
(
cr
,
uid
,
partner
.
property_account_position
,
product_obj
.
taxes_id
)
result
[
'
tax_id
'
]
=
self
.
pool
.
get
(
'
account.fiscal.position
'
).
map_tax
(
cr
,
uid
,
partner
.
property_account_position
,
product_obj
.
taxes_id
,
context
=
ctx
)
result
[
'
name
'
]
=
product_obj
.
display_name
result
[
'
product_uom
'
]
=
product_obj
.
uom_id
and
product_obj
.
uom_id
.
id
or
False
...
...
@@ -530,7 +532,7 @@ class ProductChangeMixin(object):
}
else
:
price
=
self
.
pool
.
get
(
'
product.pricelist
'
).
price_get
(
cr
,
uid
,
[
pricelist
],
product
,
product_uom_qty
,
partner_id
,
{
'
uom
'
:
uom
}
)[
pricelist
]
product
,
product_uom_qty
,
partner_id
,
context
=
ctx
)[
pricelist
]
if
price
is
False
:
warning
=
{
...
...
This diff is collapsed.
Click to expand it.
addons/mrp_repair/mrp_repair_view.xml
+
4
−
4
View file @
a10da2ab
...
...
@@ -68,7 +68,7 @@
<page
string=
"Repair Line"
>
<group
col=
"4"
>
<field
name=
"name"
/>
<field
name=
"product_id"
on_change=
"product_id_change(parent.pricelist_id,product_id,product_uom,product_uom_qty, parent.partner_id)"
/>
<field
name=
"product_id"
on_change=
"product_id_change(parent.pricelist_id,
product_id,
product_uom,
product_uom_qty, parent.partner_id
, False, context
)"
/>
<label
for=
"product_uom_qty"
/>
<div>
<field
name=
"product_uom_qty"
class=
"oe_inline"
/>
...
...
@@ -94,7 +94,7 @@
</form>
<tree
string=
"Operations"
editable=
"bottom"
>
<field
name=
"type"
on_change=
"onchange_operation_type(type,parent.guarantee_limit,parent.company_id,context)"
/>
<field
name=
"product_id"
on_change=
"product_id_change(parent.pricelist_id,product_id,product_uom,product_uom_qty, parent.partner_id)"
/>
<field
name=
"product_id"
on_change=
"product_id_change(parent.pricelist_id,
product_id,
product_uom,
product_uom_qty, parent.partner_id
, False, context
)"
/>
<field
name=
'name'
/>
<field
name=
"lot_id"
domain=
"[('product_id', '=', product_id)]"
context=
"{'default_product_id': product_id}"
groups=
"stock.group_production_lot"
/>
<field
name=
"location_id"
groups=
"stock.group_locations"
/>
...
...
@@ -139,7 +139,7 @@
<group
string=
"Product Information"
>
<group>
<field
name=
"to_invoice"
/>
<field
name=
"product_id"
on_change=
"product_id_change(parent.pricelist_id,product_id,product_uom,product_uom_qty, parent.partner_id,parent.guarantee_limit)"
/>
<field
name=
"product_id"
on_change=
"product_id_change(parent.pricelist_id,
product_id,
product_uom,
product_uom_qty, parent.partner_id,
parent.guarantee_limit
, context
)"
/>
<label
for=
"product_uom_qty"
/>
<div>
<field
name=
"product_uom_qty"
string=
"Quantity"
class=
"oe_inline"
/>
...
...
@@ -162,7 +162,7 @@
</group>
</form>
<tree
string=
"Fees"
editable=
"bottom"
>
<field
name=
"product_id"
on_change=
"product_id_change(parent.pricelist_id,product_id,product_uom,product_uom_qty, parent.partner_id,parent.guarantee_limit)"
/>
<field
name=
"product_id"
on_change=
"product_id_change(parent.pricelist_id,
product_id,
product_uom,
product_uom_qty, parent.partner_id,parent.guarantee_limit
, context
)"
/>
<field
name=
'name'
/>
<field
name=
"product_uom_qty"
string=
"Quantity"
/>
<field
name=
"product_uom"
string=
"Unit of Measure"
groups=
"product.group_uom"
/>
...
...
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