1
# -*- coding: utf-8 -*-
2
##############################################################################
4
# OpenERP, Open Source Management Solution
5
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
7
# This program is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU Affero General Public License as
9
# published by the Free Software Foundation, either version 3 of the
10
# License, or (at your option) any later version.
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU Affero General Public License for more details.
17
# You should have received a copy of the GNU Affero General Public License
18
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
##############################################################################
24
from report import report_sxw
26
class delivery_report(report_sxw.rml_parse):
27
def __init__(self, cr, uid, name, context=None):
28
super(delivery_report, self).__init__(cr, uid, name, context=context)
29
self.localcontext.update({
31
# 'detail_list':context.get('detail_list', [])
32
'_get_parent':self._get_parent,
33
'_get_childs':self._get_childs
36
def _get_parent(self,pick_id):
39
context=self.localcontext
40
move_obj=self.pool.get('stock.move')
41
move_ids=move_obj.search(cr,uid,[('picking_id','=',pick_id),("parent_bom_id","!=",False)])
42
moves=move_obj.browse(cr,uid,move_ids,context=context)
44
production=move.kit_id
46
product_qty=production.product_qty
47
sale_id=move.sale_id.id
49
parent_move_ids=move_obj.search(cr,uid,[("sale_id","=",sale_id),
50
("product_qty","=",product_qty),
51
("product_id","=",production.product_id.id)])
52
parent_moves=move_obj.browse(cr,uid,parent_move_ids)
53
print "parent_move_ids",parent_move_ids
54
# return {'child_moves':moves,"parent_moves":parent_moves}
58
def _get_childs(self,pick_id):
61
context=self.localcontext
62
move_obj=self.pool.get('stock.move')
63
move_ids=move_obj.search(cr,uid,[('picking_id','=',pick_id),("parent_bom_id","!=",False)])
64
print move_ids,'====================move_ids================================'
65
return move_obj.browse(cr,uid,move_ids,context=context)
67
report_sxw.report_sxw('report.delivery.bom', 'stock.picking', 'addons/assembly_bom/report/delivery_report.rml', parser=delivery_report, header=False)
69
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: