Skip to content

Commit c65505a

Browse files
committed
[MIG] purchase_order_archive: Migration to 16.0
1 parent ccaca31 commit c65505a

File tree

9 files changed

+103
-53
lines changed

9 files changed

+103
-53
lines changed

purchase_order_archive/README.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Purchase Order Archive
77
!! This file is generated by oca-gen-addon-readme !!
88
!! changes will be overwritten. !!
99
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10-
!! source digest: sha256:d36b3f4632a9f0f1edc19814bb5a98383fc5a388c02c0ae3b0be58edd0558a20
10+
!! source digest: sha256:83376fd2375237036fce6945ee04af7f1239599d1453ff39614a8aeb07531a43
1111
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1212
1313
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -17,13 +17,13 @@ Purchase Order Archive
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%2Fpurchase--workflow-lightgray.png?logo=github
20-
:target: https://github.com/OCA/purchase-workflow/tree/14.0/purchase_order_archive
20+
:target: https://github.com/OCA/purchase-workflow/tree/16.0/purchase_order_archive
2121
:alt: OCA/purchase-workflow
2222
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/purchase-workflow-14-0/purchase-workflow-14-0-purchase_order_archive
23+
:target: https://translation.odoo-community.org/projects/purchase-workflow-16-0/purchase-workflow-16-0-purchase_order_archive
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/purchase-workflow&target_branch=14.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/purchase-workflow&target_branch=16.0
2727
:alt: Try me on Runboat
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -65,7 +65,7 @@ Bug Tracker
6565
Bugs are tracked on `GitHub Issues <https://github.com/OCA/purchase-workflow/issues>`_.
6666
In case of trouble, please check there if your issue has already been reported.
6767
If you spotted it first, help us to smash it by providing a detailed and welcomed
68-
`feedback <https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_order_archive%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
68+
`feedback <https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_order_archive%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
6969

7070
Do not contact contributors directly about support or help with technical issues.
7171

@@ -81,6 +81,7 @@ Contributors
8181
~~~~~~~~~~~~
8282

8383
* Andrea Stirpe <[email protected]>
84+
* Christihan Laurel <[email protected]>
8485

8586
Maintainers
8687
~~~~~~~~~~~
@@ -95,6 +96,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
9596
mission is to support the collaborative development of Odoo features and
9697
promote its widespread use.
9798

98-
This module is part of the `OCA/purchase-workflow <https://github.com/OCA/purchase-workflow/tree/14.0/purchase_order_archive>`_ project on GitHub.
99+
This module is part of the `OCA/purchase-workflow <https://github.com/OCA/purchase-workflow/tree/16.0/purchase_order_archive>`_ project on GitHub.
99100

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

purchase_order_archive/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"author": "Onestein, Odoo Community Association (OCA)",
88
"website": "https://github.com/OCA/purchase-workflow",
99
"category": "Purchases",
10-
"version": "14.0.1.1.0",
10+
"version": "16.0.1.0.0",
1111
"license": "AGPL-3",
1212
"depends": ["purchase"],
1313
"data": ["views/purchase_order.xml"],
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
* Andrea Stirpe <[email protected]>
2+
* Christihan Laurel <[email protected]>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../purchase_order_archive
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import setuptools
2+
3+
setuptools.setup(
4+
setup_requires=["setuptools-odoo"],
5+
odoo_addon=True,
6+
)

purchase_order_archive/static/description/index.html

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8" ?>
22
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
33
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
44
<head>
55
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6-
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
6+
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
77
<title>Purchase Order Archive</title>
88
<style type="text/css">
99

1010
/*
1111
:Author: David Goodger ([email protected])
12-
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
12+
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
1313
:Copyright: This stylesheet has been placed in the public domain.
1414
1515
Default cascading style sheet for the HTML output of Docutils.
1616
17-
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
17+
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
1818
customize this style sheet.
1919
*/
2020

