improved_view

bzr revid: fp@tinyerp.com-20081105141513-akhzu5oroujpxe2g
This commit is contained in:
Fabien Pinckaers 2008-11-05 15:15:13 +01:00
commit bc876a1d24
12 changed files with 146 additions and 103 deletions

View File

@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
@ -142,18 +142,19 @@ class account_balance(report_sxw.rml_parse):
return cmp(x.code, y.code)
accounts.sort(cmp_code)
for account in accounts:
if account.id in done:
continue
done[account.id] = 1
res = {
'lid' :'',
'date':'',
'jname':'',
'ref':'',
'lname':'',
'debit1':'',
'credit1':'',
'balance1' :'',
# 'lid' :'',
# 'date':'',
# 'jname':'',
# 'ref':'',
# 'lname':'',
# 'debit1':'',
# 'credit1':'',
# 'balance1' :'',
'id' : account.id,
'type' : account.type,
'code': account.code,
@ -167,40 +168,48 @@ class account_balance(report_sxw.rml_parse):
}
self.sum_debit += account.debit
self.sum_credit += account.credit
if not (res['credit'] or res['debit']) and not account.child_id:
continue
# if not (res['credit'] or res['debit']) and not account.child_id:
# continue
if account.child_id:
def _check_rec(account):
if not account.child_id:
return bool(account.credit or account.debit)
for c in account.child_id:
if _check_rec(c):
if not _check_rec(c):
return True
return False
if not _check_rec(account):
if not _check_rec(account) :
continue
if form['display_account'] == 'bal_mouvement':
if res['credit'] <> 0 or res['debit'] <> 0 or res['balance'] <> 0:
if res['credit'] >= 0 or res['debit'] >= 0 or res['balance'] >= 0 :
result_acc.append(res)
elif form['display_account'] == 'bal_solde':
if res['balance'] <> 0:
if res['balance'] >= 0:
result_acc.append(res)
else:
result_acc.append(res)
res1 = self.moveline(form, account.id,res['level'])
if res1:
for r in res1:
result_acc.append(r)
if account.code=='0':
result_acc.pop(-1)
# if account.code=='0':
# result_acc.pop(-1)
if account.child_id:
ids2 = [(x.code,x.id) for x in account.child_id]
ids2.sort()
result_acc += self.lines(form, [x[1] for x in ids2], done, level+1)
return result_acc
def moveline(self,form,ids,level):
res={}
self.date_lst_string = '\'' + '\',\''.join(map(str,self.date_lst)) + '\''
self.cr.execute(
"SELECT l.id as lid,l.date,j.code as jname, l.ref, l.name as lname, l.debit as debit1, l.credit as credit1 " \
@ -227,7 +236,7 @@ class account_balance(report_sxw.rml_parse):
r['credit']=''
r['balance']=''
r['leef']=''
if sum > 0.0:
if sum >= 0.0:
r['bal_type']=" Dr."
else:
r['bal_type']=" Cr."
@ -271,4 +280,4 @@ class account_balance(report_sxw.rml_parse):
def _sum_debit(self):
return self.sum_debit
report_sxw.report_sxw('report.account.account.balance', 'account.account', 'addons/account/report/account_balance.rml', parser=account_balance, header=False)
report_sxw.report_sxw('report.account.account.balance', 'account.account', 'addons/account/report/account_balance.rml', parser=account_balance, header=False)

View File

@ -2,7 +2,7 @@
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="35.0" y1="35.0" width="525" height="772"/>
<frame id="first" x1="57.0" y1="57.0" width="481" height="728"/>
<pageGraphics>
<setFont name="Helvetica-Bold" size="9"/>
@ -15,11 +15,11 @@
<setFont name="Helvetica" size="9"/>
<drawString x="1.0cm" y="1cm"> [[ time.strftime("%m-%d-%y %H:%M", time.localtime()) ]]</drawString>
<drawString x="19.0cm" y="1cm">Page <pageNumber/></drawString>
<lineMode width="0.7"/>
<lines>1cm 27.7cm 20cm 27.7cm</lines>
<setFont name="Helvetica" size="8"/>
</pageGraphics>
</pageTemplate>
@ -126,25 +126,29 @@
</blockTableStyle>
<paraStyle
name="Level5"
name="Level6"
fontName="Helvetica"
fontSize="8.0" />
<paraStyle
name="Level4"
fontName="Helvetica"
name="Level5"
fontName="Helvetica"
fontSize="8.0" />
<paraStyle
name="Level3"
fontName="Helvetica"
name="Level4"
fontName="Helvetica"
fontSize="8.0" />
<paraStyle
name="Level2"
name="Level3"
fontName="Helvetica"
fontSize="8.0" />
<paraStyle
name="Level2"
firstLineIndent="-0.03cm"
fontName="Helvetica-Bold"
fontName="Helvetica-Bold"
fontSize="8.0" />
<paraStyle name="Level1"
fontSize="8.0"
fontName="Helvetica-Bold"
fontName="Helvetica-Bold"
/>
<paraStyle name="Caption" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Helvetica"/>
@ -170,7 +174,7 @@
<font color="white"> </font>
</para>
<blockTable colWidths="46,278.0,73.0,72.0,82.0" style="Table2" repeatRows="1">
<tr>
<tr noRowsplits="1">
<td>
<para style="P12a">Code</para>
</td>
@ -195,19 +199,18 @@
[[ a['name'] ]]</para>
</td>
<td>
<para style="P3"><font>[[ a['type']=='view' and removeParentNode('font') ]][[ a['debit'] and formatLang(a['debit']) or '0.00' ]]</font>
<font><u>[[ a['type']&lt;&gt;'view' and removeParentNode('font') ]] [[a['debit'] and formatLang(a['debit']) or '0.00' ]]</u></font></para>
<para style="P3"><font>[[ a['type']=='view' and removeParentNode('font') ]][[ a['debit'] and formatLang(a['debit']) or '0.00' ]]</font>
<font>[[ a['type']&lt;&gt;'view' and removeParentNode('font') ]] [[a['debit'] and formatLang(a['debit']) or '0.00' ]]</font></para>
</td>
<td>
<para style="P3"><font>[[ a['type']=='view' and removeParentNode('font') ]][[ a['credit'] and formatLang(a['credit']) or '0.00' ]]</font>
<font><u>[[ a['type']&lt;&gt;'view' and removeParentNode('font') ]] [[a['credit'] and formatLang(a['credit']) or '0.00' ]]</u></font></para>
<para style="P3"><font>[[ a['type']=='view' and removeParentNode('font') ]][[ a['credit'] and formatLang(a['credit']) or '0.00' ]]</font>
<font>[[ a['type']&lt;&gt;'view' and removeParentNode('font') ]] [[a['credit'] and formatLang(a['credit']) or '0.00' ]]</font></para>
</td>
<td>
<para style="P3"><font>[[ a['type']=='view' and removeParentNode('font') ]][[ a['balance'] and formatLang(a['balance']) or '0.00' ]]</font>
<font><u>[[ a['type']&lt;&gt;'view' and removeParentNode('font') ]] [[a['balance'] and formatLang(a['balance']) or '0.00' ]]</u></font></para>
<para style="P3"><font>[[ a['type']=='view' and removeParentNode('font') ]][[ a['balance'] and formatLang(a['balance']) or '0.00' ]]</font>
<font>[[ a['type']&lt;&gt;'view' and removeParentNode('font') ]] [[a['balance'] and formatLang(a['balance']) or '0.00' ]]</font></para>
</td>
</tr>
</blockTable>
</story>
</document>

View File

@ -118,6 +118,7 @@ class general_ledger(rml_parse.rml_parse):
self.child_ids = self.pool.get('account.account').search(self.cr, self.uid,
[('parent_id', 'child_of', self.ids)])
res = []
ctx = self.context.copy()
## We will make the test for period or date
@ -140,6 +141,7 @@ class general_ledger(rml_parse.rml_parse):
child_account = self.pool.get('account.account').browse(self.cr, self.uid, child_id)
sold_account = self._sum_solde_account(child_account,form)
self.sold_accounts[child_account.id] = sold_account
if form['display_account'] == 'bal_mouvement':
@ -159,7 +161,7 @@ class general_ledger(rml_parse.rml_parse):
else:
if child_account.type != 'view' \
and len(self.pool.get('account.move.line').search(self.cr, self.uid,
[('account_id','=',child_account.id)],
[('account_id','>=',child_account.id)],
context=ctx)) <> 0 :
res.append(child_account)
@ -167,6 +169,7 @@ class general_ledger(rml_parse.rml_parse):
## We will now compute solde initiaux
if not len(res):
return[account]
else:
@ -270,7 +273,6 @@ class general_ledger(rml_parse.rml_parse):
def lines(self, account, form):
inv_types = {
'out_invoice': 'CI: ',
'in_invoice': 'SI: ',
@ -313,7 +315,7 @@ class general_ledger(rml_parse.rml_parse):
l['partner'] = line.partner_id.name
else :
l['partner'] = ''
sum += l['debit'] - l ['credit']
sum = l['debit'] - l ['credit']
c = time.strptime(l['date'],"%Y-%m-%d")
l['date'] = time.strftime("%d-%m-%Y",c)
l['progress'] = sum

View File

@ -35,13 +35,13 @@
<blockTableStyle id="tbl_header">
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,2" stop="-1,-1"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="tbl_content">
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,1" stop="-1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
<blockValign value="TOP"/>
</blockTableStyle>
@ -91,9 +91,9 @@
</stylesheet>
<story>
<blockTable colWidths="54.0,135.0,70.0,40.0,80.0,59.0,52.0,54.0" style="tbl_header" repeatRows="1">[[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]]
<blockTable colWidths="66.0,124.0,70.0,40.0,80.0,59.0,52.0,54.0" style="tbl_header" repeatRows="1">[[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]]
<tr>
<td><para style="P3">Date</para></td>
<td><para style="date">Date</para></td>
<td><para style="P3">Partner</para></td>
<td><para style="P3">Ref</para></td>
<td><para style="P3">Mvt</para></td>
@ -102,9 +102,10 @@
<td><para style="P4">Crebit</para></td>
<td><para style="P9">Balance</para></td>
</tr>
<para>[[ repeatIn(objects, 'a') ]]</para>
<para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para>
<tr>
<para>[[ repeatIn(objects, 'a') ]]</para>
<para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para>
<td>
<blockTable colWidths="280.0,100.0,52.5,52.5,52.5" style="Table5">
<tr>
@ -114,25 +115,32 @@
<td alignment="right"><para style="P9b"><u>[[sum_credit_account(o, data['form']) or '0.0' ]]</u></para></td>
<td><para style="P9b"><u>[[sum_solde_account(o, data['form']) or '0.0' ]]</u></para></td>
</tr>
<tr>
<td>[[ repeatIn(lines(o, data['form']), 'line') ]]
<blockTable colWidths="54.0,123.0,70.0,40.0,80.0,59.0,52.0,54.0" style="tbl_content">
<tr>
<td><para style="P3">[[ line['date'] or '' ]]</para></td>
<td><para style="P3">[[ line['partner'] or '']]</para></td>
<td><para style="P3">[[ line['ref'] or '']]</para></td>
<td><para style="P3">[[ line['move'] or '']]</para></td>
<td><para style="P3">[[ line['name'] or '' ]]</para></td>
<td><para style="P4">[[ line['debit'] or '0.0' ]]</para></td>
<td><para style="P4">[[ line['credit'] or '0.0' ]]</para></td>
<td><para style="P4">[[ line['progress'] or '0.0' ]]</para></td>
</tr>
</blockTable>
</td>
</tr>
</blockTable>
</td>
</tr>
<tr>[[ repeatIn(lines(o, data['form']), 'line') ]]
<td><para style="P3">[[ line['date'] or '' ]]</para></td>
<td><para style="P3">[[ line['partner'] or '']]</para></td>
<td><para style="P3">[[ line['ref'] or '']]</para></td>
<td><para style="P3">[[ line['move'] or '']]</para></td>
<td><para style="P3">[[ line['name'] or '' ]]</para></td>
<td><para style="P4">[[ line['debit'] or '0.0' ]]</para></td>
<td><para style="P4">[[ line['credit'] or '0.0' ]]</para></td>
<td><para style="P4">[[ line['progress'] or '0.0' ]]</para></td>
</tr>
</blockTable>
<blockTable colWidths="59.0,105.0,66.0,40.0,100.0,50.0,50.0,50.0,40.0" style="tbl_header" repeatRows="1">[[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]]
<blockTable colWidths="72.0,93.0,66.0,40.0,100.0,50.0,50.0,50.0,40.0" style="tbl_header" repeatRows="1">[[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]]
<tr>
<td><para style="P3">Date</para></td>
<td><para style="date">Date</para></td>
<td><para style="P3">Partner</para></td>
<td><para style="P3">Ref</para></td>
<td><para style="P3">Mvt</para></td>
@ -142,9 +150,10 @@
<td><para style="P4">Balance</para></td>
<td><para style="P4">Currency</para></td>
</tr>
<tr>
<para>[[ repeatIn(objects, 'a') ]]</para>
<para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para>
<tr>
<td>
<blockTable colWidths="264.00,100.0,50.0,50.0,49.0,40.00" style="Table5">
<tr>
@ -155,20 +164,27 @@
<td><para style="P9b"><u>[[sum_solde_account(o, data['form']) or '0.0' ]]</u></para></td>
<td><para style="P9b"><u> [[ sum_currency_amount_account(a, data['form']) or '0.0' ]]</u></para></td>
</tr>
<tr>
<td>[[ repeatIn(lines(o, data['form']), 'line') ]]
<blockTable colWidths="59.0,93.0,66.0,40.0,100.0,50.0,50.0,50.0,40.0" style="tbl_content">
<tr>
<td><para style="P3">[[ line['date'] or '' ]]</para></td>
<td><para style="P3">[[ line['partner'] or '' ]]</para></td>
<td><para style="P3">[[ line['ref'] or '']]</para></td>
<td><para style="P3">[[ line['move'] or '' ]]</para></td>
<td><para style="P3">[[ line['name'] or '' ]]</para></td>
<td><para style="P4">[[ line['debit'] and line['debit'] or '0.0' ]]</para></td>
<td><para style="P4">[[ line['credit'] and line['credit'] or '0.0' ]]</para></td>
<td><para style="P4">[[ line['progress'] and line['progress'] or '0.0' ]]</para></td>
<td><para style="P4">[[ line['amount_currency'] or '0.0' ]] [[ line['currency_code'] or '']]</para></td>
</tr>
</blockTable>
</td>
</tr>
</blockTable>
</td>
</tr>
<tr>[[ repeatIn(lines(o, data['form']), 'line') ]]
<td><para style="P3">[[ line['date'] or '' ]]</para></td>
<td><para style="P3">[[ line['partner'] or '' ]]</para></td>
<td><para style="P3">[[ line['ref'] or '']]</para></td>
<td><para style="P3">[[ line['move'] or '' ]]</para></td>
<td><para style="P3">[[ line['name'] or '' ]]</para></td>
<td><para style="P4">[[ line['debit'] and line['debit'] or '0.0' ]]</para></td>
<td><para style="P4">[[ line['credit'] and line['credit'] or '0.0' ]]</para></td>
<td><para style="P4">[[ line['progress'] and line['progress'] or '0.0' ]]</para></td>
<td><para style="P4">[[ line['amount_currency'] or '0.0' ]] [[ line['currency_code'] or '']]</para></td>
</tr>
</blockTable>
</story>

View File

@ -107,7 +107,7 @@ class general_ledger_landscape(rml_parse.rml_parse):
return result
def get_min_date(self,form):
## Get max born from account_fiscal year
#
sql = """ select min(fy.date_start) as start_date,max(fy.date_stop) as stop_date from account_fiscalyear
@ -122,9 +122,9 @@ class general_ledger_landscape(rml_parse.rml_parse):
periods = form['periods'][0][2]
if not periods:
sql = """
Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.fiscalyear_id = """ + str(form['fiscalyear']) + """
Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.fiscalyear_id = """ + str(form['fiscalyear']) + """
"""
else:
else:
periods_id = ','.join(map(str, periods))
sql = """
Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.id in ( """ + periods_id + """)
@ -140,9 +140,9 @@ class general_ledger_landscape(rml_parse.rml_parse):
periods = form['periods'][0][2]
if not periods:
sql = """
Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.fiscalyear_id = """ + str(form['fiscalyear']) + """
Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.fiscalyear_id = """ + str(form['fiscalyear']) + """
"""
else:
else:
periods_id = ','.join(map(str, periods))
sql = """
Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.id in ( """ + periods_id + """)
@ -162,7 +162,7 @@ class general_ledger_landscape(rml_parse.rml_parse):
else :
borne_max = date_max
elif form['state'] == 'none':
sql = """
SELECT min(date) as start_date,max(date) as stop_date FROM account_move_line """
self.cr.execute(sql)
@ -180,7 +180,7 @@ class general_ledger_landscape(rml_parse.rml_parse):
def get_children_accounts(self, account, form):
self.child_ids = self.pool.get('account.account').search(self.cr, self.uid,
[('parent_id', 'child_of', self.ids)])
#
@ -220,12 +220,12 @@ class general_ledger_landscape(rml_parse.rml_parse):
else:
if child_account.type != 'view' \
and len(self.pool.get('account.move.line').search(self.cr, self.uid,
[('account_id','=',child_account.id)],
[('account_id','>=',child_account.id)],
context=ctx)) <> 0 :
res.append(child_account)
##
if not len(res):
return [account]
else:
## We will now compute solde initiaux
@ -250,7 +250,7 @@ class general_ledger_landscape(rml_parse.rml_parse):
move.init_credit = 0
move.init_debit = 0
return res
def lines(self, account, form):
@ -266,19 +266,19 @@ class general_ledger_landscape(rml_parse.rml_parse):
else:
sorttag = 'j.code'
sql = """
SELECT l.id, l.date, j.code,c.code AS currency_code,l.amount_currency,l.ref, l.name , l.debit, l.credit, l.period_id
SELECT l.id, l.date, j.code,c.code AS currency_code,l.amount_currency,l.ref, l.name , l.debit, l.credit, l.period_id
FROM account_move_line as l
LEFT JOIN res_currency c on (l.currency_id=c.id)
LEFT JOIN res_currency c on (l.currency_id=c.id)
JOIN account_journal j on (l.journal_id=j.id)
AND account_id = %d
AND %s
WHERE l.date<='%s'
AND l.date>='%s'
ORDER by %s"""%(account.id,self.query,self.date_borne['max_date'],self.date_borne['min_date'],sorttag)
AND %s
WHERE l.date<='%s'
AND l.date>='%s'
ORDER by %s"""%(account.id,self.query,self.date_borne['max_date'],self.date_borne['min_date'],sorttag)
self.cr.execute(sql)
res = self.cr.dictfetchall()
res = self.cr.dictfetchall()
sum = 0.0
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
for l in res:
@ -293,7 +293,10 @@ class general_ledger_landscape(rml_parse.rml_parse):
l['partner'] = line.partner_id.name
else :
l['partner'] = ''
sum += l['debit'] - l ['credit']
sum = l['debit'] - l ['credit']
c = time.strptime(l['date'],"%Y-%m-%d")
l['date'] = time.strftime("%d-%m-%Y",c)
l['progress'] = sum

View File

@ -184,19 +184,22 @@ class third_party_ledger(rml_parse.rml_parse):
partner_to_use = []
if data['form']['soldeinit'] :
self.cr.execute(
"SELECT DISTINCT line.partner_id " \
"FROM account_move_line AS line, account_account AS account " \
"WHERE line.partner_id IS NOT NULL " \
"AND line.account_id = account.id " \
"AND line.date >= %s " \
"AND line.date <= %s " \
"AND line.reconcile_id IS NULL " \
"AND line.account_id IN (" + self.account_ids + ") " \
" " + PARTNER_REQUEST + " " \
"AND account.company_id = %d " \
"AND account.active " ,
(self.date_lst[len(self.date_lst)-1],data['form']['company_id']))
(self.date_lst[0],self.date_lst[len(self.date_lst)-1],data['form']['company_id']))
else:
self.cr.execute(
"SELECT DISTINCT line.partner_id " \
"FROM account_move_line AS line, account_account AS account " \
@ -214,6 +217,7 @@ class third_party_ledger(rml_parse.rml_parse):
for res_line in res:
partner_to_use.append(res_line['partner_id'])
new_ids = partner_to_use
self.partner_ids = ','.join(map(str, new_ids))
objects = self.pool.get('res.partner').browse(self.cr, self.uid, new_ids)
super(third_party_ledger, self).preprocess(objects, data, new_ids)
@ -226,6 +230,7 @@ class third_party_ledger(rml_parse.rml_parse):
else:
RECONCILE_TAG = "AND l.reconcile_id IS NULL"
if data['form']['soldeinit'] :
self.cr.execute(
"SELECT l.id,l.date,j.code, l.ref, l.name, l.debit, l.credit " \
"FROM account_move_line l " \
@ -233,11 +238,12 @@ class third_party_ledger(rml_parse.rml_parse):
"ON (l.journal_id = j.id) " \
"WHERE l.partner_id = %d " \
"AND l.account_id IN (" + self.account_ids + ") " \
"AND l.date < %s " \
"AND l.date <= %s " \
"AND l.reconcile_id IS NULL "
"ORDER BY l.id",
(partner.id, self.date_lst[0]))
res = self.cr.dictfetchall()
sum = 0.0
for r in res:
sum = r['debit'] - r['credit']
@ -256,6 +262,7 @@ class third_party_ledger(rml_parse.rml_parse):
"ORDER BY l.id",
(partner.id,))
res = self.cr.dictfetchall()
sum = 0.0
for r in res:
sum = r['debit'] - r['credit']

View File

@ -46,7 +46,7 @@ _aged_trial_fields = {
'result_selection':{
'string':"Filter on Partners",
'type':'selection',
'selection':[('customer','Customer'),('supplier','Supplier'),('all','All')],
'selection':[('customer','Receivable'),('supplier','Payable'),('all','Receivable and Payable')],
'required':True,
'default': lambda *a: 'customer',
},

View File

@ -119,11 +119,11 @@ class wizard_report(wizard.interface):
def _check_state(self, cr, uid, data, context):
if data['form']['state'] == 'byperiod':
data['form']['fiscalyear'] = True
else :
self._check_date(cr, uid, data, context)
if data['form']['state'] == 'bydate' or data['form']['state'] == 'all':
data['form']['fiscalyear'] = False
else :
data['form']['fiscalyear'] = True
self._check_date(cr, uid, data, context)
return data['form']

Binary file not shown.

View File

@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
@ -1211,7 +1211,7 @@ class StockPicking(osv.osv):
# Explode picking by replacing phantom BoMs
#
def action_explode(self, cr, uid, picks, *args):
for move in picks:
for move in self.pool.get('stock.move').browse(cr, uid, picks):
self.pool.get('stock.move')._action_explode(cr, uid, move)
return picks

View File

@ -421,9 +421,11 @@
<field name="name" select="1"/>
<field name="date_planned" select="1"/>
<field name="priority" groups="base.group_extended"/>
<newline/>
<field name="product_id" on_change="product_id_change(product_id)" select="1"/>
<field name="product_qty"/>
<field name="product_uom"/>
<newline/>
<label string="" colspan="2"/>
<field name="product_uos_qty" groups="product.group_uos"/>
<field name="product_uos" groups="product.group_uos"/>

View File

@ -428,7 +428,7 @@ class stock_picking(osv.osv):
for picking in self.browse(cr, uid, ids):
for r in picking.move_lines:
if r.state=='draft':
todo.append(r)
todo.append(r.id)
todo = self.action_explode(cr, uid, todo, context)
if len(todo):
self.pool.get('stock.move').action_confirm(cr, uid, todo, context)
@ -985,8 +985,9 @@ class stock_move(osv.osv):
result[m.picking_id].append( (m, dest) )
return result
def action_confirm(self, cr, uid, moves, context={}):
ids = map(lambda m: m.id, moves)
def action_confirm(self, cr, uid, ids, context={}):
# ids = map(lambda m: m.id, moves)
moves = self.browse(cr, uid, ids)
self.write(cr, uid, ids, {'state':'confirmed'})
for picking, todo in self._chain_compute(cr, uid, moves, context).items():
ptype = self.pool.get('stock.location').picking_type_get(cr, uid, todo[0][0].location_dest_id, todo[0][1][0])