Skip to content

Commit 8d3def9

Browse files
committed
[IMP] sale_order_revision: 'New Revision' quick button on confirmed Sales Orders
1 parent 9c92100 commit 8d3def9

6 files changed

Lines changed: 35 additions & 10 deletions

File tree

sale_order_revision/models/sale_order.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,11 @@ def action_view_revisions(self):
4242
"default_current_revision_id": self.id,
4343
}
4444
return result
45+
46+
def action_cancel_create_revision(self):
47+
for sale in self:
48+
sale.action_cancel()
49+
action = sale.create_revision()
50+
if len(self) == 1:
51+
return action
52+
return {}

sale_order_revision/readme/CONTRIBUTORS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77
* Raf Ven <raf.ven@dynapps.be>
88
* Jeroen Evens <jeroen.evens@dynapps.be>
99
* Kitti U. <kittiu@ecosoft.co.th>
10+
* Daniel Reis <dreis@opensourceintegrators.com>
Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,2 @@
1-
On cancelled orders, you can click on the "New copy of Quotation" button. This
2-
will create a new revision of the quotation, with the same base number and a
3-
'-revno' suffix appended. A message is added in the chatter saying that a new
4-
revision was created.
5-
6-
In the form view, a new tab is added that lists the previous revisions, with
7-
the date they were made obsolete and the user who performed the action.
8-
9-
The old revisions of a sale order are flagged as inactive, so they don't
10-
clutter up searches.
1+
Create new revisions or versions for Sales Orders,
2+
keeping the history of previous revisions.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
On Sales Orders, click on the "New Revision" button.
2+
This creates a new revision of the quotation,
3+
with the same base number and a '-revno' suffix appended.
4+
5+
A message is added in the chatter saying that a new
6+
revision was created.
7+
8+
In the form view, a new tab is added that lists the previous revisions, with
9+
the date they were made obsolete and the user who performed the action.
10+
11+
The old revisions of a sale order are flagged as inactive, so they don't
12+
clutter up searches.

sale_order_revision/tests/test_sale_order_revision.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,9 @@ def _create_tester(self):
2020
with sale_form.order_line.new() as line_form:
2121
line_form.product_id = self.product
2222
return sale_form.save()
23+
24+
def test_action_cancel_create_revision(self):
25+
sale = self._create_tester()
26+
sale.action_cancel_create_revision()
27+
self.assertEqual(sale.state, "cancel", "Original SO was cancelled")
28+
self.assertTrue(sale.current_revision_id, "A new SO version was created")

sale_order_revision/view/sale_order.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
string="New Revision of Quotation"
2424
type="object"
2525
/>
26+
<button
27+
name="action_cancel_create_revision"
28+
states="sale"
29+
string="New Revision"
30+
type="object"
31+
/>
2632
</xpath>
2733
<xpath expr="//button[@name='action_view_invoice']" position="after">
2834
<button

0 commit comments

Comments
 (0)