Skip to content

Commit

Permalink
[14.0][FIX] purchase_rfq_number : Keep po name from action cancel po …
Browse files Browse the repository at this point in the history
…> reset to draft > confirm order
  • Loading branch information
newtratip committed Jan 18, 2022
1 parent 8d595f6 commit 41159e1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
14 changes: 13 additions & 1 deletion purchase_rfq_number/models/purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ class PurchaseOrder(models.Model):
copy=False,
default="New",
)
po_number = fields.Char(
string="PO Reference",
index=True,
copy=False,
default="New",
)

@api.model
def create(self, vals):
Expand All @@ -38,10 +44,16 @@ def button_confirm(self):
# save rfq pdf as attachment
order.action_get_rfq_attachment()

po_number = (
order.po_number
if order.po_number != "New"
else self.env["ir.sequence"].next_by_code("purchase.order")
)
order.write(
{
"rfq_number": order.name,
"name": self.env["ir.sequence"].next_by_code("purchase.order"),
"name": po_number,
"po_number": po_number,
}
)

Expand Down
1 change: 1 addition & 0 deletions purchase_rfq_number/views/purchase_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
name="rfq_number"
attrs="{'invisible': ['|', ('rfq_number', '=', 'New'), ('state','not in',('purchase','done'))]}"
/>
<field name="po_number" invisible="1" />
</field>
</field>
</record>
Expand Down

0 comments on commit 41159e1

Please sign in to comment.