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
6e6e8f1c
Unverified
Commit
6e6e8f1c
authored
7 years ago
by
Pratima Gupta
Committed by
Joren Van Onder
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[IMP] mrp_repair: require lot immediately when creating repair lines
Instead of only checking when actually confirming the repair.
parent
578ebc6f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
addons/mrp_repair/models/mrp_repair.py
+6
-3
6 additions, 3 deletions
addons/mrp_repair/models/mrp_repair.py
addons/mrp_repair/views/mrp_repair_views.xml
+2
-1
2 additions, 1 deletion
addons/mrp_repair/views/mrp_repair_views.xml
with
8 additions
and
4 deletions
addons/mrp_repair/models/mrp_repair.py
+
6
−
3
View file @
6e6e8f1c
...
...
@@ -116,6 +116,7 @@ class Repair(models.Model):
amount_untaxed
=
fields
.
Float
(
'
Untaxed Amount
'
,
compute
=
'
_amount_untaxed
'
,
store
=
True
)
amount_tax
=
fields
.
Float
(
'
Taxes
'
,
compute
=
'
_amount_tax
'
,
store
=
True
)
amount_total
=
fields
.
Float
(
'
Total
'
,
compute
=
'
_amount_total
'
,
store
=
True
)
tracking
=
fields
.
Selection
(
'
Product Tracking
'
,
related
=
"
product_id.tracking
"
)
@api.one
@api.depends
(
'
partner_id
'
)
...
...
@@ -215,9 +216,6 @@ class Repair(models.Model):
before_repair
.
write
({
'
state
'
:
'
2binvoiced
'
})
to_confirm
=
self
-
before_repair
to_confirm_operations
=
to_confirm
.
mapped
(
'
operations
'
)
for
operation
in
to_confirm_operations
:
if
operation
.
product_id
.
tracking
!=
'
none
'
and
not
operation
.
lot_id
:
raise
UserError
(
_
(
"
Serial number is required for operation line with product
'
%s
'"
)
%
(
operation
.
product_id
.
name
))
to_confirm_operations
.
write
({
'
state
'
:
'
confirmed
'
})
to_confirm
.
write
({
'
state
'
:
'
confirmed
'
})
return
True
...
...
@@ -513,6 +511,11 @@ class RepairLine(models.Model):
copy
=
False
,
readonly
=
True
,
required
=
True
,
help
=
'
The status of a repair line is set automatically to the one of the linked repair order.
'
)
@api.constrains
(
'
lot_id
'
,
'
product_id
'
)
def
constrain_lot_id
(
self
):
for
line
in
self
.
filtered
(
lambda
x
:
x
.
product_id
.
tracking
!=
'
none
'
and
not
x
.
lot_id
):
raise
ValidationError
(
_
(
"
Serial number is required for operation line with product
'
%s
'"
)
%
(
line
.
product_id
.
name
))
@api.one
@api.depends
(
'
price_unit
'
,
'
repair_id
'
,
'
product_uom_qty
'
,
'
product_id
'
,
'
repair_id.invoice_method
'
)
def
_compute_price_subtotal
(
self
):
...
...
This diff is collapsed.
Click to expand it.
addons/mrp_repair/views/mrp_repair_views.xml
+
2
−
1
View file @
6e6e8f1c
...
...
@@ -52,13 +52,14 @@
</h1>
<group>
<group>
<field
name=
"tracking"
invisible=
"1"
/>
<field
name=
"product_id"
domain=
"[('type', 'in', ['product', 'consu'])]"
/>
<label
for=
"product_qty"
/>
<div
class=
"o_row"
>
<field
name=
"product_qty"
/>
<field
name=
"product_uom"
groups=
"product.group_uom"
/>
</div>
<field
name=
"lot_id"
domain=
"[('product_id', '=', product_id)]"
context=
"{'default_product_id': product_id}"
groups=
"stock.group_production_lot"
/>
<field
name=
"lot_id"
domain=
"[('product_id', '=', product_id)]"
context=
"{'default_product_id': product_id}"
groups=
"stock.group_production_lot"
attrs=
"{'required': [('tracking', '!=', 'none')]}"
/>
<field
name=
"partner_id"
attrs=
"{'required':[('invoice_method','!=','none')]}"
/>
<field
name=
"address_id"
groups=
"sale.group_delivery_invoice_address"
/>
</group>
...
...
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