Skip to content

Commit 12728c9

Browse files
committed
[MIG] mrp_progress_button: Migration to 18.0
1 parent 5fb8d3b commit 12728c9

File tree

12 files changed

+76
-61
lines changed

12 files changed

+76
-61
lines changed

mrp_progress_button/README.rst

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@ Mrp Progress Button
1717
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1818
:alt: License: AGPL-3
1919
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github
20-
:target: https://github.com/OCA/manufacture/tree/15.0/mrp_progress_button
20+
:target: https://github.com/OCA/manufacture/tree/18.0/mrp_progress_button
2121
:alt: OCA/manufacture
2222
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/manufacture-15-0/manufacture-15-0-mrp_progress_button
23+
:target: https://translation.odoo-community.org/projects/manufacture-18-0/manufacture-18-0-mrp_progress_button
2424
:alt: Translate me on Weblate
2525
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26-
:target: https://runboat.odoo-community.org/builds?repo=OCA/manufacture&target_branch=15.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/manufacture&target_branch=18.0
2727
:alt: Try me on Runboat
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
3030

3131
Simple module that add a button on MO to mark the Manufacturing Order to
32-
*In Progress* state. This module is usefull only when you do not use routing and
33-
operations. Indeed, the *In Progress* state is automatically put when the
34-
first operation is started.
32+
*In Progress* state. This module is usefull only when you do not use
33+
routing and operations. Indeed, the *In Progress* state is automatically
34+
put when the first operation is started.
3535

3636
**Table of contents**
3737

@@ -43,35 +43,36 @@ Usage
4343

4444
To use this module, you need to:
4545

46-
#. Go to *Manufacturing* and create a Manufacturing Order.
47-
#. Click on *Mark As Started* button
46+
1. Go to *Manufacturing* and create a Manufacturing Order.
47+
2. Click on *Mark As Started* button
4848

4949
Bug Tracker
5050
===========
5151

5252
Bugs are tracked on `GitHub Issues <https://github.com/OCA/manufacture/issues>`_.
5353
In case of trouble, please check there if your issue has already been reported.
5454
If you spotted it first, help us to smash it by providing a detailed and welcomed
55-
`feedback <https://github.com/OCA/manufacture/issues/new?body=module:%20mrp_progress_button%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
55+
`feedback <https://github.com/OCA/manufacture/issues/new?body=module:%20mrp_progress_button%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
5656

5757
Do not contact contributors directly about support or help with technical issues.
5858

5959
Credits
6060
=======
6161

6262
Authors
63-
~~~~~~~
63+
-------
6464

6565
* Akretion
6666

6767
Contributors
68-
~~~~~~~~~~~~
68+
------------
6969

70-
* Florian da Costa <florian.dacosta@akretion.com>
71-
* Bernat Puig Font <bernat.puig@forgeflow.com>
70+
- Florian da Costa <florian.dacosta@akretion.com>
71+
- Bernat Puig Font <bernat.puig@forgeflow.com>
72+
- Fabian Semal <fabian@digital-serenity.net>
7273

7374
Maintainers
74-
~~~~~~~~~~~
75+
-----------
7576

7677
This module is maintained by the OCA.
7778

@@ -83,6 +84,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
8384
mission is to support the collaborative development of Odoo features and
8485
promote its widespread use.
8586

86-
This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/15.0/mrp_progress_button>`_ project on GitHub.
87+
This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/18.0/mrp_progress_button>`_ project on GitHub.
8788

8889
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

mrp_progress_button/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"author": "Akretion, Odoo Community Association (OCA)",
99
"website": "https://github.com/OCA/manufacture",
1010
"category": "Manufacturing",
11-
"version": "15.0.2.0.0",
11+
"version": "18.0.2.0.0",
1212
"license": "AGPL-3",
1313
"depends": ["mrp"],
1414
"data": ["views/production.xml"],

mrp_progress_button/models/mrp_production.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,48 @@
22
# @author Florian DA COSTA <florian.dacosta@akretion.com>
33
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
44

5-
from datetime import datetime
6-
7-
from odoo import api, models
5+
from odoo import api, fields, models
6+
from odoo.tools import float_is_zero
87

98

109
class MrpProduction(models.Model):
1110
_inherit = "mrp.production"
1211

1312
@api.depends(
1413
"move_raw_ids.state",
15-
"move_raw_ids.quantity_done",
14+
"move_raw_ids.quantity",
1615
"move_finished_ids.state",
1716
"workorder_ids.state",
1817
"product_qty",
1918
"qty_producing",
2019
"date_start",
2120
)
2221
def _compute_state(self):
23-
res = super()._compute_state()
22+
super()._compute_state()
2423
for production in self:
25-
if production.state == "confirmed" and production.date_start:
24+
ctx = dict(production.env.context)
25+
if ctx.get("previous_state") == "confirmed" and production.date_start:
2626
production.state = "progress"
27-
return res
27+
elif (
28+
ctx.get("previous_state") == "progress"
29+
and production.product_uom_id
30+
and float_is_zero(
31+
production.qty_producing,
32+
precision_rounding=production.product_uom_id.rounding,
33+
)
34+
):
35+
production.state = "confirmed"
36+
return
2837

29-
def action_progress(self):
38+
def action_start(self):
39+
super().action_start()
3040
self.write(
3141
{
32-
"date_start": datetime.now(),
42+
"date_start": fields.Datetime.now(),
3343
}
3444
)
35-
return True
45+
return
3646

