[FIX]purchase_requisition: TYPO and fix small problem in tender when trying to go to done state when no line exists

bzr revid: csn@openerp.com-20130621140740-u240macejr34w23f
This commit is contained in:
Cedric Snauwaert 2013-06-21 16:07:40 +02:00
parent c4b36bbfd5
commit 539ca35bbb
2 changed files with 14 additions and 8 deletions

View File

@ -50,7 +50,7 @@ class purchase_requisition(osv.osv):
'date_start': fields.datetime('Date'),
'date_end': fields.datetime('Bid Submission Deadline'),
'user_id': fields.many2one('res.users', 'Responsible'),
'exclusive': fields.selection([('exclusive','Select one entire bid'),('multiple','Select lines from different bids')],'Bid Selection Type', required=True, help="Purchase Requisition (exclusive): On the confirmation of a purchase order, it cancels the remaining purchase order.\nPurchase Requisition(Multiple): It allows to have multiple purchase orders.On confirmation of a purchase order it does not cancel the remaining orders"""),
'exclusive': fields.selection([('exclusive','Select only one RFQ (exclusive)'),('multiple','Select multiple RFQ')],'Bid Selection Type', required=True, help="Purchase Requisition (exclusive): On the confirmation of a purchase order, it cancels the remaining purchase order.\nPurchase Requisition(Multiple): It allows to have multiple purchase orders.On confirmation of a purchase order it does not cancel the remaining orders"""),
'description': fields.text('Description'),
'company_id': fields.many2one('res.company', 'Company', required=True),
'purchase_ids' : fields.one2many('purchase.order','requisition_id','Purchase Orders',states={'done': [('readonly', True)]}),
@ -275,12 +275,18 @@ class purchase_requisition(osv.osv):
confirm = False
#check that we have at least confirm one line
for po_line in tender.po_line_ids:
if po_line.state == 'confirmed':
confirm = True
break
if not confirm:
raise osv.except_osv(_('Warning!'), _('You have no line selected for buying.'))
if len(tender.po_line_ids) > 0:
for po_line in tender.po_line_ids:
if po_line.state == 'confirmed':
confirm = True
break
if not confirm:
raise osv.except_osv(_('Warning!'), _('You have no line selected for buying.'))
else:
#set tender to state done because no line exists
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'purchase.requisition', tender.id, 'done', cr)
return True
#check for complete RFQ
for quotation in tender.purchase_ids:

View File

@ -34,7 +34,7 @@
<button name="open_bid" states="in_progress" string="Close Call for Bids" class="oe_highlight"/>
<button name="tender_reset" states="cancel" string="Reset to Draft" type="object" />
<button name="open_product_line" states="open" string="Choose product lines" type="object" class="oe_highlight" groups="purchase.group_advance_bidding"/>
<button name="generate_po" states="open" string="Make Purchase" type="object" class="oe_highlight"/>
<button name="generate_po" states="open" string="Done" type="object" class="oe_highlight"/>
<button name="cancel_requisition" states="draft,in_progress" string="Cancel Call"/>
<field name="state" widget="statusbar" statusbar_visible="draft,in_progress,open,done" statusbar_colors='{"in_progress":"blue"}'/>
</header>