Skip to content

Commit

Permalink
Merge pull request #43 from jgrandguillaume/add-create-fa-po-button-i…
Browse files Browse the repository at this point in the history
…n-lrl

Add the create FA PO button in LR line
  • Loading branch information
yvaucher committed Nov 19, 2014
2 parents 7f7fc0c + d977ec2 commit 908dd34
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
16 changes: 16 additions & 0 deletions framework_agreement_sourcing/view/requisition_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,21 @@
</field>
</record>

<record model="ir.ui.view" id="view_logistic_requisition_line_form">
<field name="name">logistic.requisition.line.form</field>
<field name="model">logistic.requisition.line</field>
<field name="inherit_id" ref="logistic_requisition.view_logistic_requisition_line_form"/>
<field name="arch" type="xml">
<button name="button_create_po_requisition" states="assigned"
string="Create Call for Bids"
type="object" position="after">
<button name="%(action_view_create_agr_po_from_source)d"
states="assigned"
string="Create Agreement Purchase Order"
type="action"/>
</button>
</field>
</record>

</data>
</openerp>
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
##############################################################################
from openerp.osv import orm, fields
from openerp.tools.translate import _
from openerp.exceptions import except_orm


class logistic_requisition_source_po_creator(orm.TransientModel):
Expand Down Expand Up @@ -84,7 +85,17 @@ def action_create_agreement_po_requisition(self, cr, uid, ids,
context=None):
""" Implement buttons that create PO from selected source lines"""
act_obj = self.pool['ir.actions.act_window']
source_ids = context['active_ids']
lr_line_obj = self.pool['logistic.requisition.line']
if context.get('active_model') == 'logistic.requisition.line':
lr_lines = lr_line_obj.browse(cr, uid, context['active_ids'],
context=context)
source_ids = [s_line.id for s_line in lr_lines.source_ids]
else:
source_ids = context['active_ids']
if not source_ids:
raise except_orm(_('No sourcing line Found'),
_('No sourcing line were found, '
'please create one.'))
form = self.browse(cr, uid, ids, context=context)[0]
pricelist = form.pricelist_id

Expand Down

0 comments on commit 908dd34

Please sign in to comment.