3747
def action_unstart(self):
38-
self.write({"state": "confirmed", "date_start": False, "qty_producing": 0})
48+
self.with_context(previous_state=self.state).qty_producing = 0
3949
return True

mrp_progress_button/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- Florian da Costa \<<florian.dacosta@akretion.com>\>
2+
- Bernat Puig Font \<<bernat.puig@forgeflow.com>\>
3+
- Fabian Semal \<<fabian@digital-serenity.net>\>

mrp_progress_button/readme/CONTRIBUTORS.rst

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Simple module that add a button on MO to mark the Manufacturing Order to
2-
*In Progress* state. This module is usefull only when you do not use routing and
3-
operations. Indeed, the *In Progress* state is automatically put when the
4-
first operation is started.
2+
*In Progress* state. This module is usefull only when you do not use
3+
routing and operations. Indeed, the *In Progress* state is automatically
4+
put when the first operation is started.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
To use this module, you need to:
2+
3+
1. Go to *Manufacturing* and create a Manufacturing Order.
4+
2. Click on *Mark As Started* button

mrp_progress_button/readme/USAGE.rst

Lines changed: 0 additions & 4 deletions
This file was deleted.

mrp_progress_button/static/description/index.html

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<?xml version="1.0" encoding="utf-8"?>
21
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
32
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
43
<head>
@@ -9,10 +8,11 @@
98

109
/*
1110
:Author: David Goodger (goodger@python.org)
12-
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
11+
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
1312
:Copyright: This stylesheet has been placed in the public domain.
1413
1514
Default cascading style sheet for the HTML output of Docutils.
15+
Despite the name, some widely supported CSS2 features are used.
1616
1717
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
1818
customize this style sheet.
@@ -275,7 +275,7 @@
275275
margin-left: 2em ;
276276
margin-right: 2em }
277277

278-
pre.code .ln { color: grey; } /* line numbers */
278+
pre.code .ln { color: gray; } /* line numbers */
279279
pre.code, code { background-color: #eeeeee }
280280
pre.code .comment, code .comment { color: #5C6576 }
281281
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
@@ -301,7 +301,7 @@
301301
span.pre {
302302
white-space: pre }
303303

304-
span.problematic {
304+
span.problematic, pre.problematic {
305305
color: red }
306306

307307
span.section-subtitle {
@@ -369,11 +369,11 @@ <h1 class="title">Mrp Progress Button</h1>
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370370
!! source digest: sha256:45557aca05a46041560b43916f00658df5f71380c3d5031e7fca6db71df0ea58
371371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
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/manufacture/tree/15.0/mrp_progress_button"><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-15-0/manufacture-15-0-mrp_progress_button"><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=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
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/manufacture/tree/18.0/mrp_progress_button"><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-18-0/manufacture-18-0-mrp_progress_button"><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=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373373
<p>Simple module that add a button on MO to mark the Manufacturing Order to
374-
<em>In Progress</em> state. This module is usefull only when you do not use routing and
375-
operations. Indeed, the <em>In Progress</em> state is automatically put when the
376-
first operation is started.</p>
374+
<em>In Progress</em> state. This module is usefull only when you do not use
375+
routing and operations. Indeed, the <em>In Progress</em> state is automatically
376+
put when the first operation is started.</p>
377377
<p><strong>Table of contents</strong></p>
378378
<div class="contents local topic" id="contents">
379379
<ul class="simple">
@@ -400,7 +400,7 @@ <h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
400400
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/manufacture/issues">GitHub Issues</a>.
401401
In case of trouble, please check there if your issue has already been reported.
402402
If you spotted it first, help us to smash it by providing a detailed and welcomed
403-
<a class="reference external" href="https://github.com/OCA/manufacture/issues/new?body=module:%20mrp_progress_button%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
403+
<a class="reference external" href="https://github.com/OCA/manufacture/issues/new?body=module:%20mrp_progress_button%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
404404
<p>Do not contact contributors directly about support or help with technical issues.</p>
405405
</div>
406406
<div class="section" id="credits">
@@ -416,16 +416,19 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
416416
<ul class="simple">
417417
<li>Florian da Costa &lt;<a class="reference external" href="mailto:florian.dacosta&#64;akretion.com">florian.dacosta&#64;akretion.com</a>&gt;</li>
418418
<li>Bernat Puig Font &lt;<a class="reference external" href="mailto:bernat.puig&#64;forgeflow.com">bernat.puig&#64;forgeflow.com</a>&gt;</li>
419+
<li>Fabian Semal &lt;<a class="reference external" href="mailto:fabian&#64;digital-serenity.net">fabian&#64;digital-serenity.net</a>&gt;</li>
419420
</ul>
420421
</div>
421422
<div class="section" id="maintainers">
422423
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
423424
<p>This module is maintained by the OCA.</p>
424-
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
425+
<a class="reference external image-reference" href="https://odoo-community.org">
426+
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
427+
</a>
425428
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
426429
mission is to support the collaborative development of Odoo features and
427430
promote its widespread use.</p>
428-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/manufacture/tree/15.0/mrp_progress_button">OCA/manufacture</a> project on GitHub.</p>
431+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/manufacture/tree/18.0/mrp_progress_button">OCA/manufacture</a> project on GitHub.</p>
429432
<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>
430433
</div>
431434
</div>

0 commit comments

Comments
 (0)