[MERGE] stock fixes
bzr revid: fp@openerp.com-20121110134352-p3xlzt04rvicz6no
This commit is contained in:
commit
a26bd21208
|
@ -293,6 +293,27 @@ class purchase_order(osv.osv):
|
|||
fiscal_position = supplier.property_account_position and supplier.property_account_position.id or False
|
||||
return {'value':{'pricelist_id': pricelist, 'fiscal_position': fiscal_position}}
|
||||
|
||||
def invoice_open(self, cr, uid, ids, context=None):
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
act_obj = self.pool.get('ir.actions.act_window')
|
||||
|
||||
result = mod_obj.get_object_reference(cr, uid, 'account', 'action_invoice_tree2')
|
||||
id = result and result[1] or False
|
||||
result = act_obj.read(cr, uid, [id], context=context)[0]
|
||||
inv_ids = []
|
||||
for po in self.browse(cr, uid, ids, context=context):
|
||||
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
|
||||
return result
|
||||
|
||||
def view_invoice(self, cr, uid, ids, context=None):
|
||||
'''
|
||||
This function returns an action that display existing invoices of given sale order ids. It can either be a in a list or in a form view, if there is only one invoice to show.
|
||||
|
@ -547,7 +568,6 @@ class purchase_order(osv.osv):
|
|||
'invoice_state': '2binvoiced' if order.invoice_method == 'picking' else 'none',
|
||||
'type': 'in',
|
||||
'partner_id': order.dest_address_id.id or order.partner_id.id,
|
||||
'invoice_state': '2binvoiced' if order.invoice_method == 'picking' else 'none',
|
||||
'purchase_id': order.id,
|
||||
'company_id': order.company_id.id,
|
||||
'move_lines' : [],
|
||||
|
|
|
@ -282,8 +282,6 @@
|
|||
<field name="date_approve" groups="base.group_no_one"/>
|
||||
</group>
|
||||
</group>
|
||||
<separator string="Invoices"/>
|
||||
<field name="invoice_ids" context="{'type':'in_invoice', 'journal_type':'purchase'}"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
|
|
|
@ -48,6 +48,8 @@
|
|||
<button type="object"
|
||||
name="view_picking"
|
||||
string="Incoming Shipments" states="approved"/>
|
||||
<button type="object" name="invoice_open"
|
||||
string="Invoices" attrs="{'invisible': [('state', '=', 'draft')]}"/>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
<record id="seq_type_picking_internal" model="ir.sequence.type">
|
||||
<field name="name">Picking INT</field>
|
||||
<field name="code">stock.picking.internal</field>
|
||||
<field name="code">stock.picking</field>
|
||||
</record>
|
||||
|
||||
<!--
|
||||
|
@ -42,7 +42,7 @@
|
|||
|
||||
<record id="seq_picking_internal" model="ir.sequence">
|
||||
<field name="name">Picking INT</field>
|
||||
<field name="code">stock.picking.internal</field>
|
||||
<field name="code">stock.picking</field>
|
||||
<field name="prefix">INT/</field>
|
||||
<field name="padding">5</field>
|
||||
<field name="company_id" eval="False"/>
|
||||
|
|
Loading…
Reference in New Issue