Skip to content

Commit 077e64d

Browse files
author
ilo
committed
[17.0][IMP] fieldservice_euipment_stock: add return order type
1 parent 15a55b6 commit 077e64d

File tree

9 files changed

+87
-7
lines changed

9 files changed

+87
-7
lines changed

fieldservice_equipment_stock/__manifest__.py

+2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
],
1616
"data": [
1717
"security/ir.model.access.csv",
18+
"data/fsm_order_type.xml",
1819
"views/fsm_equipment.xml",
20+
"views/fsm_order_type_view.xml",
1921
"views/product_template.xml",
2022
"views/stock_picking_type.xml",
2123
"views/stock_lot.xml",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<odoo noupdate="1">
3+
4+
<record id="fsm_order_type_return" model="fsm.order.type">
5+
<field name="name">Return</field>
6+
<field name="internal_type">return</field>
7+
</record>
8+
9+
</odoo>

fieldservice_equipment_stock/models/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
stock_move,
33
stock_picking_type,
44
fsm_equipment,
5+
fsm_order_type,
56
product_template,
67
stock_lot,
78
)

fieldservice_equipment_stock/models/fsm_equipment.py

+15
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,18 @@ def write(self, vals):
4444
if "lot_id" in vals:
4545
equipment.lot_id.fsm_equipment_id = equipment.id
4646
return res
47+
48+
def create_equip_order_return(self):
49+
order_type = self.env.ref("fieldservice_equipment_stock.fsm_order_type_return")
50+
return {
51+
"name": "Return Equipment",
52+
"type": "ir.actions.act_window",
53+
"res_model": "fsm.order",
54+
"view_mode": "form",
55+
"context": {
56+
"default_equipment_id": self.id,
57+
"default_order_type": order_type and order_type.id or False,
58+
"default_partner_id": self.partner_id.id,
59+
},
60+
"target": "new",
61+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2024 Camptocamp
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
7+
class FsmOrderType(models.Model):
8+
_inherit = "fsm.order.type"
9+
10+
internal_type = fields.Selection(
11+
selection_add=[("return", "Return")],
12+
)
13+
picking_type_id = fields.Many2one(
14+
domain=[("code", "=", "incoming")],
15+
)

fieldservice_equipment_stock/static/description/index.html

+4-7
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88

99
/*
1010
:Author: David Goodger (goodger@python.org)
11-
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
11+
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
1212
:Copyright: This stylesheet has been placed in the public domain.
1313
1414
Default cascading style sheet for the HTML output of Docutils.
15-
Despite the name, some widely supported CSS2 features are used.
1615
1716
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
1817
customize this style sheet.
@@ -275,7 +274,7 @@
275274
margin-left: 2em ;
276275
margin-right: 2em }
277276

278-
pre.code .ln { color: gray; } /* line numbers */
277+
pre.code .ln { color: grey; } /* line numbers */
279278
pre.code, code { background-color: #eeeeee }
280279
pre.code .comment, code .comment { color: #5C6576 }
281280
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
@@ -301,7 +300,7 @@
301300
span.pre {
302301
white-space: pre }
303302

304-
span.problematic, pre.problematic {
303+
span.problematic {
305304
color: red }
306305

307306
span.section-subtitle {
@@ -461,9 +460,7 @@ <h2><a class="toc-backref" href="#toc-entry-8">Other credits</a></h2>
461460
<div class="section" id="maintainers">
462461
<h2><a class="toc-backref" href="#toc-entry-9">Maintainers</a></h2>
463462
<p>This module is maintained by the OCA.</p>
464-
<a class="reference external image-reference" href="https://odoo-community.org">
465-
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
466-
</a>
463+
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
467464
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
468465
mission is to support the collaborative development of Odoo features and
469466
promote its widespread use.</p>

fieldservice_equipment_stock/views/fsm_equipment.xml

+9
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
<field name="model">fsm.equipment</field>
66
<field name="inherit_id" ref="fieldservice.fsm_equipment_form_view" />
77
<field name="arch" type="xml">
8+
<button id="previous_stage" position="before">
9+
<button
10+
id="new_equip_return"
11+
name="create_equip_order_return"
12+
string="Create Return"
13+
class="oe_highlight"
14+
type="object"
15+
/>
16+
</button>
817
<group id="secondary" position="inside">
918
<group string="Inventory" groups="stock.group_stock_user">
1019
<field name="product_id" required="1" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<odoo>
3+
4+
<!-- Fields Service Orders Form View -->
5+
<record id="fsm_order_type_form_view" model="ir.ui.view">
6+
<field name="model">fsm.order.type</field>
7+
<field name="inherit_id" ref="fieldservice.fsm_order_type_form_view" />
8+
<field name="arch" type="xml">
9+
<field name="internal_type" position="after">
10+
<field name="picking_type_id" invisible="internal_type != 'return'" />
11+
</field>
12+
</field>
13+
</record>
14+
15+
</odoo>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<odoo>
3+
4+
<!-- Fields Service Orders Form View -->
5+
<record id="fsm_order_maintenance_form" model="ir.ui.view">
6+
<field name="model">fsm.order</field>
7+
<field name="inherit_id" ref="fieldservice.fsm_order_form" />
8+
<field name="arch" type="xml">
9+
<field name="equipment_id" position="attributes">
10+
<attribute
11+
name="invisible"
12+
>internal_type not in ['repair', 'maintenance', 'return']</attribute>
13+
</field>
14+
</field>
15+
</record>
16+
17+
</odoo>

0 commit comments

Comments
 (0)