odoo-addon-maintenance-purchase 16.0.1.0.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,77 @@
1
+ ====================
2
+ Maintenance Purchase
3
+ ====================
4
+
5
+ ..
6
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7
+ !! This file is generated by oca-gen-addon-readme !!
8
+ !! changes will be overwritten. !!
9
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10
+ !! source digest: sha256:9b4e0b44d941b38aadf91a2912f84cf907a7e32f5e5573d36779fd044fa0f7f9
11
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12
+
13
+ .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14
+ :target: https://odoo-community.org/page/development-status
15
+ :alt: Beta
16
+ .. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17
+ :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18
+ :alt: License: AGPL-3
19
+ .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmaintenance-lightgray.png?logo=github
20
+ :target: https://github.com/OCA/maintenance/tree/16.0/maintenance_purchase
21
+ :alt: OCA/maintenance
22
+ .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23
+ :target: https://translation.odoo-community.org/projects/maintenance-16-0/maintenance-16-0-maintenance_purchase
24
+ :alt: Translate me on Weblate
25
+ .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26
+ :target: https://runboat.odoo-community.org/builds?repo=OCA/maintenance&target_branch=16.0
27
+ :alt: Try me on Runboat
28
+
29
+ |badge1| |badge2| |badge3| |badge4| |badge5|
30
+
31
+ Create Equipments when the purchase is validated.
32
+
33
+ **Table of contents**
34
+
35
+ .. contents::
36
+ :local:
37
+
38
+ Bug Tracker
39
+ ===========
40
+
41
+ Bugs are tracked on `GitHub Issues <https://github.com/OCA/maintenance/issues>`_.
42
+ In case of trouble, please check there if your issue has already been reported.
43
+ If you spotted it first, help us to smash it by providing a detailed and welcomed
44
+ `feedback <https://github.com/OCA/maintenance/issues/new?body=module:%20maintenance_purchase%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
45
+
46
+ Do not contact contributors directly about support or help with technical issues.
47
+
48
+ Credits
49
+ =======
50
+
51
+ Authors
52
+ ~~~~~~~
53
+
54
+ * CreuBlanca
55
+
56
+ Contributors
57
+ ~~~~~~~~~~~~
58
+
59
+ * Enric Tobella
60
+ * Laurent Stukkens
61
+
62
+ Maintainers
63
+ ~~~~~~~~~~~
64
+
65
+ This module is maintained by the OCA.
66
+
67
+ .. image:: https://odoo-community.org/logo.png
68
+ :alt: Odoo Community Association
69
+ :target: https://odoo-community.org
70
+
71
+ OCA, or the Odoo Community Association, is a nonprofit organization whose
72
+ mission is to support the collaborative development of Odoo features and
73
+ promote its widespread use.
74
+
75
+ This module is part of the `OCA/maintenance <https://github.com/OCA/maintenance/tree/16.0/maintenance_purchase>`_ project on GitHub.
76
+
77
+ You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
@@ -0,0 +1 @@
1
+ from . import models
@@ -0,0 +1,21 @@
1
+ # Copyright 2022 CreuBlanca
2
+ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3
+
4
+ {
5
+ "name": "Maintenance Purchase",
6
+ "summary": """
7
+ Create Equipments with purchases""",
8
+ "version": "16.0.1.0.0",
9
+ "license": "AGPL-3",
10
+ "author": "CreuBlanca,Odoo Community Association (OCA)",
11
+ "website": "https://github.com/OCA/maintenance",
12
+ "depends": [
13
+ "maintenance_account",
14
+ "purchase_stock",
15
+ ],
16
+ "data": [
17
+ "views/purchase_order.xml",
18
+ "views/maintenance_equipment.xml",
19
+ ],
20
+ "demo": [],
21
+ }
@@ -0,0 +1,84 @@
1
+ # Translation of Odoo Server.
2
+ # This file contains the translation of the following modules:
3
+ # * maintenance_purchase
4
+ #
5
+ msgid ""
6
+ msgstr ""
7
+ "Project-Id-Version: Odoo Server 14.0\n"
8
+ "Report-Msgid-Bugs-To: \n"
9
+ "PO-Revision-Date: 2023-12-28 12:33+0000\n"
10
+ "Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
11
+ "Language-Team: none\n"
12
+ "Language: es\n"
13
+ "MIME-Version: 1.0\n"
14
+ "Content-Type: text/plain; charset=UTF-8\n"
15
+ "Content-Transfer-Encoding: \n"
16
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
17
+ "X-Generator: Weblate 4.17\n"
18
+
19
+ #. module: maintenance_purchase
20
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_maintenance_equipment__display_name
21
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_purchase_order__display_name
22
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_purchase_order_line__display_name
23
+ msgid "Display Name"
24
+ msgstr "Mostrar Nombre"
25
+
26
+ #. module: maintenance_purchase
27
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_purchase_order_line__equipment_category_id
28
+ msgid "Equipment Category"
29
+ msgstr "Categoría de Equipo"
30
+
31
+ #. module: maintenance_purchase
32
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_purchase_order__equipment_count
33
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_purchase_order_line__equipment_count
34
+ msgid "Equipment Count"
35
+ msgstr "Total de Equipos"
36
+
37
+ #. module: maintenance_purchase
38
+ #: model_terms:ir.ui.view,arch_db:maintenance_purchase.purchase_order_form_view
39
+ msgid "Equipment(s)"
40
+ msgstr "Equipamiento(s)"
41
+
42
+ #. module: maintenance_purchase
43
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_purchase_order_line__equipment_ids
44
+ msgid "Equipments"
45
+ msgstr "Equipamientos"
46
+
47
+ #. module: maintenance_purchase
48
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_maintenance_equipment__id
49
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_purchase_order__id
50
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_purchase_order_line__id
51
+ msgid "ID"
52
+ msgstr "ID (identificación)"
53
+
54
+ #. module: maintenance_purchase
55
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_maintenance_equipment____last_update
56
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_purchase_order____last_update
57
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_purchase_order_line____last_update
58
+ msgid "Last Modified on"
59
+ msgstr "Última Modificación el"
60
+
61
+ #. module: maintenance_purchase
62
+ #: model:ir.model,name:maintenance_purchase.model_maintenance_equipment
63
+ msgid "Maintenance Equipment"
64
+ msgstr "Mantenimiento de Equipos"
65
+
66
+ #. module: maintenance_purchase
67
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_maintenance_equipment__purchase_id
68
+ msgid "Purchase"
69
+ msgstr "Compra"
70
+
71
+ #. module: maintenance_purchase
72
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_maintenance_equipment__purchase_line_id
73
+ msgid "Purchase Line"
74
+ msgstr "Línea de Compra"
75
+
76
+ #. module: maintenance_purchase
77
+ #: model:ir.model,name:maintenance_purchase.model_purchase_order
78
+ msgid "Purchase Order"
79
+ msgstr "Orden de Compra"
80
+
81
+ #. module: maintenance_purchase
82
+ #: model:ir.model,name:maintenance_purchase.model_purchase_order_line
83
+ msgid "Purchase Order Line"
84
+ msgstr "Línea de Orden de Compra"
@@ -0,0 +1,84 @@
1
+ # Translation of Odoo Server.
2
+ # This file contains the translation of the following modules:
3
+ # * maintenance_purchase
4
+ #
5
+ msgid ""
6
+ msgstr ""
7
+ "Project-Id-Version: Odoo Server 14.0\n"
8
+ "Report-Msgid-Bugs-To: \n"
9
+ "PO-Revision-Date: 2024-03-05 15:35+0000\n"
10
+ "Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
11
+ "Language-Team: none\n"
12
+ "Language: it\n"
13
+ "MIME-Version: 1.0\n"
14
+ "Content-Type: text/plain; charset=UTF-8\n"
15
+ "Content-Transfer-Encoding: \n"
16
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
17
+ "X-Generator: Weblate 4.17\n"
18
+
19
+ #. module: maintenance_purchase
20
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_maintenance_equipment__display_name
21
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_purchase_order__display_name
22
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_purchase_order_line__display_name
23
+ msgid "Display Name"
24
+ msgstr "Nome visualizzato"
25
+
26
+ #. module: maintenance_purchase
27
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_purchase_order_line__equipment_category_id
28
+ msgid "Equipment Category"
29
+ msgstr "Categoria attrezzatura"
30
+
31
+ #. module: maintenance_purchase
32
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_purchase_order__equipment_count
33
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_purchase_order_line__equipment_count
34
+ msgid "Equipment Count"
35
+ msgstr "Conteggio attrezzature"
36
+
37
+ #. module: maintenance_purchase
38
+ #: model_terms:ir.ui.view,arch_db:maintenance_purchase.purchase_order_form_view
39
+ msgid "Equipment(s)"
40
+ msgstr "Attrezzatura(e)"
41
+
42
+ #. module: maintenance_purchase
43
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_purchase_order_line__equipment_ids
44
+ msgid "Equipments"
45
+ msgstr "Attrezzature"
46
+
47
+ #. module: maintenance_purchase
48
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_maintenance_equipment__id
49
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_purchase_order__id
50
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_purchase_order_line__id
51
+ msgid "ID"
52
+ msgstr "ID"
53
+
54
+ #. module: maintenance_purchase
55
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_maintenance_equipment____last_update
56
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_purchase_order____last_update
57
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_purchase_order_line____last_update
58
+ msgid "Last Modified on"
59
+ msgstr "Ultima modifica il"
60
+
61
+ #. module: maintenance_purchase
62
+ #: model:ir.model,name:maintenance_purchase.model_maintenance_equipment
63
+ msgid "Maintenance Equipment"
64
+ msgstr "Attrezzatura manutenzione"
65
+
66
+ #. module: maintenance_purchase
67
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_maintenance_equipment__purchase_id
68
+ msgid "Purchase"
69
+ msgstr "Acquisto"
70
+
71
+ #. module: maintenance_purchase
72
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_maintenance_equipment__purchase_line_id
73
+ msgid "Purchase Line"
74
+ msgstr "Riga acquisto"
75
+
76
+ #. module: maintenance_purchase
77
+ #: model:ir.model,name:maintenance_purchase.model_purchase_order
78
+ msgid "Purchase Order"
79
+ msgstr "Ordine di acquisto"
80
+
81
+ #. module: maintenance_purchase
82
+ #: model:ir.model,name:maintenance_purchase.model_purchase_order_line
83
+ msgid "Purchase Order Line"
84
+ msgstr "Riga ordine di acquisto"
@@ -0,0 +1,60 @@
1
+ # Translation of Odoo Server.
2
+ # This file contains the translation of the following modules:
3
+ # * maintenance_purchase
4
+ #
5
+ msgid ""
6
+ msgstr ""
7
+ "Project-Id-Version: Odoo Server 16.0\n"
8
+ "Report-Msgid-Bugs-To: \n"
9
+ "Last-Translator: \n"
10
+ "Language-Team: \n"
11
+ "MIME-Version: 1.0\n"
12
+ "Content-Type: text/plain; charset=UTF-8\n"
13
+ "Content-Transfer-Encoding: \n"
14
+ "Plural-Forms: \n"
15
+
16
+ #. module: maintenance_purchase
17
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_purchase_order_line__equipment_category_id
18
+ msgid "Equipment Category"
19
+ msgstr ""
20
+
21
+ #. module: maintenance_purchase
22
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_purchase_order__equipment_count
23
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_purchase_order_line__equipment_count
24
+ msgid "Equipment Count"
25
+ msgstr ""
26
+
27
+ #. module: maintenance_purchase
28
+ #: model_terms:ir.ui.view,arch_db:maintenance_purchase.purchase_order_form_view
29
+ msgid "Equipment(s)"
30
+ msgstr ""
31
+
32
+ #. module: maintenance_purchase
33
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_purchase_order_line__equipment_ids
34
+ msgid "Equipments"
35
+ msgstr ""
36
+
37
+ #. module: maintenance_purchase
38
+ #: model:ir.model,name:maintenance_purchase.model_maintenance_equipment
39
+ msgid "Maintenance Equipment"
40
+ msgstr ""
41
+
42
+ #. module: maintenance_purchase
43
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_maintenance_equipment__purchase_id
44
+ msgid "Purchase"
45
+ msgstr ""
46
+
47
+ #. module: maintenance_purchase
48
+ #: model:ir.model.fields,field_description:maintenance_purchase.field_maintenance_equipment__purchase_line_id
49
+ msgid "Purchase Line"
50
+ msgstr ""
51
+
52
+ #. module: maintenance_purchase
53
+ #: model:ir.model,name:maintenance_purchase.model_purchase_order
54
+ msgid "Purchase Order"
55
+ msgstr ""
56
+
57
+ #. module: maintenance_purchase
58
+ #: model:ir.model,name:maintenance_purchase.model_purchase_order_line
59
+ msgid "Purchase Order Line"
60
+ msgstr ""
@@ -0,0 +1,2 @@
1
+ from . import maintenance_equipment
2
+ from . import purchase_order
@@ -0,0 +1,20 @@
1
+ # Copyright 2022 CreuBlanca
2
+ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3
+
4
+ from odoo import fields, models
5
+
6
+
7
+ class MaintenanceEquipment(models.Model):
8
+
9
+ _inherit = "maintenance.equipment"
10
+
11
+ purchase_id = fields.Many2one(
12
+ comodel_name="purchase.order",
13
+ related="purchase_line_id.order_id",
14
+ string="Purchase",
15
+ readonly=True,
16
+ )
17
+ purchase_line_id = fields.Many2one(
18
+ comodel_name="purchase.order.line",
19
+ readonly=True,
20
+ )
@@ -0,0 +1,137 @@
1
+ # Copyright 2022 CreuBlanca
2
+ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3
+
4
+ from odoo import api, fields, models
5
+
6
+
7
+ class PurchaseOrder(models.Model):
8
+
9
+ _inherit = "purchase.order"
10
+
11
+ equipment_count = fields.Integer(compute="_compute_equipment_count")
12
+
13
+ def _compute_equipment_count(self):
14
+ for item in self:
15
+ item.equipment_count = sum(item.mapped("order_line.equipment_count"))
16
+
17
+ def unlink(self):
18
+ items = self.env["maintenance.equipment"].search(
19
+ [("purchase_id", "in", self.ids)]
20
+ )
21
+ items.write({"purchase_line_id": False, "purchase_id": False})
22
+ return super().unlink()
23
+
24
+ def action_view_equipments(self):
25
+ items = self.env["maintenance.equipment"].search(
26
+ [("purchase_id", "=", self.id)]
27
+ )
28
+ action = self.env.ref("maintenance.hr_equipment_action")
29
+ action_dict = action.sudo().read()[0]
30
+ if len(items) == 1:
31
+ res = self.env.ref("maintenance.hr_equipment_view_form", False)
32
+ action_dict["views"] = [(res and res.id or False, "form")]
33
+ action_dict["res_id"] = items.id
34
+ elif items:
35
+ action_dict["domain"] = [("purchase_id", "=", self.id)]
36
+ else:
37
+ action_dict = {"type": "ir.actions.act_window_close"}
38
+ return action_dict
39
+
40
+ def button_approve(self, force=False):
41
+ result = super().button_approve(force=force)
42
+ equipment_model = self.env["maintenance.equipment"]
43
+ for order in self.filtered(lambda po: po.state in ("purchase", "done")):
44
+ for line in order.order_line.filtered(
45
+ lambda x: (
46
+ not x.equipment_ids
47
+ and x.product_id
48
+ and x.product_id.product_tmpl_id.maintenance_ok
49
+ )
50
+ ):
51
+ if not line.equipment_category_id:
52
+ line._set_equipment_category()
53
+ # Create equipments
54
+ limit = int(line.product_qty) + 1
55
+ vals = line._prepare_equipment_vals()
56
+ equipment_ids = []
57
+ for _i in range(1, limit):
58
+ equipment = equipment_model.create(vals)
59
+ equipment_ids.append((4, equipment.id))
60
+ line.equipment_ids = equipment_ids
61
+ return result
62
+
63
+
64
+ class PurchaseOrderLine(models.Model):
65
+ _inherit = "purchase.order.line"
66
+
67
+ equipment_category_id = fields.Many2one(
68
+ comodel_name="maintenance.equipment.category",
69
+ string="Equipment Category",
70
+ compute="_compute_equipment_category_id",
71
+ store=True,
72
+ readonly=False,
73
+ )
74
+ equipment_ids = fields.Many2many(
75
+ comodel_name="maintenance.equipment",
76
+ string="Equipments",
77
+ copy=False,
78
+ )
79
+ equipment_count = fields.Integer(compute="_compute_equipment_count")
80
+
81
+ @api.depends("product_id")
82
+ def _compute_equipment_category_id(self):
83
+ for item in self:
84
+ if (
85
+ item.product_id.maintenance_ok
86
+ and item.product_id.product_tmpl_id.categ_id.equipment_category_ids
87
+ ):
88
+ item.equipment_category_id = fields.first(
89
+ item.product_id.product_tmpl_id.categ_id.equipment_category_ids
90
+ )
91
+ else:
92
+ item.equipment_category_id = item.equipment_category_id
93
+
94
+ def _compute_equipment_count(self):
95
+ data = self.env["maintenance.equipment"].read_group(
96
+ [("purchase_line_id", "in", self.ids)],
97
+ ["purchase_line_id"],
98
+ ["purchase_line_id"],
99
+ )
100
+ mapping = {x["purchase_line_id"][0]: x["purchase_line_id_count"] for x in data}
101
+ for item in self:
102
+ item.equipment_count = mapping.get(item.id, 0)
103
+
104
+ def _prepare_equipment_category_vals(self):
105
+ categ = self.product_id.product_tmpl_id.categ_id
106
+ return {"name": categ.name, "product_category_id": categ.id}
107
+
108
+ def _set_equipment_category(self):
109
+ if not self.equipment_category_id:
110
+ category_model = self.env["maintenance.equipment.category"].sudo()
111
+ category = fields.first(
112
+ self.product_id.product_tmpl_id.categ_id.equipment_category_ids
113
+ )
114
+ if not category:
115
+ category = category_model.create(
116
+ self._prepare_equipment_category_vals()
117
+ )
118
+ self.equipment_category_id = category.id
119
+
120
+ def _prepare_equipment_vals(self):
121
+ return {
122
+ "purchase_line_id": self.id,
123
+ "name": self.product_id.name,
124
+ "product_id": self.product_id.id,
125
+ "category_id": self.equipment_category_id.id,
126
+ "assign_date": self.order_id.date_order,
127
+ "effective_date": self.order_id.date_planned,
128
+ "partner_id": self.order_id.partner_id.id,
129
+ "partner_ref": self.order_id.partner_ref,
130
+ }
131
+
132
+ def _prepare_account_move_line(self, move=False):
133
+ result = super()._prepare_account_move_line(move=move)
134
+ result["equipment_ids"] = [
135
+ (4, equipment.id) for equipment in self.equipment_ids
136
+ ]
137
+ return result
@@ -0,0 +1 @@
1
+ * Enric Tobella
@@ -0,0 +1 @@
1
+ Create Equipments when the purchase is validated.
@@ -0,0 +1,421 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
7
+ <title>Maintenance Purchase</title>
8
+ <style type="text/css">
9
+
10
+ /*
11
+ :Author: David Goodger (goodger@python.org)
12
+ :Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
13
+ :Copyright: This stylesheet has been placed in the public domain.
14
+
15
+ Default cascading style sheet for the HTML output of Docutils.
16
+
17
+ See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
18
+ customize this style sheet.
19
+ */
20
+
21
+ /* used to remove borders from tables and images */
22
+ .borderless, table.borderless td, table.borderless th {
23
+ border: 0 }
24
+
25
+ table.borderless td, table.borderless th {
26
+ /* Override padding for "table.docutils td" with "! important".
27
+ The right padding separates the table cells. */
28
+ padding: 0 0.5em 0 0 ! important }
29
+
30
+ .first {
31
+ /* Override more specific margin styles with "! important". */
32
+ margin-top: 0 ! important }
33
+
34
+ .last, .with-subtitle {
35
+ margin-bottom: 0 ! important }
36
+
37
+ .hidden {
38
+ display: none }
39
+
40
+ .subscript {
41
+ vertical-align: sub;
42
+ font-size: smaller }
43
+
44
+ .superscript {
45
+ vertical-align: super;
46
+ font-size: smaller }
47
+
48
+ a.toc-backref {
49
+ text-decoration: none ;
50
+ color: black }
51
+
52
+ blockquote.epigraph {
53
+ margin: 2em 5em ; }
54
+
55
+ dl.docutils dd {
56
+ margin-bottom: 0.5em }
57
+
58
+ object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
59
+ overflow: hidden;
60
+ }
61
+
62
+ /* Uncomment (and remove this text!) to get bold-faced definition list terms
63
+ dl.docutils dt {
64
+ font-weight: bold }
65
+ */
66
+
67
+ div.abstract {
68
+ margin: 2em 5em }
69
+
70
+ div.abstract p.topic-title {
71
+ font-weight: bold ;
72
+ text-align: center }
73
+
74
+ div.admonition, div.attention, div.caution, div.danger, div.error,
75
+ div.hint, div.important, div.note, div.tip, div.warning {
76
+ margin: 2em ;
77
+ border: medium outset ;
78
+ padding: 1em }
79
+
80
+ div.admonition p.admonition-title, div.hint p.admonition-title,
81
+ div.important p.admonition-title, div.note p.admonition-title,
82
+ div.tip p.admonition-title {
83
+ font-weight: bold ;
84
+ font-family: sans-serif }
85
+
86
+ div.attention p.admonition-title, div.caution p.admonition-title,
87
+ div.danger p.admonition-title, div.error p.admonition-title,
88
+ div.warning p.admonition-title, .code .error {
89
+ color: red ;
90
+ font-weight: bold ;
91
+ font-family: sans-serif }
92
+
93
+ /* Uncomment (and remove this text!) to get reduced vertical space in
94
+ compound paragraphs.
95
+ div.compound .compound-first, div.compound .compound-middle {
96
+ margin-bottom: 0.5em }
97
+
98
+ div.compound .compound-last, div.compound .compound-middle {
99
+ margin-top: 0.5em }
100
+ */
101
+
102
+ div.dedication {
103
+ margin: 2em 5em ;
104
+ text-align: center ;
105
+ font-style: italic }
106
+
107
+ div.dedication p.topic-title {
108
+ font-weight: bold ;
109
+ font-style: normal }
110
+
111
+ div.figure {
112
+ margin-left: 2em ;
113
+ margin-right: 2em }
114
+
115
+ div.footer, div.header {
116
+ clear: both;
117
+ font-size: smaller }
118
+
119
+ div.line-block {
120
+ display: block ;
121
+ margin-top: 1em ;
122
+ margin-bottom: 1em }
123
+
124
+ div.line-block div.line-block {
125
+ margin-top: 0 ;
126
+ margin-bottom: 0 ;
127
+ margin-left: 1.5em }
128
+
129
+ div.sidebar {
130
+ margin: 0 0 0.5em 1em ;
131
+ border: medium outset ;
132
+ padding: 1em ;
133
+ background-color: #ffffee ;
134
+ width: 40% ;
135
+ float: right ;
136
+ clear: right }
137
+
138
+ div.sidebar p.rubric {
139
+ font-family: sans-serif ;
140
+ font-size: medium }
141
+
142
+ div.system-messages {
143
+ margin: 5em }
144
+
145
+ div.system-messages h1 {
146
+ color: red }
147
+
148
+ div.system-message {
149
+ border: medium outset ;
150
+ padding: 1em }
151
+
152
+ div.system-message p.system-message-title {
153
+ color: red ;
154
+ font-weight: bold }
155
+
156
+ div.topic {
157
+ margin: 2em }
158
+
159
+ h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
160
+ h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
161
+ margin-top: 0.4em }
162
+
163
+ h1.title {
164
+ text-align: center }
165
+
166
+ h2.subtitle {
167
+ text-align: center }
168
+
169
+ hr.docutils {
170
+ width: 75% }
171
+
172
+ img.align-left, .figure.align-left, object.align-left, table.align-left {
173
+ clear: left ;
174
+ float: left ;
175
+ margin-right: 1em }
176
+
177
+ img.align-right, .figure.align-right, object.align-right, table.align-right {
178
+ clear: right ;
179
+ float: right ;
180
+ margin-left: 1em }
181
+
182
+ img.align-center, .figure.align-center, object.align-center {
183
+ display: block;
184
+ margin-left: auto;
185
+ margin-right: auto;
186
+ }
187
+
188
+ table.align-center {
189
+ margin-left: auto;
190
+ margin-right: auto;
191
+ }
192
+
193
+ .align-left {
194
+ text-align: left }
195
+
196
+ .align-center {
197
+ clear: both ;
198
+ text-align: center }
199
+
200
+ .align-right {
201
+ text-align: right }
202
+
203
+ /* reset inner alignment in figures */
204
+ div.align-right {
205
+ text-align: inherit }
206
+
207
+ /* div.align-center * { */
208
+ /* text-align: left } */
209
+
210
+ .align-top {
211
+ vertical-align: top }
212
+
213
+ .align-middle {
214
+ vertical-align: middle }
215
+
216
+ .align-bottom {
217
+ vertical-align: bottom }
218
+
219
+ ol.simple, ul.simple {
220
+ margin-bottom: 1em }
221
+
222
+ ol.arabic {
223
+ list-style: decimal }
224
+
225
+ ol.loweralpha {
226
+ list-style: lower-alpha }
227
+
228
+ ol.upperalpha {
229
+ list-style: upper-alpha }
230
+
231
+ ol.lowerroman {
232
+ list-style: lower-roman }
233
+
234
+ ol.upperroman {
235
+ list-style: upper-roman }
236
+
237
+ p.attribution {
238
+ text-align: right ;
239
+ margin-left: 50% }
240
+
241
+ p.caption {
242
+ font-style: italic }
243
+
244
+ p.credits {
245
+ font-style: italic ;
246
+ font-size: smaller }
247
+
248
+ p.label {
249
+ white-space: nowrap }
250
+
251
+ p.rubric {
252
+ font-weight: bold ;
253
+ font-size: larger ;
254
+ color: maroon ;
255
+ text-align: center }
256
+
257
+ p.sidebar-title {
258
+ font-family: sans-serif ;
259
+ font-weight: bold ;
260
+ font-size: larger }
261
+
262
+ p.sidebar-subtitle {
263
+ font-family: sans-serif ;
264
+ font-weight: bold }
265
+
266
+ p.topic-title {
267
+ font-weight: bold }
268
+
269
+ pre.address {
270
+ margin-bottom: 0 ;
271
+ margin-top: 0 ;
272
+ font: inherit }
273
+
274
+ pre.literal-block, pre.doctest-block, pre.math, pre.code {
275
+ margin-left: 2em ;
276
+ margin-right: 2em }
277
+
278
+ pre.code .ln { color: grey; } /* line numbers */
279
+ pre.code, code { background-color: #eeeeee }
280
+ pre.code .comment, code .comment { color: #5C6576 }
281
+ pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
282
+ pre.code .literal.string, code .literal.string { color: #0C5404 }
283
+ pre.code .name.builtin, code .name.builtin { color: #352B84 }
284
+ pre.code .deleted, code .deleted { background-color: #DEB0A1}
285
+ pre.code .inserted, code .inserted { background-color: #A3D289}
286
+
287
+ span.classifier {
288
+ font-family: sans-serif ;
289
+ font-style: oblique }
290
+
291
+ span.classifier-delimiter {
292
+ font-family: sans-serif ;
293
+ font-weight: bold }
294
+
295
+ span.interpreted {
296
+ font-family: sans-serif }
297
+
298
+ span.option {
299
+ white-space: nowrap }
300
+
301
+ span.pre {
302
+ white-space: pre }
303
+
304
+ span.problematic {
305
+ color: red }
306
+
307
+ span.section-subtitle {
308
+ /* font-size relative to parent (h1..h6 element) */
309
+ font-size: 80% }
310
+
311
+ table.citation {
312
+ border-left: solid 1px gray;
313
+ margin-left: 1px }
314
+
315
+ table.docinfo {
316
+ margin: 2em 4em }
317
+
318
+ table.docutils {
319
+ margin-top: 0.5em ;
320
+ margin-bottom: 0.5em }
321
+
322
+ table.footnote {
323
+ border-left: solid 1px black;
324
+ margin-left: 1px }
325
+
326
+ table.docutils td, table.docutils th,
327
+ table.docinfo td, table.docinfo th {
328
+ padding-left: 0.5em ;
329
+ padding-right: 0.5em ;
330
+ vertical-align: top }
331
+
332
+ table.docutils th.field-name, table.docinfo th.docinfo-name {
333
+ font-weight: bold ;
334
+ text-align: left ;
335
+ white-space: nowrap ;
336
+ padding-left: 0 }
337
+
338
+ /* "booktabs" style (no vertical lines) */
339
+ table.docutils.booktabs {
340
+ border: 0px;
341
+ border-top: 2px solid;
342
+ border-bottom: 2px solid;
343
+ border-collapse: collapse;
344
+ }
345
+ table.docutils.booktabs * {
346
+ border: 0px;
347
+ }
348
+ table.docutils.booktabs th {
349
+ border-bottom: thin solid;
350
+ text-align: left;
351
+ }
352
+
353
+ h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
354
+ h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
355
+ font-size: 100% }
356
+
357
+ ul.auto-toc {
358
+ list-style-type: none }
359
+
360
+ </style>
361
+ </head>
362
+ <body>
363
+ <div class="document" id="maintenance-purchase">
364
+ <h1 class="title">Maintenance Purchase</h1>
365
+
366
+ <!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
367
+ !! This file is generated by oca-gen-addon-readme !!
368
+ !! changes will be overwritten. !!
369
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370
+ !! source digest: sha256:9b4e0b44d941b38aadf91a2912f84cf907a7e32f5e5573d36779fd044fa0f7f9
371
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372
+ <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/maintenance/tree/16.0/maintenance_purchase"><img alt="OCA/maintenance" src="https://img.shields.io/badge/github-OCA%2Fmaintenance-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/maintenance-16-0/maintenance-16-0-maintenance_purchase"><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/maintenance&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373
+ <p>Create Equipments when the purchase is validated.</p>
374
+ <p><strong>Table of contents</strong></p>
375
+ <div class="contents local topic" id="contents">
376
+ <ul class="simple">
377
+ <li><a class="reference internal" href="#bug-tracker" id="toc-entry-1">Bug Tracker</a></li>
378
+ <li><a class="reference internal" href="#credits" id="toc-entry-2">Credits</a><ul>
379
+ <li><a class="reference internal" href="#authors" id="toc-entry-3">Authors</a></li>
380
+ <li><a class="reference internal" href="#contributors" id="toc-entry-4">Contributors</a></li>
381
+ <li><a class="reference internal" href="#maintainers" id="toc-entry-5">Maintainers</a></li>
382
+ </ul>
383
+ </li>
384
+ </ul>
385
+ </div>
386
+ <div class="section" id="bug-tracker">
387
+ <h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
388
+ <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/maintenance/issues">GitHub Issues</a>.
389
+ In case of trouble, please check there if your issue has already been reported.
390
+ If you spotted it first, help us to smash it by providing a detailed and welcomed
391
+ <a class="reference external" href="https://github.com/OCA/maintenance/issues/new?body=module:%20maintenance_purchase%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
392
+ <p>Do not contact contributors directly about support or help with technical issues.</p>
393
+ </div>
394
+ <div class="section" id="credits">
395
+ <h1><a class="toc-backref" href="#toc-entry-2">Credits</a></h1>
396
+ <div class="section" id="authors">
397
+ <h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
398
+ <ul class="simple">
399
+ <li>CreuBlanca</li>
400
+ </ul>
401
+ </div>
402
+ <div class="section" id="contributors">
403
+ <h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
404
+ <ul class="simple">
405
+ <li>Enric Tobella</li>
406
+ </ul>
407
+ </div>
408
+ <div class="section" id="maintainers">
409
+ <h2><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h2>
410
+ <p>This module is maintained by the OCA.</p>
411
+ <a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
412
+ <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
413
+ mission is to support the collaborative development of Odoo features and
414
+ promote its widespread use.</p>
415
+ <p>This module is part of the <a class="reference external" href="https://github.com/OCA/maintenance/tree/16.0/maintenance_purchase">OCA/maintenance</a> project on GitHub.</p>
416
+ <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
417
+ </div>
418
+ </div>
419
+ </div>
420
+ </body>
421
+ </html>
@@ -0,0 +1 @@
1
+ from . import test_purchase_order
@@ -0,0 +1,206 @@
1
+ # Copyright 2024 ACSONE SA/NV
2
+ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3
+
4
+ from odoo import Command
5
+ from odoo.tests.common import TransactionCase
6
+
7
+
8
+ class TestMaintenanceProject(TransactionCase):
9
+ @classmethod
10
+ def setUpClass(cls):
11
+ super().setUpClass()
12
+
13
+ cls.Equipment = cls.env["maintenance.equipment"]
14
+ cls.EquipmentCategory = cls.env["maintenance.equipment.category"]
15
+ cls.MaintenanceEquipmentCategory = cls.env["maintenance.equipment.category"]
16
+ cls.PurchaseOrder = cls.env["purchase.order"]
17
+ cls.PurchaseOrderLine = cls.env["purchase.order.line"]
18
+ cls.ProductCategory = cls.env["product.category"]
19
+ cls.ProductProduct = cls.env["product.product"]
20
+ cls.ProductTemplate = cls.env["product.template"]
21
+ cls.ResPartner = cls.env["res.partner"]
22
+
23
+ cls.partner = cls.ResPartner.create(
24
+ {
25
+ "name": "partner",
26
+ }
27
+ )
28
+ uom_unit = cls.env.ref("uom.product_uom_unit")
29
+ cls.maintenance_equipment_category1 = cls.MaintenanceEquipmentCategory.create(
30
+ {"name": "My Maintenance Equipment Category 1"}
31
+ )
32
+ cls.maintenance_equipment_category2 = cls.MaintenanceEquipmentCategory.create(
33
+ {"name": "My Maintenance Equipment Category 2"}
34
+ )
35
+ cls.product_category01 = cls.ProductCategory.create(
36
+ {
37
+ "name": "My Product Category 1",
38
+ "equipment_category_ids": [
39
+ Command.set(
40
+ [
41
+ cls.maintenance_equipment_category1.id,
42
+ cls.maintenance_equipment_category2.id,
43
+ ]
44
+ )
45
+ ],
46
+ }
47
+ )
48
+ cls.product_category02 = cls.ProductCategory.create(
49
+ {
50
+ "name": "My Product Category 2",
51
+ "equipment_category_ids": [
52
+ Command.set([cls.maintenance_equipment_category2.id])
53
+ ],
54
+ }
55
+ )
56
+ cls.product_order_maintenance = cls.ProductProduct.create(
57
+ {
58
+ "name": "My Product",
59
+ "standard_price": 235.0,
60
+ "list_price": 280.0,
61
+ "type": "consu",
62
+ "uom_id": uom_unit.id,
63
+ "uom_po_id": uom_unit.id,
64
+ "purchase_method": "purchase",
65
+ "default_code": "PROD_ORDER",
66
+ "taxes_id": False,
67
+ "maintenance_ok": True,
68
+ "categ_id": cls.product_category01.id,
69
+ }
70
+ )
71
+ cls.product_order_no_maintenance = cls.ProductProduct.create(
72
+ {
73
+ "name": "My Product",
74
+ "standard_price": 235.0,
75
+ "list_price": 280.0,
76
+ "type": "consu",
77
+ "uom_id": uom_unit.id,
78
+ "uom_po_id": uom_unit.id,
79
+ "purchase_method": "purchase",
80
+ "default_code": "PROD_ORDER",
81
+ "taxes_id": False,
82
+ "categ_id": cls.product_category02.id,
83
+ }
84
+ )
85
+ cls.purchase_order = cls.PurchaseOrder.with_context(
86
+ tracking_disable=True
87
+ ).create(
88
+ {
89
+ "partner_id": cls.partner.id,
90
+ }
91
+ )
92
+ PurchaseOrderLine = cls.PurchaseOrderLine.with_context(tracking_disable=True)
93
+ cls.purchase_line_order01 = PurchaseOrderLine.create(
94
+ {
95
+ "name": cls.product_order_maintenance.name,
96
+ "product_id": cls.product_order_maintenance.id,
97
+ "product_qty": 10.0,
98
+ "product_uom": cls.product_order_maintenance.uom_id.id,
99
+ "price_unit": cls.product_order_maintenance.list_price,
100
+ "order_id": cls.purchase_order.id,
101
+ "taxes_id": False,
102
+ }
103
+ )
104
+ cls.purchase_line_order02 = PurchaseOrderLine.create(
105
+ {
106
+ "name": cls.product_order_no_maintenance.name,
107
+ "product_id": cls.product_order_no_maintenance.id,
108
+ "product_qty": 10.0,
109
+ "product_uom": cls.product_order_no_maintenance.uom_id.id,
110
+ "price_unit": cls.product_order_no_maintenance.list_price,
111
+ "order_id": cls.purchase_order.id,
112
+ "taxes_id": False,
113
+ }
114
+ )
115
+
116
+ def test_equipment_count(self):
117
+ self.purchase_order.button_approve()
118
+ self.assertEqual(self.purchase_order.equipment_count, 10)
119
+ self.assertEqual(self.purchase_line_order01.equipment_count, 10)
120
+ self.assertEqual(self.purchase_line_order02.equipment_count, 0)
121
+ self.purchase_order.button_draft()
122
+ self.purchase_line_order01.product_qty = 1
123
+ self.purchase_order.button_approve()
124
+ self.assertEqual(self.purchase_order.equipment_count, 10)
125
+ self.purchase_order.button_draft()
126
+ self.purchase_line_order01.equipment_ids.unlink()
127
+ self.purchase_order.button_approve()
128
+ self.assertEqual(self.purchase_order.equipment_count, 1)
129
+
130
+ def test_unlink_purchase_oder(self):
131
+ self.purchase_order.button_approve()
132
+ equipments = self.purchase_order.order_line.equipment_ids
133
+ self.assertEqual(equipments.purchase_id, self.purchase_order)
134
+ self.assertEqual(equipments.purchase_line_id, self.purchase_line_order01)
135
+ self.purchase_order.button_cancel()
136
+ self.assertEqual(equipments.purchase_id, self.purchase_order)
137
+ self.assertEqual(equipments.purchase_line_id, self.purchase_line_order01)
138
+ self.purchase_order.unlink()
139
+ self.assertFalse(equipments.purchase_id)
140
+ self.assertFalse(equipments.purchase_line_id)
141
+
142
+ def test_equipment_category_id(self):
143
+ self.assertEqual(
144
+ self.purchase_line_order01.equipment_category_id,
145
+ self.maintenance_equipment_category1,
146
+ )
147
+ self.assertFalse(self.purchase_line_order02.equipment_category_id)
148
+ self.product_order_no_maintenance.product_tmpl_id.maintenance_ok = True
149
+ self.assertFalse(self.purchase_line_order02.equipment_category_id)
150
+ self.purchase_line_order02.product_id = self.product_order_maintenance
151
+ self.purchase_line_order02.product_id = self.product_order_no_maintenance
152
+ self.assertEqual(
153
+ self.purchase_line_order02.equipment_category_id,
154
+ self.maintenance_equipment_category2,
155
+ )
156
+ self.purchase_line_order01.equipment_ids.unlink()
157
+ self.purchase_line_order01.equipment_category_id = False
158
+ self.purchase_order.button_approve()
159
+ self.assertEqual(
160
+ self.purchase_line_order01.equipment_category_id,
161
+ self.maintenance_equipment_category1,
162
+ )
163
+ self.purchase_line_order01.equipment_ids.unlink()
164
+ self.purchase_line_order01.equipment_category_id = False
165
+ product_category_withouth_equipement_category = self.ProductCategory.create(
166
+ {
167
+ "name": "My Product Category 2",
168
+ }
169
+ )
170
+ self.purchase_line_order01.product_id.product_tmpl_id.categ_id = (
171
+ product_category_withouth_equipement_category.id
172
+ )
173
+ self.purchase_order.button_approve()
174
+ self.assertTrue(self.purchase_line_order01.equipment_category_id)
175
+ self.assertNotEqual(
176
+ self.purchase_line_order01.equipment_category_id,
177
+ self.maintenance_equipment_category1,
178
+ )
179
+
180
+ def test_account_move_line(self):
181
+ self.purchase_order.button_approve()
182
+ self.purchase_order.action_create_invoice()
183
+ self.assertEqual(
184
+ self.purchase_order.order_line.equipment_ids,
185
+ self.purchase_order.invoice_ids.line_ids.equipment_ids,
186
+ )
187
+
188
+ def test_action_view_equipments(self):
189
+ action = self.purchase_order.action_view_equipments()
190
+ self.assertEqual(action, {"type": "ir.actions.act_window_close"})
191
+ self.purchase_line_order01.product_qty = 1
192
+ self.purchase_order.button_approve()
193
+ view = self.env.ref("maintenance.hr_equipment_view_form", False)
194
+ action = self.purchase_order.action_view_equipments()
195
+ self.assertEqual(action["views"], [(view and view.id or False, "form")])
196
+ self.assertEqual(
197
+ action["res_id"], self.purchase_line_order01.equipment_ids[0:].id
198
+ )
199
+ self.purchase_order.button_draft()
200
+ self.purchase_line_order01.equipment_ids.unlink()
201
+ self.purchase_line_order01.product_qty = 2
202
+ self.purchase_order.button_approve()
203
+ action = self.purchase_order.action_view_equipments()
204
+ self.assertEqual(
205
+ action["domain"], [("purchase_id", "=", self.purchase_order.id)]
206
+ )
@@ -0,0 +1,16 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <!-- Copyright 2022 CreuBlanca
3
+ License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
4
+ <odoo>
5
+ <record id="hr_equipment_view_form" model="ir.ui.view">
6
+ <field name="name">equipment.form</field>
7
+ <field name="model">maintenance.equipment</field>
8
+ <field name="inherit_id" ref="maintenance.hr_equipment_view_form" />
9
+ <field name="arch" type="xml">
10
+ <xpath expr="//field[@name='serial_no']" position="after">
11
+ <field name="purchase_id" />
12
+ </xpath>
13
+ </field>
14
+ </record>
15
+
16
+ </odoo>
@@ -0,0 +1,37 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <!-- Copyright 2022 CreuBlanca
3
+ License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
4
+ <odoo>
5
+
6
+ <record model="ir.ui.view" id="purchase_order_form_view">
7
+ <field name="name">purchase.order.form (in maintenance_purchase)</field>
8
+ <field name="model">purchase.order</field>
9
+ <field name="inherit_id" ref="purchase.purchase_order_form" />
10
+ <field name="arch" type="xml">
11
+ <xpath expr="//div[hasclass('oe_button_box')]" position="inside">
12
+ <button
13
+ name="action_view_equipments"
14
+ type="object"
15
+ class="oe_stat_button"
16
+ icon="fa-cubes"
17
+ attrs="{'invisible': [('equipment_count', '=', 0)]}"
18
+ >
19
+ <field
20
+ string="Equipment(s)"
21
+ name="equipment_count"
22
+ widget="statinfo"
23
+ />
24
+ </button>
25
+ </xpath>
26
+ <xpath
27
+ expr="//notebook//field[@name='order_line']/tree/field[@name='product_qty']"
28
+ position="before"
29
+ >
30
+ <field name="equipment_category_id" optional="hide" />
31
+ </xpath>
32
+ </field>
33
+ </record>
34
+
35
+
36
+
37
+ </odoo>
@@ -0,0 +1,96 @@
1
+ Metadata-Version: 2.1
2
+ Name: odoo-addon-maintenance-purchase
3
+ Version: 16.0.1.0.0.1
4
+ Summary: Create Equipments with purchases
5
+ Home-page: https://github.com/OCA/maintenance
6
+ Author: CreuBlanca,Odoo Community Association (OCA)
7
+ Author-email: support@odoo-community.org
8
+ License: AGPL-3
9
+ Platform: UNKNOWN
10
+ Classifier: Programming Language :: Python
11
+ Classifier: Framework :: Odoo
12
+ Classifier: Framework :: Odoo :: 16.0
13
+ Classifier: License :: OSI Approved :: GNU Affero General Public License v3
14
+ Requires-Python: >=3.10
15
+ Requires-Dist: odoo-addon-maintenance-account <16.1dev,>=16.0dev
16
+ Requires-Dist: odoo <16.1dev,>=16.0a
17
+
18
+ ====================
19
+ Maintenance Purchase
20
+ ====================
21
+
22
+ ..
23
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
24
+ !! This file is generated by oca-gen-addon-readme !!
25
+ !! changes will be overwritten. !!
26
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
27
+ !! source digest: sha256:9b4e0b44d941b38aadf91a2912f84cf907a7e32f5e5573d36779fd044fa0f7f9
28
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
29
+
30
+ .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
31
+ :target: https://odoo-community.org/page/development-status
32
+ :alt: Beta
33
+ .. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
34
+ :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
35
+ :alt: License: AGPL-3
36
+ .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmaintenance-lightgray.png?logo=github
37
+ :target: https://github.com/OCA/maintenance/tree/16.0/maintenance_purchase
38
+ :alt: OCA/maintenance
39
+ .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
40
+ :target: https://translation.odoo-community.org/projects/maintenance-16-0/maintenance-16-0-maintenance_purchase
41
+ :alt: Translate me on Weblate
42
+ .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
43
+ :target: https://runboat.odoo-community.org/builds?repo=OCA/maintenance&target_branch=16.0
44
+ :alt: Try me on Runboat
45
+
46
+ |badge1| |badge2| |badge3| |badge4| |badge5|
47
+
48
+ Create Equipments when the purchase is validated.
49
+
50
+ **Table of contents**
51
+
52
+ .. contents::
53
+ :local:
54
+
55
+ Bug Tracker
56
+ ===========
57
+
58
+ Bugs are tracked on `GitHub Issues <https://github.com/OCA/maintenance/issues>`_.
59
+ In case of trouble, please check there if your issue has already been reported.
60
+ If you spotted it first, help us to smash it by providing a detailed and welcomed
61
+ `feedback <https://github.com/OCA/maintenance/issues/new?body=module:%20maintenance_purchase%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
62
+
63
+ Do not contact contributors directly about support or help with technical issues.
64
+
65
+ Credits
66
+ =======
67
+
68
+ Authors
69
+ ~~~~~~~
70
+
71
+ * CreuBlanca
72
+
73
+ Contributors
74
+ ~~~~~~~~~~~~
75
+
76
+ * Enric Tobella
77
+ * Laurent Stukkens
78
+
79
+ Maintainers
80
+ ~~~~~~~~~~~
81
+
82
+ This module is maintained by the OCA.
83
+
84
+ .. image:: https://odoo-community.org/logo.png
85
+ :alt: Odoo Community Association
86
+ :target: https://odoo-community.org
87
+
88
+ OCA, or the Odoo Community Association, is a nonprofit organization whose
89
+ mission is to support the collaborative development of Odoo features and
90
+ promote its widespread use.
91
+
92
+ This module is part of the `OCA/maintenance <https://github.com/OCA/maintenance/tree/16.0/maintenance_purchase>`_ project on GitHub.
93
+
94
+ You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
95
+
96
+
@@ -0,0 +1,21 @@
1
+ odoo/addons/maintenance_purchase/README.rst,sha256=pGlYaeYpieALmajf-Y6AKwlS8OCGwgiLNfT_dzAeHUI,2821
2
+ odoo/addons/maintenance_purchase/__init__.py,sha256=X9EJGOE2GtZbS0G82PtSXmWSZ_R8jEM0rlJTDliQjp4,21
3
+ odoo/addons/maintenance_purchase/__manifest__.py,sha256=9w17WBhLcfa4SJoOxuyOfUH3YbUzEf4T2Uq_DOCCvPM,563
4
+ odoo/addons/maintenance_purchase/i18n/es.po,sha256=FaaoDY3xz3J33nf2uBlxSPyxKLHZeIbKojlULrMVso4,3346
5
+ odoo/addons/maintenance_purchase/i18n/it.po,sha256=9YSpezbgzDY-FcCAFB1XvgvJllKIcTU4HgBmvQ-zaX0,3332
6
+ odoo/addons/maintenance_purchase/i18n/maintenance_purchase.pot,sha256=7Hv1vdMsKfjELy7vmxvJhZ1eMrTBlc3suX97FXt5bf0,1894
7
+ odoo/addons/maintenance_purchase/models/__init__.py,sha256=HaR2WahflhBcrchjiMYzQjtYcmtCDvX7frSd_WeksnI,65
8
+ odoo/addons/maintenance_purchase/models/maintenance_equipment.py,sha256=IRMQWw6pWJaxbL2QCQIDVjPDaGplercFeyirUlOR7z0,499
9
+ odoo/addons/maintenance_purchase/models/purchase_order.py,sha256=GWyHhZsO5Ji6ROdN63wZh3DiTblyRQYZTPkCrUsAmww,5205
10
+ odoo/addons/maintenance_purchase/readme/CONTRIBUTORS.rst,sha256=GAYxzAZEN5wTBewMNx4PD2y_QoI-dzpokacQ9NnaEso,16
11
+ odoo/addons/maintenance_purchase/readme/DESCRIPTION.rst,sha256=9g_-7RtlHa57JH1IBwc9RIxOGBZ3v3Ahez-sSS4UW7E,50
12
+ odoo/addons/maintenance_purchase/static/description/icon.png,sha256=6xBPJauaFOF0KDHfHgQopSc28kKvxMaeoQFQWZtfZDo,9455
13
+ odoo/addons/maintenance_purchase/static/description/index.html,sha256=XFp2ZUdZjmQL6ZGofkKDORA9tOiWrj6cJrlTvIhmKX4,11986
14
+ odoo/addons/maintenance_purchase/tests/__init__.py,sha256=JsUwHLNgJAF-cd1UO-xTZ-iEVGBDxXXWqmMJ7UtDmzQ,34
15
+ odoo/addons/maintenance_purchase/tests/test_purchase_order.py,sha256=KI9TaSbKjM8QfdpeYKfDN-anp0a5agoxN12cg8LyAd0,8807
16
+ odoo/addons/maintenance_purchase/views/maintenance_equipment.xml,sha256=RlKpIuwLNS1VIBeCP5in4gFOKqhjsstOWVqi4_PG8l8,611
17
+ odoo/addons/maintenance_purchase/views/purchase_order.xml,sha256=WXazAvS--mP5Z70y9AHoAxfl5AwU530bEHAoa5cjPq4,1337
18
+ odoo_addon_maintenance_purchase-16.0.1.0.0.1.dist-info/METADATA,sha256=dYZn3YLsyHrPijHLXDnVyZkjbKaXeLw2UueT6klVT4o,3434
19
+ odoo_addon_maintenance_purchase-16.0.1.0.0.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
20
+ odoo_addon_maintenance_purchase-16.0.1.0.0.1.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
21
+ odoo_addon_maintenance_purchase-16.0.1.0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.43.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+