[MERGE]: Merged lp:~openerp-dev/openobject-addons/trunk-improve-purchase-requisition-view-atp-add_open_chatter-nco with some changes
bzr revid: atp@tinyerp.com-20120601121344-zqubz51eh2936zv2
This commit is contained in:
commit
79ccadc73d
|
@ -31,6 +31,7 @@ import decimal_precision as dp
|
|||
class purchase_requisition(osv.osv):
|
||||
_name = "purchase.requisition"
|
||||
_description="Purchase Requisition"
|
||||
_inherit = "mail.thread"
|
||||
_columns = {
|
||||
'name': fields.char('Requisition Reference', size=32,required=True),
|
||||
'origin': fields.char('Source', size=32),
|
||||
|
@ -203,6 +204,28 @@ class purchase_order(osv.osv):
|
|||
_columns = {
|
||||
'requisition_id' : fields.many2one('purchase.requisition','Purchase Requisition')
|
||||
}
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
if not context:
|
||||
context = {}
|
||||
product_obj = self.pool.get('product.product')
|
||||
pur_req_line_obj = self.pool.get('purchase.requisition.line')
|
||||
purchase_order_line_obj = self.pool.get('purchase.order.line')
|
||||
res = super(purchase_order, self).default_get(cr, uid, fields, context=context)
|
||||
product_ids = context.get('product_ids', False)
|
||||
val_list = []
|
||||
if product_ids:
|
||||
for id in product_ids:
|
||||
if id[0] == 4:
|
||||
product_data = pur_req_line_obj.browse(cr, uid, id[1], context=context)
|
||||
line_vals={'product_id': product_data.product_id.id, 'product_qty': product_data.product_qty, 'name': product_data.product_id.name}
|
||||
elif id[0] == 0:
|
||||
product_data = id[2]
|
||||
name = product_obj.browse(cr, uid, product_data.get('product_id'), context=context).name
|
||||
line_vals = {'product_id': product_data.get('product_id'), 'product_qty': product_data.get('product_qty'), 'name': name}
|
||||
val_list.append((0,0,line_vals))
|
||||
res.update({'order_line': val_list})
|
||||
return res
|
||||
|
||||
def wkf_confirm_order(self, cr, uid, ids, context=None):
|
||||
res = super(purchase_order, self).wkf_confirm_order(cr, uid, ids, context=context)
|
||||
proc_obj = self.pool.get('procurement.order')
|
||||
|
|
|
@ -44,15 +44,15 @@
|
|||
<div class="oe_clear"/>
|
||||
</div>
|
||||
<sheet string="Purchase Requisition" layout="auto">
|
||||
<group colspan="4" col="6">
|
||||
<field name="name"/>
|
||||
<field name="user_id"/>
|
||||
<field name="exclusive"/>
|
||||
<field name="date_start"/>
|
||||
<field name="date_end"/>
|
||||
<field name="origin"/>
|
||||
<field name="warehouse_id" widget="selection" groups="stock.group_locations"/>
|
||||
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
|
||||
<group colspan="4" col="4" class="oe_form_group_label_border">
|
||||
<field name="name"/>
|
||||
<field name="exclusive"/>
|
||||
<field name="user_id"/>
|
||||
<field name="date_start"/>
|
||||
<field name="warehouse_id" widget="selection" groups="stock.group_locations"/>
|
||||
<field name="date_end"/>
|
||||
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
|
||||
<field name="origin"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Products">
|
||||
|
@ -69,13 +69,15 @@
|
|||
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
|
||||
</form>
|
||||
</field>
|
||||
<group colspan="2">
|
||||
<label colspan="2" string=""/>
|
||||
<button name="%(action_purchase_requisition_partner)d" string="Request a Quotation" type="action" icon="gtk-execute"
|
||||
attrs="{'readonly': [('state', '=', 'done')]}"/>
|
||||
<group colspan="4" col="4">
|
||||
<button name="%(action_purchase_requisition_partner)d" string="Request a Quotation" type="action" icon="gtk-execute"
|
||||
attrs="{'invisible': [('line_ids','=',False),('state', 'not in', ('in_progress'))]}"/>
|
||||
<group cosplan="4" col="4">
|
||||
<label string="" />
|
||||
</group>
|
||||
</group>
|
||||
<separator colspan="4" string="Quotations"/>
|
||||
<field colspan="4" name="purchase_ids" nolabel="1" mode="tree,form">
|
||||
<field colspan="4" name="purchase_ids" nolabel="1" mode="tree,form" context="{'product_ids': line_ids}" >
|
||||
<tree string="Purchase Order">
|
||||
<field name="name" string="Reference"/>
|
||||
<field name="date_order" string="Order Date"/>
|
||||
|
@ -91,11 +93,13 @@
|
|||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
|
||||
<page string="Notes">
|
||||
<field name="description" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
</notebook>
|
||||
<div class="oe_form_bottom">
|
||||
<field name="message_ids_social" colspan="4" widget="ThreadView" nolabel="1"/>
|
||||
</div>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
|
|
Loading…
Reference in New Issue