File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,6 +39,14 @@ def create(self, vals):
3939 if not order_sequence and vals .get ("name" , "/" ) == "/" :
4040 vals ["name" ] = self .env ["ir.sequence" ].next_by_code ("purchase.rfq" ) or "/"
4141 return super ().create (vals )
42+
43+ def copy (self , default = None ):
44+ """Allow duplicate PO back to RFQ document"""
45+ self .ensure_one ()
46+ if default is None :
47+ default = dict (default or {}, order_sequence = False , name = "/" )
48+ self = self .with_context (order_sequence = False )
49+ return super ().copy (default )
4250
4351 def _prepare_order_from_rfq (self ):
4452 return {
@@ -62,7 +70,7 @@ def action_convert_to_order(self):
6270 purchase_order .button_confirm ()
6371 # Reference from this RFQ to Purchase Order
6472 self .purchase_order_id = purchase_order .id
65- if self .state == "draft" :
73+ if self .state in [ "draft" , "sent" ] :
6674 self .button_done ()
6775 return self .open_duplicated_purchase_order ()
6876
Original file line number Diff line number Diff line change 66 <field name =" arch" type =" xml" >
77 <xpath expr =" /form/header" position =" attributes" >
88 <attribute
9- name =" invisible "
10- >not context.get ('order_sequence', False)</attribute >
9+ name =" attrs "
10+ >{'invisible': [ ('order_sequence','=', False)]} </attribute >
1111 </xpath >
1212 <xpath expr =" /form/header" position =" after" >
1313 <header
1414 name =" quotation"
1515 attrs =" {'invisible': [('order_sequence','=',True)]}"
1616 >
17+ <button name =" action_rfq_send" states =" draft" string =" Send by Email" type =" object" context =" {'send_rfq':True}" class =" oe_highlight" data-hotkey =" g" />
18+ <button name =" action_rfq_send" states =" sent" string =" Re-Send by Email" type =" object" context =" {'send_rfq':True}" data-hotkey =" g" />
1719 <button
1820 name =" action_convert_to_order"
19- states =" draft"
21+ states =" draft,sent "
2022 class =" oe_highlight"
2123 type =" object"
2224 string =" Convert to Order"
3133 name =" rfq_state"
3234 widget =" statusbar"
3335 statusbar_visible =" draft,done"
34- invisible =" context.get('order_sequence', False)"
3536 />
3637 </header >
3738 </xpath >
You can’t perform that action at this time.
0 commit comments