Skip to content

Commit 2c8eb0e

Browse files
committed
provide a value for unrevisionned_name
1 parent 8483710 commit 2c8eb0e

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

purchase_order_revision/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# - -*- coding: utf-8 -*-
1+
# -*- coding: utf-8 -*-
22

33
from . import model

purchase_order_revision/model/purchase_order.py

+9
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,12 @@ def new_revision(self):
7272
self.message_post(body=msg)
7373
old_revision.message_post(body=msg)
7474
return True
75+
76+
@api.model
77+
def create(self, values):
78+
if 'unrevisioned_name' not in values:
79+
if values.get('name', '/') == '/':
80+
seq = self.env['ir.sequence']
81+
values['name'] = seq.next_by_code('purchase.order') or '/'
82+
values['unrevisioned_name'] = values['name']
83+
return super(purchase_order, self).create(values)

0 commit comments

Comments
 (0)