[IMP]: usability improvement for make invoice for seller wizard
bzr revid: atp@tinyerp.co.in-20100802121125-ebeuypntdalhtaoa
This commit is contained in:
parent
6593d8bc70
commit
0d2501b77e
|
@ -428,12 +428,10 @@ class auction_lots(osv.osv):
|
|||
res[lot.id] = total_tax
|
||||
return res
|
||||
|
||||
def _is_paid_vnd(self, cr, uid, ids, context=None):
|
||||
def _is_paid_vnd(self, cr, uid, ids, *a):
|
||||
res = {}
|
||||
|
||||
if not context:
|
||||
context={}
|
||||
lots=self.browse(cr, uid, ids, context)
|
||||
|
||||
lots=self.browse(cr, uid, ids)
|
||||
for lot in lots:
|
||||
res[lot.id] = False
|
||||
if lot.sel_inv_id:
|
||||
|
|
|
@ -34,14 +34,13 @@ class auction_lots_make_invoice(osv.osv_memory):
|
|||
'amount': fields.float('Invoiced Amount', required =True, readonly=True),
|
||||
'objects':fields.integer('# of objects', required =True, readonly=True),
|
||||
'number':fields.char('Invoice Number', size=64),
|
||||
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'number': lambda *a: False,
|
||||
}
|
||||
|
||||
def default_get(self, cr, uid, fields, context):
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
"""
|
||||
To get default values for the object.
|
||||
@param self: The object pointer.
|
||||
|
@ -51,16 +50,18 @@ class auction_lots_make_invoice(osv.osv_memory):
|
|||
@param context: A standard dictionary
|
||||
@return: A dictionary which of fields with values.
|
||||
"""
|
||||
res = super(auction_lots_make_invoice, self).default_get(cr, uid, fields, context=context)
|
||||
for lot in self.pool.get('auction.lots').browse(cr, uid, context.get('active_ids', [])):
|
||||
if not context:
|
||||
context={}
|
||||
res = super(auction_lots_make_invoice, self).default_get(cr, uid, fields, context=context)
|
||||
lots_obj = self.pool.get('auction.lots')
|
||||
for lot in lots_obj.browse(cr, uid, context.get('active_ids', [])):
|
||||
if 'amount' in fields:
|
||||
res.update({'amount': lot.buyer_price})
|
||||
if 'objects' in fields:
|
||||
res.update({'objects': len(context['active_ids'])})
|
||||
res.update({'objects': len(context.get('active_ids', []))})
|
||||
return res
|
||||
|
||||
|
||||
def makeInvoices(self, cr, uid, ids, context):
|
||||
def makeInvoices(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Seller invoice :Create an invoice.
|
||||
@param cr: the current row, from the database cursor.
|
||||
|
@ -68,11 +69,13 @@ class auction_lots_make_invoice(osv.osv_memory):
|
|||
@param ids: List of Auction lots make invoice’s IDs
|
||||
@return: dictionary of account invoice form.
|
||||
"""
|
||||
if not context:
|
||||
context={}
|
||||
order_obj = self.pool.get('auction.lots')
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
|
||||
id = mod_obj.read(cr, uid, result, ['res_id'])
|
||||
lots_ids = order_obj.seller_trans_create(cr, uid, context['active_ids'], context)
|
||||
lots_ids = order_obj.seller_trans_create(cr, uid, context.get('active_ids', []), context)
|
||||
return {
|
||||
'domain': "[('id','in', ["+','.join(map(str, lots_ids))+"])]",
|
||||
'name': 'Seller invoices',
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
</group>
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-ok" string="Create invoices" name="makeInvoices" type="object"/>
|
||||
<button icon="gtk-close" special="cancel" string="Close"/>
|
||||
<button icon="gtk-yes" string="Create invoices" name="makeInvoices" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
|
|
Loading…
Reference in New Issue