@@ -367,9 +367,9 @@ <h1 class="title">Purchase Order Archive</h1>
367367
!! This file is generated by oca-gen-addon-readme !!
368368
!! changes will be overwritten. !!
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370-
!! source digest: sha256:d36b3f4632a9f0f1edc19814bb5a98383fc5a388c02c0ae3b0be58edd0558a20
370+
!! source digest: sha256:83376fd2375237036fce6945ee04af7f1239599d1453ff39614a8aeb07531a43
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/purchase-workflow/tree/14.0/purchase_order_archive"><img alt="OCA/purchase-workflow" src="https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/purchase-workflow-14-0/purchase-workflow-14-0-purchase_order_archive"><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/purchase-workflow&amp;target_branch=14.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" 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" 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" href="https://github.com/OCA/purchase-workflow/tree/16.0/purchase_order_archive"><img alt="OCA/purchase-workflow" src="https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/purchase-workflow-16-0/purchase-workflow-16-0-purchase_order_archive"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runboat.odoo-community.org/builds?repo=OCA/purchase-workflow&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373373
<p>On a system with a high volume of purchases, the number of purchase orders displayed in the list view can become huge.
374374
This module allows to archive Purchase Orders that are in status Locked or Cancelled.</p>
375375
<p>If a purchase order is archived, it will be hidden from the purchase orders list view.</p>
@@ -378,18 +378,18 @@ <h1 class="title">Purchase Order Archive</h1>
378378
<p><strong>Table of contents</strong></p>
379379
<div class="contents local topic" id="contents">
380380
<ul class="simple">
381-
<li><a class="reference internal" href="#usage" id="toc-entry-1">Usage</a></li>
382-
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-2">Bug Tracker</a></li>
383-
<li><a class="reference internal" href="#credits" id="toc-entry-3">Credits</a><ul>
384-
<li><a class="reference internal" href="#authors" id="toc-entry-4">Authors</a></li>
385-
<li><a class="reference internal" href="#contributors" id="toc-entry-5">Contributors</a></li>
386-
<li><a class="reference internal" href="#maintainers" id="toc-entry-6">Maintainers</a></li>
381+
<li><a class="reference internal" href="#usage" id="id1">Usage</a></li>
382+
<li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li>
383+
<li><a class="reference internal" href="#credits" id="id3">Credits</a><ul>
384+
<li><a class="reference internal" href="#authors" id="id4">Authors</a></li>
385+
<li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li>
386+
<li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li>
387387
</ul>
388388
</li>
389389
</ul>
390390
</div>
391391
<div class="section" id="usage">
392-
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
392+
<h1><a class="toc-backref" href="#id1">Usage</a></h1>
393393
<p>To archive purchase orders, you need to:</p>
394394
<ol class="arabic simple">
395395
<li>Open the tree view of purchase orders.</li>
@@ -407,35 +407,36 @@ <h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
407407
</ol>
408408
</div>
409409
<div class="section" id="bug-tracker">
410-
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
410+
<h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
411411
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/purchase-workflow/issues">GitHub Issues</a>.
412412
In case of trouble, please check there if your issue has already been reported.
413413
If you spotted it first, help us to smash it by providing a detailed and welcomed
414-
<a class="reference external" href="https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_order_archive%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
414+
<a class="reference external" href="https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_order_archive%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
415415
<p>Do not contact contributors directly about support or help with technical issues.</p>
416416
</div>
417417
<div class="section" id="credits">
418-
<h1><a class="toc-backref" href="#toc-entry-3">Credits</a></h1>
418+
<h1><a class="toc-backref" href="#id3">Credits</a></h1>
419419
<div class="section" id="authors">
420-
<h2><a class="toc-backref" href="#toc-entry-4">Authors</a></h2>
420+
<h2><a class="toc-backref" href="#id4">Authors</a></h2>
421421
<ul class="simple">
422422
<li>Onestein</li>
423423
</ul>
424424
</div>
425425
<div class="section" id="contributors">
426-
<h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
426+
<h2><a class="toc-backref" href="#id5">Contributors</a></h2>
427427
<ul class="simple">
428428
<li>Andrea Stirpe &lt;<a class="reference external" href="mailto:a.stirpe&#64;onestein.nl">a.stirpe&#64;onestein.nl</a>&gt;</li>
429+
<li>Christihan Laurel &lt;<a class="reference external" href="mailto:laurel&#64;vauxoo.com">laurel&#64;vauxoo.com</a>&gt;</li>
429430
</ul>
430431
</div>
431432
<div class="section" id="maintainers">
432-
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
433+
<h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
433434
<p>This module is maintained by the OCA.</p>
434435
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
435436
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
436437
mission is to support the collaborative development of Odoo features and
437438
promote its widespread use.</p>
438-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/purchase-workflow/tree/14.0/purchase_order_archive">OCA/purchase-workflow</a> project on GitHub.</p>
439+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/purchase-workflow/tree/16.0/purchase_order_archive">OCA/purchase-workflow</a> project on GitHub.</p>
439440
<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>
440441
</div>
441442
</div>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
2+
3+
from . import test_purchase_order_archive
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
2+
# Copyright 2017 Luxim d.o.o.
3+
# Copyright 2017 Matmoz d.o.o.
4+
# Copyright 2017 Deneroteam.
5+
# Copyright 2017 Serpent Consulting Services Pvt. Ltd.
6+
# Copyright 2017 Tecnativa
7+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
8+
9+
from datetime import datetime
10+
11+
from odoo.exceptions import UserError # ValidationError,
12+
from odoo.tests.common import TransactionCase
13+
14+
15+
class TestPurchaseOrderArchive(TransactionCase):
16+
def setUp(self):
17+
super().setUp()
18+
19+
self.purchase_order_obj = self.env["purchase.order"]
20+
product_id = self.env.ref("product.product_product_9")
21+
vals = {
22+
"partner_id": self.env.ref("base.res_partner_1").id,
23+
"order_line": [
24+
(
25+
0,
26+
0,
27+
{
28+
"name": product_id.name,
29+
"product_id": product_id.id,
30+
"product_qty": 1.0,
31+
"product_uom": self.env.ref("uom.product_uom_unit").id,
32+
"price_unit": 121.0,
33+
"date_planned": datetime.today(),
34+
},
35+
)
36+
],
37+
}
38+
self.po_draft = self.env["purchase.order"].create(vals)
39+
self.po_sent = self.env["purchase.order"].create(vals)
40+
self.po_sent.write({"state": "sent"})
41+
self.po_to_approve = self.env["purchase.order"].create(vals)
42+
self.po_to_approve.write({"state": "to approve"})
43+
self.po_purchase = self.env["purchase.order"].create(vals)
44+
self.po_purchase.button_confirm()
45+
self.po_done = self.env["purchase.order"].create(vals)
46+
self.po_done.button_confirm()
47+
self.po_done.button_done()
48+
self.po_cancel = self.env["purchase.order"].create(vals)
49+
self.po_cancel.button_cancel()
50+
51+
def test_archive(self):
52+
with self.assertRaises(UserError):
53+
self.po_draft.toggle_active()
54+
with self.assertRaises(UserError):
55+
self.po_sent.toggle_active()
56+
with self.assertRaises(UserError):
57+
self.po_to_approve.toggle_active()
58+
with self.assertRaises(UserError):
59+
self.po_purchase.toggle_active()
60+
self.po_done.toggle_active()
61+
self.assertEqual(self.po_done.active, False)
62+
self.po_cancel.toggle_active()
63+
self.assertEqual(self.po_cancel.active, False)

purchase_order_archive/views/purchase_order.xml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,37 +25,11 @@
2525
<field name="arch" type="xml">
2626
<xpath expr="//search" position="inside">
2727
<separator />
28-
<filter
29-
string="Active"
30-
name="active"
31-
domain="[('active', '=', True)]"
32-
/>
33-
<filter
34-
string="Archived"
35-
name="inactive"
36-
domain="[('active','=',False)]"
37-
/>
38-
<separator />
39-
</xpath>
40-
</field>
41-
</record>
42-
<record id="purchase_order_view_search" model="ir.ui.view">
43-
<field name="model">purchase.order</field>
44-
<field name="inherit_id" ref="purchase.purchase_order_view_search" />
45-
<field name="arch" type="xml">
46-
<xpath expr="//search" position="inside">
47-
<separator />
48-
<filter
49-
string="Active"
50-
name="active"
51-
domain="[('active', '=', True)]"
52-
/>
5328
<filter
5429
string="Archived"
5530
name="inactive"
5631
domain="[('active','=',False)]"
5732
/>
58-
<separator />
5933
</xpath>
6034
</field>
6135
</record>

0 commit comments

Comments
 (0)