Merge pull request #2512 from expsa/Esraa-Ensan-purchase-task
PO button create false in aprrove-done
This commit is contained in:
commit
8705b674f9
|
|
@ -2371,3 +2371,8 @@ msgstr "العرض الموصي به"
|
|||
#: model_terms:ir.ui.view,arch_db:purchase_requisition_custom.purchase_order_custom_form_view
|
||||
msgid "Recommended"
|
||||
msgstr "موصى به"
|
||||
|
||||
#. module: purchase_requisition_custom
|
||||
#: model_terms:ir.ui.view,arch_db:purchase_requisition_custom.purchase_requisition_custom_form_view
|
||||
msgid "RFQs/Orders"
|
||||
msgstr "طلبات عروض الأسعار"
|
||||
|
|
|
|||
|
|
@ -159,6 +159,28 @@ class PurchaseRequisitionCustom(models.Model):
|
|||
|
||||
return action
|
||||
|
||||
|
||||
def action_purchase_orders_view(self):
|
||||
"""Opens the purchase order list related to this requisition."""
|
||||
action = self.env.ref('purchase_requisition.action_purchase_requisition_list').sudo().read()[0]
|
||||
|
||||
action['domain'] = [('requisition_id', '=', self.id)]
|
||||
|
||||
# Modify context to pass required default values
|
||||
if self.state in ('approve','done'):
|
||||
action['context'] = dict(self.env.context,
|
||||
default_requisition_id=self.id,
|
||||
default_user_id=False,
|
||||
create=False
|
||||
)
|
||||
else:
|
||||
action['context'] = dict(self.env.context,
|
||||
default_requisition_id=self.id,
|
||||
default_user_id=False,
|
||||
create=True
|
||||
)
|
||||
return action
|
||||
|
||||
def check_request_field(self):
|
||||
for rec in self:
|
||||
if rec.request_id:
|
||||
|
|
|
|||
|
|
@ -329,6 +329,13 @@
|
|||
<field name="attach_no" widget="statinfo" string="Documents"/>
|
||||
</button>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//div[@name='button_box']//button[@name='%(purchase_requisition.action_purchase_requisition_list)d']" position="replace">
|
||||
<button name="action_purchase_orders_view" type="object" class="oe_stat_button" icon="fa-list-alt"
|
||||
attrs="{'invisible': [('state', '=', 'draft')]}">
|
||||
<field name="order_count" widget="statinfo" string="RFQs/Orders"/>
|
||||
</button>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='name']" position="after">
|
||||
<field invisible="1" readonly="1" name='res_model'/>
|
||||
<field invisible="1" readonly="1" name='res_id'/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue