Skip to content

Commit b936859

Browse files
committed
Merge PR #1 into 16.0
Signed-off-by ValentinVinagre
2 parents 80fc71a + 2bf1200 commit b936859

20 files changed

Lines changed: 792 additions & 0 deletions
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
==========================
2+
Repair Order Mass Validate
3+
==========================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:cee7b68c618a4d3b7570ac0052e414b11519427d0ce6847b10a3e26e17684979
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-sygel--technology%2Fsy--repair-lightgray.png?logo=github
20+
:target: https://github.com/sygel-technology/sy-repair/tree/16.0/repair_order_mass_validate
21+
:alt: sygel-technology/sy-repair
22+
23+
|badge1| |badge2| |badge3|
24+
25+
This module allows to select multiple repair orders and mark them as 'Repaired' or the closest possible state to 'Repaired'.
26+
27+
**Table of contents**
28+
29+
.. contents::
30+
:local:
31+
32+
Usage
33+
=====
34+
35+
To use this module you need to:
36+
37+
#. Go to repair orders tree view.
38+
#. Select multiple repair orders.
39+
#. Go to *Action > Complete repair orders* to open a wizard.
40+
#. Do not select the "Create Invoice" option if no invoice has to be created. In that case:
41+
42+
* Repair orders without an Invoice Policy will be sent to "Repaired" state.
43+
* Repair orders with "Before Repair" Invoice Policy will be sent to "To Be Invoiced" state.
44+
* Repair orders with "After Repair" Invoice Policy will be sent to "To Be Invoiced" state.
45+
#. Select the "Create Invoice" option if invoice have to be created. All the repair orders will be sent to "Repaired" states and invoices will be created.
46+
#. Select the "Group Invoice" option along with "Create Invoice" option in order to group invoices created from repair orders when possible.
47+
48+
Bug Tracker
49+
===========
50+
51+
Bugs are tracked on `GitHub Issues <https://github.com/sygel-technology/sy-repair/issues>`_.
52+
In case of trouble, please check there if your issue has already been reported.
53+
If you spotted it first, help us to smash it by providing a detailed and welcomed
54+
`feedback <https://github.com/sygel-technology/sy-repair/issues/new?body=module:%20repair_order_mass_validate%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
55+
56+
Do not contact contributors directly about support or help with technical issues.
57+
58+
Credits
59+
=======
60+
61+
Authors
62+
~~~~~~~
63+
64+
* Sygel
65+
66+
Contributors
67+
~~~~~~~~~~~~
68+
69+
* Manuel Regidor <manuel.regidor@sygel.es>
70+
* Valentín Vinagre <valentin.vinagre@sygel.es>
71+
72+
Maintainers
73+
~~~~~~~~~~~
74+
75+
This module is part of the `sygel-technology/sy-repair <https://github.com/sygel-technology/sy-repair/tree/16.0/repair_order_mass_validate>`_ project on GitHub.
76+
77+
You are welcome to contribute.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright 2025 Manuel Regidor <manuel.regidor@sygel.es>
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from . import models
5+
from . import wizard
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright 2025 Manuel Regidor <manuel.regidor@sygel.es>
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "Repair Order Mass Validate",
6+
"summary": "Repair Order Mass Validate",
7+
"version": "16.0.1.0.0",
8+
"license": "AGPL-3",
9+
"author": "Sygel,Odoo Community Association (OCA)",
10+
"website": "https://github.com/sygel-technology/sy-repair",
11+
"depends": [
12+
"repair",
13+
],
14+
"data": [
15+
"security/ir.model.access.csv",
16+
"wizard/repair_order_mass_complete_wizard_views.xml",
17+
],
18+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright 2025 Manuel Regidor <manuel.regidor@sygel.es>
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from . import repair_order
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Copyright 2025 Manuel Regidor <manuel.regidor@sygel.es>
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import models
5+
6+
7+
class RepairOrder(models.Model):
8+
_inherit = "repair.order"
9+
10+
def _get_complete_repairs_to_validate(self):
11+
return self.filtered(lambda a: a.state == "draft")
12+
13+
def _get_complete_repairs_to_start(self):
14+
return self.filtered(
15+
lambda a: (
16+
a.state == "confirmed" and a.invoice_method in ["none", "after_repair"]
17+
)
18+
or (a.state == "ready" and a.invoice_method == "b4repair")
19+
)
20+
21+
def _get_complete_repairs_to_finish(self):
22+
return self.filtered(
23+
lambda a: (
24+
a.state == "under_repair"
25+
and a.invoice_method in ["none", "after_repair"]
26+
)
27+
or (a.invoice_method == "b4repair" and a.state == "under_repair")
28+
)
29+
30+
def _get_complete_repairs_to_invoice(self):
31+
return self.filtered(lambda a: a.state == "2binvoiced")
32+
33+
def complete_repair_validate(self):
34+
draft_repair_orders = self._get_complete_repairs_to_validate()
35+
for repair in draft_repair_orders:
36+
repair.action_validate()
37+
38+
def complete_repair_start(self):
39+
self._get_complete_repairs_to_start().action_repair_start()
40+
41+
def complete_repair_end(self):
42+
repair_orders_to_finish = self._get_complete_repairs_to_finish()
43+
repair_orders_to_finish.action_repair_end()
44+
45+
def complete_repair_invoice(self, group):
46+
repairs_to_invoice = self._get_complete_repairs_to_invoice()
47+
repairs_to_invoice._create_invoices(group)
48+
# It is necessary to call action_repair_invoice_create after creating
49+
# the invoice so the state of the repairs change. It is dones with the
50+
# invoicing wizard in the same way.
51+
repairs_to_invoice.action_repair_invoice_create()
52+
53+
def complete(self, invoice=False, group=False):
54+
55+
# 1. Validate repairs in draft state
56+
self.complete_repair_validate()
57+
58+
# 2. Start confirmed repairs with no invoice method or invoice method after repair
59+
self.complete_repair_start()
60+
61+
# 3. Complete repairs with no invoice method or invoice method after repair
62+
self.complete_repair_end()
63+
64+
# 4. Invoice repairs to be invoiced
65+
if invoice:
66+
self.complete_repair_invoice(group)
67+
68+
# 5. action_repair_start is called again so the repairs with invoice method
69+
# before repair that has just been invoiced can be started
70+
self.complete_repair_start()
71+
72+
# 6. complete_repair_end is called again so the repairs with invoice method
73+
# before repair that has just been invoiced can be finished
74+
self.complete_repair_end()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* Manuel Regidor <manuel.regidor@sygel.es>
2+
* Valentín Vinagre <valentin.vinagre@sygel.es>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This module allows to select multiple repair orders and mark them as 'Repaired' or the closest possible state to 'Repaired'.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
To use this module you need to:
2+
3+
#. Go to repair orders tree view.
4+
#. Select multiple repair orders.
5+
#. Go to *Action > Complete repair orders* to open a wizard.
6+
#. Do not select the "Create Invoice" option if no invoice has to be created. In that case:
7+
8+
* Repair orders without an Invoice Policy will be sent to "Repaired" state.
9+
* Repair orders with "Before Repair" Invoice Policy will be sent to "To Be Invoiced" state.
10+
* Repair orders with "After Repair" Invoice Policy will be sent to "To Be Invoiced" state.
11+
#. Select the "Create Invoice" option if invoice have to be created. All the repair orders will be sent to "Repaired" states and invoices will be created.
12+
#. Select the "Group Invoice" option along with "Create Invoice" option in order to group invoices created from repair orders when possible.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
2+
access_repair_order_mass_complete_wizard,access.repair.order.mass.complete.wizard,model_repair_order_mass_complete_wizard,stock.group_stock_user,1,1,1,1
35 KB
Loading

0 commit comments

Comments
 (0)