[IMP] repair_picking: add dependency to repair_stock, and moving there common methods.

This commit is contained in:
DavidJForgeFlow
2024-08-28 09:27:00 +02:00
parent 1b254f8965
commit bca5ad8570
5 changed files with 7 additions and 56 deletions

View File

@@ -13,9 +13,9 @@ Repair Picking
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status :target: https://odoo-community.org/page/development-status
:alt: Beta :alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png .. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: LGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github
:target: https://github.com/OCA/manufacture/tree/14.0/repair_picking :target: https://github.com/OCA/manufacture/tree/14.0/repair_picking
:alt: OCA/manufacture :alt: OCA/manufacture

View File

@@ -3,18 +3,17 @@
{ {
"name": "Repair Picking", "name": "Repair Picking",
"version": "14.0.1.0.0", "version": "14.0.1.0.1",
"author": "ForgeFlow, Odoo Community Association (OCA)", "author": "ForgeFlow, Odoo Community Association (OCA)",
"category": "Repair", "category": "Repair",
"website": "https://github.com/OCA/manufacture", "website": "https://github.com/OCA/manufacture",
"summary": "Enhanced repair order management with pickings " "summary": "Enhanced repair order management with pickings "
"for adding and removing components", "for adding and removing components",
"depends": ["repair", "stock_move_forced_lot", "repair_stock_move"], "depends": ["stock_move_forced_lot", "repair_stock_move", "repair_stock"],
"data": [ "data": [
"views/stock_warehouse_views.xml", "views/stock_warehouse_views.xml",
"views/repair_order_view.xml",
], ],
"license": "LGPL-3", "license": "AGPL-3",
"installable": True, "installable": True,
"auto_install": False, "auto_install": False,
} }

View File

@@ -23,36 +23,10 @@ class RepairOrder(models.Model):
location_id = fields.Many2one( location_id = fields.Many2one(
default=_get_default_location_id, default=_get_default_location_id,
) )
picking_ids = fields.Many2many(
comodel_name="stock.picking",
compute="_compute_picking_ids",
copy=False,
string="Pickings associated to this repair order",
)
picking_count = fields.Integer(
string="Transfers", copy=False, compute="_compute_picking_ids"
)
procurement_group_id = fields.Many2one( procurement_group_id = fields.Many2one(
"procurement.group", "Procurement Group", copy=False "procurement.group", "Procurement Group", copy=False
) )
def action_view_pickings(self):
self.ensure_one()
action = self.env["ir.actions.actions"]._for_xml_id(
"stock.action_picking_tree_all"
)
action["domain"] = [("id", "in", self.picking_ids.ids)]
return action
def _compute_picking_ids(self):
for order in self:
moves = self.env["stock.move"].search(
[("repair_line_id", "in", order.operations.ids)]
)
order.picking_ids = moves.mapped("picking_id")
order.picking_count = len(moves.mapped("picking_id"))
def action_repair_cancel(self): def action_repair_cancel(self):
res = super().action_repair_cancel() res = super().action_repair_cancel()
for picking in self.picking_ids: for picking in self.picking_ids:

View File

@@ -368,7 +368,7 @@ ul.auto-toc {
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:576ed4d5c0c1e57002a5f0fbd364f753297c27ebe3e35595ae64c9cd000b216d !! source digest: sha256:576ed4d5c0c1e57002a5f0fbd364f753297c27ebe3e35595ae64c9cd000b216d
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/manufacture/tree/14.0/repair_picking"><img alt="OCA/manufacture" src="https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/manufacture-14-0/manufacture-14-0-repair_picking"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/manufacture&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p> <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/manufacture/tree/14.0/repair_picking"><img alt="OCA/manufacture" src="https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/manufacture-14-0/manufacture-14-0-repair_picking"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/manufacture&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module extends the repair management functionality in Odoo, providing additional <p>This module extends the repair management functionality in Odoo, providing additional
options for handling the repair process in a more customizable and efficient way. options for handling the repair process in a more customizable and efficient way.
It allows the configuration of repair steps based on specific business requirements It allows the configuration of repair steps based on specific business requirements

View File

@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_repair_order_form_repair_stock_move_inherited" model="ir.ui.view">
<field name="name">repair.order.form - repair_stock_move - custom</field>
<field name="model">repair.order</field>
<field name="inherit_id" ref="repair_stock_move.view_repair_order_form" />
<field name="arch" type="xml">
<xpath expr="//div[hasclass('oe_button_box')]" position="inside">
<button
name="action_view_pickings"
type="object"
class="oe_stat_button"
icon="fa-truck"
attrs="{'invisible': [('picking_count', '=', 0)]}"
help="Transfers associated with this repair order"
>
<field name="picking_count" widget="statinfo" string="Transfers" />
</button>
</xpath>
</field>
</record>
</odoo>