-
-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[17.0][ADD] repair_part_source_location #67
base: 17.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
=========================== | ||
Repair Part Source Location | ||
=========================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:0a591b44e4454e0e41aaa8151d862c9e74c728326f1ad0fa2554ccd0f4f0c0a0 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
|
||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Beta | ||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Frepair-lightgray.png?logo=github | ||
:target: https://github.com/OCA/repair/tree/17.0/repair_part_source_location | ||
:alt: OCA/repair | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/repair-17-0/repair-17-0-repair_part_source_location | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
:target: https://runboat.odoo-community.org/builds?repo=OCA/repair&target_branch=17.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
In a normal context when parts are added in a repair order, a stock move | ||
is created with source location got from the Operation Type. With this | ||
module, we can define a different source location. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Usage | ||
===== | ||
|
||
When creating or editing a repair order, you can set a source location | ||
for the parts that will be used in the repair order. This source | ||
location will be used when creating stock moves for the parts. If no | ||
part source location is set, the source location will be taken from the | ||
operation type, as usual. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/repair/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us to smash it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/repair/issues/new?body=module:%20repair_part_source_location%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
------- | ||
|
||
* Camptocamp SA | ||
* Italo Lopes | ||
|
||
Contributors | ||
------------ | ||
|
||
- `Camptocamp <https://camptocamp.com>`__: | ||
|
||
- Italo Lopes <[email protected]> | ||
|
||
Maintainers | ||
----------- | ||
|
||
This module is maintained by the OCA. | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use. | ||
|
||
.. |maintainer-imlopes| image:: https://github.com/imlopes.png?size=40px | ||
:target: https://github.com/imlopes | ||
:alt: imlopes | ||
|
||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-imlopes| | ||
|
||
This module is part of the `OCA/repair <https://github.com/OCA/repair/tree/17.0/repair_part_source_location>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from . import models |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright 2024 Camptocamp SA (https://www.camptocamp.com). | ||
# @author: Italo Lopes <[email protected]> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Repair Part Source Location", | ||
"version": "17.0.1.0.0", | ||
"category": "Repair", | ||
"website": "https://github.com/OCA/repair", | ||
"author": "Camptocamp SA, Italo Lopes, Odoo Community Association (OCA)", | ||
"maintainers": ["imlopes"], | ||
"license": "AGPL-3", | ||
"application": False, | ||
"installable": True, | ||
"depends": ["repair"], | ||
"data": ["views/repair_views.xml"], | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Copyright 2024 Camptocamp SA (https://www.camptocamp.com). | ||
# @author: Italo Lopes <[email protected]> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from . import repair | ||
from . import stock_move |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright 2024 Camptocamp SA (https://www.camptocamp.com). | ||
# @author: Italo Lopes <[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" | ||
|
||
parts_source_location_id = fields.Many2one( | ||
"stock.location", | ||
string="Repair part source location", | ||
) | ||
|
||
@api.onchange("picking_type_id") | ||
def _onchange_picking_type_id(self): | ||
if self.picking_type_id: | ||
self.parts_source_location_id = self.picking_type_id.default_location_src_id | ||
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,18 @@ | ||||||||||
# Copyright 2024 Camptocamp SA (https://www.camptocamp.com). | ||||||||||
# @author: Italo Lopes <[email protected]> | ||||||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||||||||||
|
||||||||||
from odoo import models | ||||||||||
|
||||||||||
from odoo.addons.repair.models.stock_move import ( | ||||||||||
MAP_REPAIR_LINE_TYPE_TO_MOVE_LOCATIONS_FROM_REPAIR, | ||||||||||
) | ||||||||||
|
||||||||||
MAP_REPAIR_LINE_TYPE_TO_MOVE_LOCATIONS_FROM_REPAIR["add"] = { | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have weird feelings about patching this. It seems this variable is only used in the I think it'd be much cleaner to do that instead |
||||||||||
"location_id": "parts_source_location_id", | ||||||||||
"location_dest_id": "location_dest_id", | ||||||||||
} | ||||||||||
|
||||||||||
|
||||||||||
class StockMove(models.Model): | ||||||||||
_inherit = "stock.move" | ||||||||||
Comment on lines
+15
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this ends up being empty like this, better to just remove it
Suggested change
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[build-system] | ||
requires = ["whool"] | ||
build-backend = "whool.buildapi" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
- [Camptocamp](https://camptocamp.com): | ||
|
||
> - Italo Lopes \<<[email protected]>\> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
In a normal context when parts are added in a repair order, a stock move is created with source | ||
location got from the Operation Type. | ||
With this module, we can define a different source location. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
When creating or editing a repair order, you can set a source location for the parts that will be used in the repair order. This source location will be used when creating stock moves for the parts. | ||
If no part source location is set, the source location will be taken from the operation type, as usual. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
<section class="oe_container"> | ||
<div class="oe_row oe_spaced"> | ||
<div class="oe_span12"> | ||
<h2 class="oe_slogan">Module name</h2> | ||
<p>This module was written to extend the functionality of ... to support ... and allow you to ...</p> | ||
</div> | ||
</div> | ||
</section> | ||
|
||
<section class="oe_container oe_dark"> | ||
<div class="oe_row oe_spaced"> | ||
<div class="oe_span12"> | ||
<h2 class="oe_slogan">Installation</h2> | ||
</div> | ||
<div class="oe_span6"> | ||
<p class="oe_mt32">To install this module, you need to: | ||
<ul> | ||
<li>...</li> | ||
</ul> | ||
</p> | ||
</div> | ||
<div class="oe_span6"> | ||
<div class="oe_demo oe_picture oe_screenshot"> | ||
<a href="https://www.odoo.com/saas_master/demo?lang=en_US&module=crm"> | ||
<img src="crm_sc_01.png"> | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
|
||
<section class="oe_container"> | ||
<div class="oe_row oe_spaced"> | ||
<div class="oe_span12"> | ||
<h2 class="oe_slogan">Configuration</h2> | ||
</div> | ||
<div class="oe_span6"> | ||
<p class="oe_mt32">To configure this module, you need to: | ||
<ul> | ||
<li>...</li> | ||
</ul> | ||
</p> | ||
</div> | ||
<div class="oe_span6"> | ||
<div class="oe_demo oe_picture oe_screenshot"> | ||
<a href="https://www.odoo.com/saas_master/demo?lang=en_US&module=crm"> | ||
<img src="crm_sc_01.png"> | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
|
||
<section class="oe_container oe_dark"> | ||
<div class="oe_row oe_spaced"> | ||
<div class="oe_span12"> | ||
<h2 class="oe_slogan">Usage</h2> | ||
</div> | ||
<div class="oe_span6"> | ||
<p class="oe_mt32">To use this module, you need to: | ||
<ul> | ||
<li>...</li> | ||
</ul> | ||
</p> | ||
<p class="oe_mt32">For further information, please visit: | ||
<ul> | ||
<li><a href="https://www.odoo.com/forum/help-1">https://www.odoo.com/forum/help-1</a></li> | ||
</ul> | ||
</p> | ||
</div> | ||
<div class="oe_span6"> | ||
<div class="oe_demo oe_picture oe_screenshot"> | ||
<a href="https://www.odoo.com/saas_master/demo?lang=en_US&module=crm"> | ||
<img src="crm_sc_01.png"> | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
|
||
<section class="oe_container"> | ||
<div class="oe_row oe_spaced"> | ||
<div class="oe_span12"> | ||
<h2 class="oe_slogan">Known issues / Roadmap</h2> | ||
</div> | ||
<div class="oe_span6"> | ||
<p class="oe_mt32"> | ||
<ul> | ||
<li>...</li> | ||
</ul> | ||
</p> | ||
</div> | ||
<div class="oe_span6"> | ||
<div class="oe_demo oe_picture oe_screenshot"> | ||
<a href="https://www.odoo.com/saas_master/demo?lang=en_US&module=crm"> | ||
<img src="crm_sc_01.png"> | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
|
||
<section class="oe_container oe_dark"> | ||
<div class="oe_row"> | ||
<div class="oe_span12"> | ||
<h2 class="oe_slogan">Credits</h2> | ||
</div> | ||
<div class="oe_span12"> | ||
<h3>Contributors</h3> | ||
<ul> | ||
<li>Firstname Lastname <<a href="mailto:[email protected]">[email protected]</a>></li> | ||
</ul> | ||
</div> | ||
<div class="oe_span12"> | ||
<h3>Maintainer</h3> | ||
<p> | ||
This module is maintained by the OCA.<br/> | ||
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.<br/> | ||
To contribute to this module, please visit <a href="http://odoo-community.org">http://odoo-community.org</a>.<br/> | ||
<a href="http://odoo-community.org"><img class="oe_picture oe_centered" src="http://odoo-community.org/logo.png"></a> | ||
</p> | ||
</div> | ||
</div> | ||
</section> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Copyright 2024 Camptocamp SA (https://www.camptocamp.com). | ||
# @author: Italo Lopes <[email protected]> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from . import test_repair_part_source_location |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Onchanges are being replaced by computed methods, whenever possible.
Could you change it to a computed field, just like the other fields in this model. E.g.:
https://github.com/odoo/odoo/blob/8762a79186352890225ade787141503f84f2c2c0/addons/repair/models/repair.py#L101-L106
https://github.com/odoo/odoo/blob/8762a79186352890225ade787141503f84f2c2c0/addons/repair/models/repair.py#L202-L210