[IMP] purchase_requisition : onboarding of purchase views
This commit is contained in:
@@ -414,13 +414,7 @@ class purchase_order(osv.osv):
|
||||
inv_ids+= [invoice.id for invoice in po.invoice_ids]
|
||||
if not inv_ids:
|
||||
raise osv.except_osv(_('Error!'), _('Please create Invoices.'))
|
||||
#choose the view_mode accordingly
|
||||
if len(inv_ids)>1:
|
||||
result['domain'] = "[('id','in',["+','.join(map(str, inv_ids))+"])]"
|
||||
else:
|
||||
res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_supplier_form')
|
||||
result['views'] = [(res and res[1] or False, 'form')]
|
||||
result['res_id'] = inv_ids and inv_ids[0] or False
|
||||
result['domain'] = [('id', 'in', inv_ids)]
|
||||
return result
|
||||
|
||||
def view_invoice(self, cr, uid, ids, context=None):
|
||||
|
||||
@@ -265,9 +265,8 @@
|
||||
<div class="oe_clear"/>
|
||||
<field name="notes" class="oe_inline" placeholder="Terms and conditions..."/>
|
||||
</page>
|
||||
<page string="RFQ & Bid">
|
||||
<page string="Bid">
|
||||
<group>
|
||||
<field name="incoterm_id"/>
|
||||
<field name="bid_date"/>
|
||||
<field name="bid_validity"/>
|
||||
</group>
|
||||
@@ -278,6 +277,7 @@
|
||||
<field name="minimum_planned_date"/>
|
||||
<field name="location_id" groups="stock.group_locations"/>
|
||||
<field name="shipped" groups="base.group_no_one"/>
|
||||
<field name="incoterm_id"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="invoice_method"/>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
class="oe_stat_button"
|
||||
icon="fa-truck"
|
||||
attrs="{'invisible': [('shipment_count', '=', 0)]}">
|
||||
<field name="shipment_count" widget="statinfo" string="In Shipments" help="Incoming Shipments"/>
|
||||
<field name="shipment_count" widget="statinfo" string="Shipment" help="Incoming Shipments"/>
|
||||
</button>
|
||||
<button type="object" name="invoice_open"
|
||||
class="oe_stat_button"
|
||||
|
||||
@@ -43,7 +43,7 @@ class purchase_requisition(osv.osv):
|
||||
'origin': fields.char('Source Document'),
|
||||
'ordering_date': fields.date('Scheduled Ordering Date'),
|
||||
'date_end': fields.datetime('Bid Submission Deadline'),
|
||||
'schedule_date': fields.date('Scheduled Date', select=True, help="The expected and scheduled date where all the products are received"),
|
||||
'schedule_date': fields.date('Scheduled Delivery Date', select=True, help="The expected and scheduled delivery date where all the products are received"),
|
||||
'user_id': fields.many2one('res.users', 'Responsible'),
|
||||
'exclusive': fields.selection([('exclusive', 'Select only one RFQ (exclusive)'), ('multiple', 'Select multiple RFQ')], 'Bid Selection Type', required=True, help="Select only one RFQ (exclusive): On the confirmation of a purchase order, it cancels the remaining purchase order.\nSelect multiple RFQ: It allows to have multiple purchase orders.On confirmation of a purchase order it does not cancel the remaining orders"""),
|
||||
'description': fields.text('Description'),
|
||||
@@ -86,6 +86,8 @@ class purchase_requisition(osv.osv):
|
||||
return self.write(cr, uid, ids, {'state': 'cancel'})
|
||||
|
||||
def tender_in_progress(self, cr, uid, ids, context=None):
|
||||
if not all(obj.line_ids for obj in self.pool['purchase.requisition'].browse(cr, uid, ids, context=context)):
|
||||
raise osv.except_osv(_('Warning!'), _('You can not confirm call because there is no product line.'))
|
||||
return self.write(cr, uid, ids, {'state': 'in_progress'}, context=context)
|
||||
|
||||
def tender_open(self, cr, uid, ids, context=None):
|
||||
|
||||
@@ -39,10 +39,11 @@
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,in_progress,open,done" statusbar_colors='{"in_progress":"blue"}'/>
|
||||
</header>
|
||||
<sheet>
|
||||
<div class="oe_right oe_button_box" style="margin-top: 10px">
|
||||
<button name="open_product_line" type="object" string="View Products Lines"
|
||||
<div class="oe_right oe_button_box" name="buttons">
|
||||
<button name="open_product_line" type="object" string="Product Lines" class="oe_stat_button" icon="fa-list"
|
||||
attrs="{'invisible': ['|', ('state', 'not in', ('open','done')), ('exclusive', '=', 'exclusive')]}" groups="purchase.group_advance_bidding"/>
|
||||
|
||||
<button name="open_rfq" type="object" string="RFQs/Bids" class="oe_stat_button" icon="fa-list-alt"
|
||||
attrs="{'invisible': [('state', '=', 'draft')]}"/>
|
||||
</div>
|
||||
<div class="pull-left">
|
||||
<label for="name" class="oe_edit_only oe_inline"/>
|
||||
@@ -50,13 +51,6 @@
|
||||
<field name="name" class="oe_inline" attrs="{'readonly': [('state','not in',('draft'))]}"/>
|
||||
</h1>
|
||||
</div>
|
||||
<div class="pull-left">
|
||||
<label for="origin" class="oe_edit_only oe_inline"/>
|
||||
<h1>
|
||||
<label string="," attrs="{'invisible':[('origin','=',False)]}"/>
|
||||
<field name="origin" class="oe_inline" placeholder="e.g. PO0025"/>
|
||||
</h1>
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="user_id" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'purchase_requisition.group_purchase_requisition_user', 'purchase.group_purchase_user', 'account.group_account_invoice']}" attrs="{'readonly': [('state','not in',('draft'))]}"/>
|
||||
@@ -68,8 +62,8 @@
|
||||
<field name="date_end" attrs="{'readonly': [('state','not in',('draft'))]}"/>
|
||||
<field name="ordering_date" attrs="{'readonly': [('state','not in',('draft'))]}"/>
|
||||
<field name="schedule_date" attrs="{'readonly': [('state','not in',('draft'))]}"/>
|
||||
<field name="origin" placeholder="e.g. OP0025" attrs="{'readonly': [('state','not in',('draft'))]}"/>
|
||||
<field name="picking_type_id" widget="selection" groups="stock.group_locations" attrs="{'readonly': [('state','not in',('draft'))]}"/>
|
||||
<field name="origin" placeholder="e.g. PO0025" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
|
||||
<field name="picking_type_id" widget="selection" groups="stock.group_stock_adv_location" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
|
||||
<field name="company_id" groups="base.group_multi_company" widget="selection" attrs="{'readonly': [('state','not in',('draft'))]}"/>
|
||||
</group>
|
||||
</group>
|
||||
@@ -99,10 +93,9 @@
|
||||
<button name="%(action_purchase_requisition_partner)d" type="action"
|
||||
string="Request a Quotation" icon="gtk-execute"
|
||||
attrs="{'invisible': ['|', ('line_ids','=',[]),('state', 'in', ('draft' ,'open','done'))]}"/>
|
||||
<button name="open_rfq" type="object" string="View RFQs/Bids" attrs="{'invisible': [('state', 'in', ('draft'))]}"/>
|
||||
</div>
|
||||
<separator string="Requests for Quotation"/>
|
||||
<field name="purchase_ids">
|
||||
<field name="purchase_ids" options="{'reload_on_button': true}">
|
||||
<tree string="Purchase Order">
|
||||
<field name="name" string="Reference"/>
|
||||
<field name="date_order" string="Order Date"/>
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
context.update({"active_model": "purchase.requisition","active_ids": [ref("requisition1")],"active_id": ref("requisition1")})
|
||||
-
|
||||
!record {model: purchase.requisition.partner, id: requisition_partner_0}:
|
||||
partner_id: base.res_partner_12
|
||||
partner_ids: [base.res_partner_12]
|
||||
-
|
||||
!python {model: purchase.requisition.partner}: |
|
||||
context.update({"mail_create_nolog" : True })
|
||||
|
||||
@@ -26,7 +26,7 @@ class purchase_requisition_partner(osv.osv_memory):
|
||||
_name = "purchase.requisition.partner"
|
||||
_description = "Purchase Requisition Partner"
|
||||
_columns = {
|
||||
'partner_id': fields.many2one('res.partner', 'Supplier', required=True,domain=[('supplier', '=', True)]),
|
||||
'partner_ids': fields.many2many('res.partner', 'purchase_requisition_supplier_rel', 'requisition_id', 'partner_id', string='Suppliers', required=True, domain=[('supplier', '=', True)])
|
||||
}
|
||||
|
||||
def view_init(self, cr, uid, fields_list, context=None):
|
||||
@@ -41,8 +41,10 @@ class purchase_requisition_partner(osv.osv_memory):
|
||||
|
||||
def create_order(self, cr, uid, ids, context=None):
|
||||
active_ids = context and context.get('active_ids', [])
|
||||
data = self.browse(cr, uid, ids, context=context)[0]
|
||||
self.pool.get('purchase.requisition').make_purchase_order(cr, uid, active_ids, data.partner_id.id, context=context)
|
||||
purchase_requisition = self.pool.get('purchase.requisition')
|
||||
for wizard in self.browse(cr, uid, ids, context=context):
|
||||
for partner_id in wizard.partner_ids:
|
||||
purchase_requisition.make_purchase_order(cr, uid, active_ids, partner_id.id, context=context)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="Choose Supplier">
|
||||
<group>
|
||||
<field name="partner_id" context="{'default_supplier': 1, 'default_customer': 0}"/>
|
||||
<field name="partner_ids" widget="many2many_tags" context="{'default_supplier': 1, 'default_customer': 0}"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button name="create_order" string="Create Request for Quotation" type="object" class="oe_highlight"/>
|
||||
|
||||
Reference in New Issue
Block a user