40
40
class report_profit_picking(osv.Model):
41
42
def _get_invoice_line(self, cr, uid, ids, field_name, arg, context={}):
43
aml_obj = self.pool.get('account.move.line')
44
purchase_obj = self.pool.get('purchase.order')
45
sale_obj = self.pool.get('sale.order')
46
44
il_obj = self.pool.get('account.invoice.line')
47
45
loc_obj = self.pool.get('stock.location')
334
330
if line.invoice_id and line.invoice_id.id:
335
331
if line.location_dest_id.id == loc_ids and \
336
332
line.invoice_id.type == 'in_invoice':
337
subtot = line.picking_qty*line.invoice_price_unit
333
subtot = line.picking_qty * line.invoice_price_unit
339
335
if line.location_id.id == loc_ids and \
340
336
line.invoice_id.type == 'out_invoice':
341
subtot = line.picking_qty*avg
337
subtot = line.picking_qty * avg
343
339
if line.location_dest_id.id == loc_ids and\
344
340
line.invoice_id.type == 'in_refund':
492
488
string='Invoice line'),
493
489
'invoice_qty': fields.function(_get_invoice_qty, method=True,
494
490
type='float', string='Invoice quantity',
496
dp.get_precision('Account')),
491
digits_compute=dp.get_precision('Account')),
497
492
'aml_cost_qty': fields.function(_get_aml_cost_qty, method=True,
499
494
string='Cost entry quantity',
501
dp.get_precision('Account')),
495
digits_compute=dp.get_precision('Account')),
502
496
'invoice_price_unit': fields.function(_get_invoice_price, method=True,
504
498
string='Invoice price unit',
506
dp.get_precision('Account')),
499
digits_compute=dp.get_precision('Account')),
507
500
'aml_cost_price_unit': fields.function(_get_aml_cost_price,
508
501
method=True, type='float',
509
502
string='Cost entry price unit',
511
dp.get_precision('Account')),
503
digits_compute=dp.get_precision('Account')),
512
504
'invoice_id': fields.function(_get_invoice, method=True,
514
506
relation='account.invoice',
515
507
string='Invoice'),
516
508
'stock_before': fields.function(_get_prod_stock_before, method=True,
517
509
type='float', string='Stock before',
519
dp.get_precision('Account')),
510
digits_compute=dp.get_precision('Account')),
520
511
'stock_after': fields.function(_get_prod_stock_after, method=True,
521
512
type='float', string='Stock after',
523
dp.get_precision('Account')),
513
digits_compute=dp.get_precision('Account')),
524
514
'date_inv': fields.function(_get_date_invoice, method=True,
525
515
type='char', string='Date invoice',
527
517
'stock_invoice': fields.function(_get_stock_invoice, method=True,
528
518
type='float', string='Stock invoice',
530
dp.get_precision('Account')),
519
digits_compute=dp.get_precision('Account')),
531
520
'subtotal': fields.function(_compute_subtotal, method=True,
532
521
type='float', string='Subtotal',
534
dp.get_precision('Account')),
522
digits_compute=dp.get_precision('Account')),
535
523
'total': fields.function(_compute_total, method=True, type='float',
537
525
digits_compute=dp.get_precision('Account')),
542
530
'aml_inv_price_unit': fields.function(_get_aml_inv_price, method=True,
544
532
string='Inv entry price unit',
546
dp.get_precision('Account')),
533
digits_compute=dp.get_precision('Account')),
547
534
'aml_inv_qty': fields.function(_get_aml_inv_qty, method=True,
549
536
string='Inv entry quantity',
551
dp.get_precision('Account')),
537
digits_compute=dp.get_precision('Account')),
554
540
def init(self, cr):