bug fix: Bug #371253 : draft invoice and purchase order invoiced and paid (ref:pso)
bzr revid: mra@tinyerp.com-20090505110023-au321rryj2qxgshk
This commit is contained in:
parent
89e1fe7ff4
commit
0f9228494c
|
@ -135,6 +135,15 @@ class purchase_order(osv.osv):
|
|||
result[line.order_id.id] = True
|
||||
return result.keys()
|
||||
|
||||
def _invoiced(self, cursor, user, ids, name, arg, context=None):
|
||||
res = {}
|
||||
for purchase in self.browse(cursor, user, ids, context=context):
|
||||
if purchase.invoice_id.reconciled:
|
||||
res[purchase.id] = purchase.invoice_id.reconciled
|
||||
else:
|
||||
res[purchase.id] = False
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Order Reference', size=64, required=True, select=True),
|
||||
'origin': fields.char('Origin', size=64,
|
||||
|
@ -163,7 +172,7 @@ class purchase_order(osv.osv):
|
|||
'picking_ids': fields.one2many('stock.picking', 'purchase_id', 'Picking List', readonly=True, help="This is the list of picking list that have been generated for this purchase"),
|
||||
'shipped':fields.boolean('Received', readonly=True, select=True),
|
||||
'shipped_rate': fields.function(_shipped_rate, method=True, string='Received', type='float'),
|
||||
'invoiced':fields.boolean('Invoiced & Paid', readonly=True, select=True),
|
||||
'invoiced': fields.function(_invoiced, method=True, string='Invoiced & Paid', type='boolean'),
|
||||
'invoiced_rate': fields.function(_invoiced_rate, method=True, string='Invoiced', type='float'),
|
||||
'invoice_method': fields.selection([('manual','Manual'),('order','From Order'),('picking','From Picking')], 'Invoicing Control', required=True,
|
||||
help="From Order: a draft invoice will be pre-generated based on the purchase order. The accountant " \
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
<record id="act_invoice_done" model="workflow.activity">
|
||||
<field name="wkf_id" ref="purchase_order"/>
|
||||
<field name="name">invoice_done</field>
|
||||
<field name="action">write({'invoiced':1,'state':'approved'})</field>
|
||||
<field name="action">write({'state':'approved'})</field>
|
||||
<field name="kind">function</field>
|
||||
</record>
|
||||
<record id="act_invoice_end" model="workflow.activity">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
|
@ -46,7 +46,7 @@ class stock_picking(osv.osv):
|
|||
_defaults = {
|
||||
'purchase_id': lambda *a: False,
|
||||
}
|
||||
|
||||
|
||||
def get_currency_id(self, cursor, user, picking):
|
||||
if picking.purchase_id:
|
||||
return picking.purchase_id.pricelist_id.currency_id.id
|
||||
|
@ -93,8 +93,7 @@ class stock_picking(osv.osv):
|
|||
def _invoice_hook(self, cursor, user, picking, invoice_id):
|
||||
purchase_obj = self.pool.get('purchase.order')
|
||||
if picking.purchase_id:
|
||||
purchase_obj.write(cursor, user, [picking.purchase_id.id], {'invoiced':True,
|
||||
'invoice_id': invoice_id,
|
||||
purchase_obj.write(cursor, user, [picking.purchase_id.id], {'invoice_id': invoice_id,
|
||||
})
|
||||
return super(stock_picking, self)._invoice_hook(cursor, user,
|
||||
picking, invoice_id)
|
||||
|
|
Loading…
Reference in New Issue