~vauxoo/addons-vauxoo/6.0-trunk

« back to all changes in this revision

Viewing changes to stock_card/report_profit_picking.py

  • Committer: Moises Lopez
  • Date: 2014-10-09 21:30:17 UTC
  • mfrom: (879.1.7 trunk-addons-vauxoo)
  • Revision ID: moylop260@vauxoo.com-20141009213017-u3jicyg8xery3r8c
[MERGE] upforward 7.0
-Fix unused import
-Fix relative import
-Fix full path import
-Fix trailing whitespace pylint error C0303
-Fix autopep8 ignoring E501 & E128
-Fix reimported
-Fix __openerp__.py files
-Translate update

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
 
39
39
 
40
40
class report_profit_picking(osv.Model):
 
41
 
41
42
    def _get_invoice_line(self, cr, uid, ids, field_name, arg, context={}):
42
43
        result = {}
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')
48
46
 
212
210
                        amount = rpp.aml_cost_id.debit
213
211
                    else:
214
212
                        amount = rpp.aml_cost_id.credit
215
 
                    price_unit = amount/rpp.aml_cost_id.quantity
 
213
                    price_unit = amount / rpp.aml_cost_id.quantity
216
214
                    res[rpp.id] = price_unit
217
215
        return res
218
216
 
227
225
                        amount = rpp.aml_inv_id.debit
228
226
                    else:
229
227
                        amount = rpp.aml_inv_id.credit
230
 
                    price_unit = amount/rpp.aml_inv_id.quantity
 
228
                    price_unit = amount / rpp.aml_inv_id.quantity
231
229
                    res[rpp.id] = price_unit
232
230
        return res
233
231
 
324
322
 
325
323
        loc_ids = 11
326
324
        avg = 1430.96
327
 
        q = 5.0
328
325
        # total=7154,8
329
 
        total = avg*q
330
326
        for line in self.browse(cr, uid, ids, context=context):
331
327
            subtot = 0.0
332
328
            res.setdefault(line.id, 0.0)
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
338
334
 
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
342
338
 
343
339
                if line.location_dest_id.id == loc_ids and\
344
340
                        line.invoice_id.type == 'in_refund':
346
342
                            line.invoice_id.parent_id.id:
347
343
                        for il in line.invoice_id.parent_id.invoice_line:
348
344
                            if il.product_id.id == line.product_id.id:
349
 
                                subtot = line.picking_qty*il.price_unit
 
345
                                subtot = line.picking_qty * il.price_unit
350
346
 
351
347
            res[line.id] = subtot
352
348
        return res
363
359
            res.setdefault(line.id, 0.0)
364
360
 
365
361
            if tot[line.product_id.id] == 'xxx':
366
 
                tot[line.product_id.id] = avg*q
 
362
                tot[line.product_id.id] = avg * q
367
363
 
368
364
            if line.invoice_id and line.invoice_id.id:
369
365
                if line.location_dest_id.id == loc_ids and\
492
488
                                           string='Invoice line'),
493
489
        'invoice_qty': fields.function(_get_invoice_qty, method=True,
494
490
                                       type='float', string='Invoice quantity',
495
 
                                       digits_compute=
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,
498
493
                                        type='float',
499
494
                                        string='Cost entry quantity',
500
 
                                        digits_compute=
501
 
                                        dp.get_precision('Account')),
 
495
                                        digits_compute=dp.get_precision('Account')),
502
496
        'invoice_price_unit': fields.function(_get_invoice_price, method=True,
503
497
                                              type='float',
504
498
                                              string='Invoice price unit',
505
 
                                              digits_compute=
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',
510
 
                                               digits_compute=
511
 
                                               dp.get_precision('Account')),
 
503
                                               digits_compute=dp.get_precision('Account')),
512
504
        'invoice_id': fields.function(_get_invoice, method=True,
513
505
                                      type='many2one',
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',
518
 
                                        digits_compute=
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',
522
 
                                       digits_compute=
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',
526
516
                                    size=20),
527
517
        'stock_invoice': fields.function(_get_stock_invoice, method=True,
528
518
                                         type='float', string='Stock invoice',
529
 
                                         digits_compute=
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',
533
 
                                    digits_compute=
534
 
                                    dp.get_precision('Account')),
 
522
                                    digits_compute=dp.get_precision('Account')),
535
523
        'total': fields.function(_compute_total, method=True, type='float',
536
524
                                 string='Total',
537
525
                                 digits_compute=dp.get_precision('Account')),
542
530
        'aml_inv_price_unit': fields.function(_get_aml_inv_price, method=True,
543
531
                                              type='float',
544
532
                                              string='Inv entry price unit',
545
 
                                              digits_compute=
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,
548
535
                                       type='float',
549
536
                                       string='Inv entry quantity',
550
 
                                       digits_compute=
551
 
                                       dp.get_precision('Account')),
 
537
                                       digits_compute=dp.get_precision('Account')),
552
538
    }
553
539
 
554
540
    def init(self, cr):