Skip to content

Commit

Permalink
Merge PR #53 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by LoisRForgeFlow
  • Loading branch information
OCA-git-bot committed Aug 29, 2024
2 parents 72fbcfd + 66e520e commit 751380f
Show file tree
Hide file tree
Showing 20 changed files with 734 additions and 35 deletions.
4 changes: 2 additions & 2 deletions repair_picking_after_done/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

{
"name": "Repair picking after done",
"version": "16.0.1.0.1",
"version": "16.0.1.0.2",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/repair",
"summary": "Transfer repaired move to another location directly from repaire order",
"category": "Repair",
"depends": ["repair_type"],
"depends": ["repair_type", "repair_stock"],
"data": [
"security/ir.model.access.csv",
"views/repair.xml",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright 2024 ForgeFlow, S.L.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).


def migrate(env, version):
repairs = env["repair.order"].search([])
for repair in repairs:
repair.picking_ids.move_ids.write({"repair_id": repair.id})
17 changes: 1 addition & 16 deletions repair_picking_after_done/models/repair.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Copyright (C) 2022 ForgeFlow S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)

from odoo import _, fields, models
from odoo import fields, models


class Repair(models.Model):
_inherit = "repair.order"

picking_ids = fields.Many2many("stock.picking", string="Transfers", copy=False)
remaining_quantity = fields.Float(
"Remaining quantity to be transferred", compute="_compute_remaining_quantity"
)
Expand Down Expand Up @@ -38,17 +37,3 @@ def action_transfer_done_moves(self):
},
"target": "new",
}

def action_open_transfers(self):
self.ensure_one()
domain = [("id", "in", self.picking_ids.ids)]
action = {
"name": _("Transfers"),
"view_type": "tree",
"view_mode": "list,form",
"res_model": "stock.picking",
"type": "ir.actions.act_window",
"context": self.env.context,
"domain": domain,
}
return action
1 change: 0 additions & 1 deletion repair_picking_after_done/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand Down
16 changes: 1 addition & 15 deletions repair_picking_after_done/views/repair.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,14 @@
<field name="inherit_id" ref="repair.view_repair_order_form" />
<field name="arch" type="xml">
<header position="inside">
<field name="remaining_quantity" invisible="1" />
<button
name="action_transfer_done_moves"
string="Create Transfer"
type="object"
attrs="{'invisible': ['|', ('state','!=', 'done'), ('remaining_quantity', '=', 0)]}"
/>
</header>
<xpath expr="//div[hasclass('oe_button_box')]" position="inside">
<field name="remaining_quantity" invisible="1" />
<field name="picking_ids" invisible="1" />
<button
name="action_open_transfers"
type="object"
class="oe_stat_button"
icon="fa-truck"
attrs="{'invisible': [('picking_ids', '=', False)]}"
>
<div class="o_field_widget o_stat_info">
<span class="o_stat_text">Transfers</span>
</div>
</button>
</xpath>
</field>
</record>
</odoo>
3 changes: 2 additions & 1 deletion repair_picking_after_done/wizards/repair_move_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def _prepare_stock_move_vals(self, picking):
"picking_type_id": self._get_picking_type().id,
"product_uom_qty": self.quantity,
"product_uom": self.repair_order_id.move_id.product_uom.id,
"repair_id": self.repair_order_id.id,
}

def action_create_transfer(self):
Expand All @@ -69,4 +70,4 @@ def action_create_transfer(self):
stock_move.move_line_ids[0].write(
{"lot_id": self.repair_order_id.lot_id.id}
)
self.repair_order_id.write({"picking_ids": [(4, picking.id)]})
self.repair_order_id._compute_picking_ids()
78 changes: 78 additions & 0 deletions repair_stock/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
============
Repair Stock
============

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:576ed4d5c0c1e57002a5f0fbd364f753297c27ebe3e35595ae64c9cd000b216d
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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/16.0/repair_stock
:alt: OCA/repair
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/repair-16-0/repair-16-0-repair_stock
: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=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module acts as a base for the stock related modules for repairs.
It adds some common features that may be overriding between them,
as the compute for the pickings or the smart button for the transfers.

**Table of contents**

.. contents::
:local:

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_stock%0Aversion:%2016.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
~~~~~~~

* ForgeFlow

Contributors
~~~~~~~~~~~~

* David Jimenez <[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.

This module is part of the `OCA/repair <https://github.com/OCA/repair/tree/16.0/repair_stock>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions repair_stock/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
16 changes: 16 additions & 0 deletions repair_stock/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2024 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

{
"name": "Repair Stock",
"version": "16.0.1.0.0",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"category": "Repair",
"website": "https://github.com/OCA/repair",
"depends": ["repair_stock_move"],
"data": [
"views/repair_order_view.xml",
],
"license": "AGPL-3",
"development_status": "Alpha",
}
3 changes: 3 additions & 0 deletions repair_stock/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright 2024 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import repair
38 changes: 38 additions & 0 deletions repair_stock/models/repair.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright 2024 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import fields, models


class RepairOrder(models.Model):
_inherit = "repair.order"

picking_ids = fields.Many2many(
comodel_name="stock.picking",
compute="_compute_picking_ids",
copy=False,
string="Transfers",
)
picking_count = fields.Integer(
string="Transfers", copy=False, compute="_compute_picking_ids"
)

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_id", "=", order.id),
("repair_line_id", "in", order.operations.ids),
]
)
order.picking_ids = moves.mapped("picking_id")
order.picking_count = len(moves.mapped("picking_id"))
1 change: 1 addition & 0 deletions repair_stock/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* David Jimenez <[email protected]>
3 changes: 3 additions & 0 deletions repair_stock/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This module acts as a base for the stock related modules for repairs.
It adds some common features that may be overriding between them,
as the compute for the pickings or the smart button for the transfers.
Binary file added repair_stock/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 751380f

Please sign in to comment.