-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] repair_type: Remove duplicated destination location for added p…
…arts and add product destination location
- Loading branch information
Showing
9 changed files
with
189 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from . import repair | ||
from . import stock_move | ||
from . import stock_picking_type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright 2024 Patryk Pyczko (APSL-Nagarro)<[email protected]> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class RepairOrder(models.Model): | ||
_inherit = "repair.order" | ||
|
||
product_location_dest_id = fields.Many2one( | ||
"stock.location", | ||
"Product Destination Location", | ||
compute="_compute_product_location_dest_id", | ||
store=True, | ||
readonly=False, | ||
required=True, | ||
precompute=True, | ||
index=True, | ||
check_company=True, | ||
help="This is the location where the repaired product will be stored.", | ||
) | ||
|
||
@api.depends("picking_type_id") | ||
def _compute_product_location_dest_id(self): | ||
for repair in self: | ||
repair.product_location_dest_id = ( | ||
repair.picking_type_id.default_product_location_dest_id | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<record id="repair_type_view_repair_order_tree_inherit" model="ir.ui.view"> | ||
<field name="name">repair.type.repair.order.tree.inherit</field> | ||
<field name="model">repair.order</field> | ||
<field name="inherit_id" ref="repair.view_repair_order_tree" /> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//field[@name='location_id']" position="after"> | ||
<field name="product_location_dest_id" optional="hide" /> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
<record id="repair_type_view_repair_order_form_inherit" model="ir.ui.view"> | ||
<field name="name">repair.type.repair.order.form.inherit</field> | ||
<field name="model">repair.order</field> | ||
<field name="inherit_id" ref="repair.view_repair_order_form" /> | ||
<field name="arch" type="xml"> | ||
<xpath | ||
expr="//group[@name='locations']/field[@name='location_id']" | ||
position="after" | ||
> | ||
<field | ||
name="product_location_dest_id" | ||
readonly="state != 'draft'" | ||
options="{'no_create': True}" | ||
/> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |
Oops, something went wrong.