Bugfixes and improvement
bzr revid: fp@tinyerp.com-55519a2f81bdd9229604b2bdbf9585ea972f2ff9
This commit is contained in:
parent
075e447ed7
commit
d80a097fe7
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name" : "Account Chart",
|
||||
"name" : "Charts of Accounts",
|
||||
"version" : "1.1",
|
||||
"depends" : ["account"],
|
||||
"author" : "Tiny",
|
||||
|
|
|
@ -305,6 +305,10 @@ class crm_case(osv.osv):
|
|||
else:
|
||||
res[case.id] = False
|
||||
return res
|
||||
def copy(self, cr, uid, id, default=None, context={}):
|
||||
if not default: default = {}
|
||||
default.update( {'state':'draft', 'id':False, 'history_line':[],'log_ids':[]})
|
||||
return super(crm_case, self).copy(cr, uid, id, default, context)
|
||||
|
||||
_columns = {
|
||||
'id': fields.integer('ID', readonly=True),
|
||||
|
|
|
@ -70,32 +70,52 @@ class account_analytic_profit(report_sxw.rml_parse):
|
|||
])
|
||||
res={}
|
||||
for line in line_obj.browse(self.cr, self.uid, ids):
|
||||
if line.to_invoice:
|
||||
id=line.to_invoice.id
|
||||
name=line.to_invoice.name
|
||||
discount=line.to_invoice.factor
|
||||
else:
|
||||
if line.account_id.pricelist_id:
|
||||
name="Fixed Price"
|
||||
if line.account_id.pricelist_id:
|
||||
if line.account_id.to_invoice:
|
||||
if line.to_invoice:
|
||||
id=line.to_invoice.id
|
||||
name=line.to_invoice.name
|
||||
discount=line.to_invoice.factor
|
||||
else:
|
||||
name="/"
|
||||
discount=1.0
|
||||
id = -1
|
||||
else:
|
||||
name="Fixed"
|
||||
discount=0.0
|
||||
id=0
|
||||
else:
|
||||
name="/"
|
||||
discount=1.0
|
||||
id = -1
|
||||
if line.account_id.pricelist_id:
|
||||
pl=line.account_id.pricelist_id.id
|
||||
price=price_obj.price_get(self.cr, self.uid, [pl], line.product_id.id, line.unit_amount or 1.0, line.account_id.partner_id.id)[pl]
|
||||
else:
|
||||
name="/"
|
||||
discount=1.0
|
||||
id = -1
|
||||
price=0.0
|
||||
if id not in res:
|
||||
res[id]={'name': name, 'amount': 0, 'cost':0, 'unit_amount':0,}
|
||||
res[id]['amount']+=round(price * line.unit_amount * (1-(discount or 0.0)/100.0), 2)
|
||||
res[id]={'name': name, 'amount': 0, 'cost':0, 'unit_amount':0,'amount_th':0}
|
||||
xxx = round(price * line.unit_amount * (1-(discount or 0.0)), 2)
|
||||
res[id]['amount_th']+=xxx
|
||||
if line.invoice_id:
|
||||
self.cr.execute('select id from account_analytic_line where invoice_id=%d', (line.invoice_id.id,))
|
||||
tot = 0
|
||||
for lid in self.cr.fetchall():
|
||||
lid2 = line_obj.browse(self.cr, self.uid, lid[0])
|
||||
pl=lid2.account_id.pricelist_id.id
|
||||
price=price_obj.price_get(self.cr, self.uid, [pl], lid2.product_id.id, lid2.unit_amount or 1.0, lid2.account_id.partner_id.id)[pl]
|
||||
tot += price * lid2.unit_amount * (1-(discount or 0.0))
|
||||
if tot:
|
||||
procent = line.invoice_id.amount_untaxed / tot
|
||||
res[id]['amount'] += xxx * procent
|
||||
else:
|
||||
res[id]['amount'] += xxx
|
||||
else:
|
||||
res[id]['amount'] += xxx
|
||||
|
||||
res[id]['cost']+=line.amount
|
||||
res[id]['unit_amount']+=line.unit_amount
|
||||
for id in res:
|
||||
res[id]['profit']=res[id]['amount']+res[id]['cost']
|
||||
res[id]['eff']=abs(round(res[id]['amount'] / res[id]['cost'] * 100, 2))
|
||||
res[id]['eff']='%d' % (-res[id]['amount'] / res[id]['cost'] * 100,)
|
||||
return res.values()
|
||||
|
||||
def _lines(self, form):
|
||||
|
|
|
@ -1,226 +1,236 @@
|
|||
<?xml version="1.0"?>
|
||||
<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="57.0" width="525" height="728"/>
|
||||
</pageTemplate>
|
||||
</template>
|
||||
<stylesheet>
|
||||
<blockTableStyle id="Standard_Outline">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table5">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table8">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="GRID" colorName="black"/>
|
||||
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="3,0" stop="3,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="4,0" stop="4,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="5,0" stop="5,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="6,0" stop="6,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table4">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table1">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table6">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table7">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
<paraStyle name="P1" fontName="Times-Roman" alignment="LEFT"/>
|
||||
<paraStyle name="P2" fontName="Times-Bold" fontSize="20.0" leading="25" alignment="CENTER"/>
|
||||
<paraStyle name="P3" fontName="Times-Bold" fontSize="10.0" leading="13" alignment="RIGHT"/>
|
||||
<paraStyle name="P4" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="RIGHT"/>
|
||||
<paraStyle name="P5" fontName="Times-Roman" alignment="LEFT"/>
|
||||
<paraStyle name="P6" fontName="Times-Roman" alignment="LEFT"/>
|
||||
<paraStyle name="P7" fontName="Times-Roman" alignment="RIGHT"/>
|
||||
<paraStyle name="P8" fontName="Times-Roman" fontSize="6.0" leading="8"/>
|
||||
<paraStyle name="P9" fontName="Helvetica-Bold" fontSize="16.0" leading="20"/>
|
||||
<paraStyle name="P10" fontName="Times-Roman" alignment="RIGHT"/>
|
||||
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Contents" fontName="Times-Roman"/>
|
||||
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
|
||||
<paraStyle name="Caption" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||
<paraStyle name="Preformatted Text" fontName="Courier" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="Untitled1" fontName="Times-Roman"/>
|
||||
</stylesheet>
|
||||
<story>
|
||||
<blockTable colWidths="175.0,175.0,175.0" repeatRows="1" style="Table5">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P1">[[ company.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2">Invoice rate</para>
|
||||
<para style="P2">by user</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">Period from [[ data['form']['date_from'] ]]</para>
|
||||
<para style="P3">to [[ data['form']['date_to'] ]]</para>
|
||||
<para style="P4">Currency: [[ company.currency_id.name ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P5">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="118.0,59.0,77.0,70.0,65.0,59.0,68.0" style="Table8">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P6">Employee</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P6">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">Units</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">Income</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">Cost</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">Profit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">Eff.</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P5">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<section>
|
||||
<para style="P8">[[ repeatIn(user_ids(lines(data['form'])), 'e') ]]</para>
|
||||
<blockTable colWidths="104.0,421.0" style="Table4">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P9">[[ e.name ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="Table Contents">[[ repeatIn(journal_ids(data['form'], e.id), 'j') ]]</para>
|
||||
<para style="Untitled1">[[ j.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<blockTable colWidths="71.0,77.0,71.0,64.0,64.0,64.0" style="Table1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P10">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ reduce(lambda x, y: x+y['unit_amount'], line(data['form'], [j.id], [e.id]), 0)]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ reduce(lambda x, y: x+y['amount'], line(data['form'], [j.id], [e.id]), 0) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ reduce(lambda x, y: x+y['cost'], line(data['form'], [j.id], [e.id]), 0) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ reduce(lambda x, y: x+y['profit'], line(data['form'], [j.id], [e.id]), 0)]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ round( reduce(lambda x, y: x+y['eff'], line(data['form'], [j.id], [e.id]), 0)/len(line(data['form'], [j.id], [e.id])) , 2)]] %</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P7">[[ repeatIn(line(data['form'], [j.id], [e.id]), 'l') ]]</para>
|
||||
<para style="P7">[[ l['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ l['unit_amount'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ l['amount'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ l['cost'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ l['profit'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ l['eff'] ]] %</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</section>
|
||||
<blockTable colWidths="103.0,422.0" style="Table6">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P9">Totals</para>
|
||||
</td>
|
||||
<td>
|
||||
<blockTable colWidths="74.0,73.0,72.0,65.0,63.0,64.0" style="Table7">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P7">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ reduce(lambda x, y: x+y['unit_amount'], line(data['form'], data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ reduce(lambda x, y: x+y['amount'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ reduce(lambda x, y: x+y['cost'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ reduce(lambda x, y: x+y['profit'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">[[ round(reduce(lambda x, y: x+y['amount'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0)/reduce(lambda x, y: x+y['cost'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0)* -100, 2)]] %</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="Table Contents">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="Standard">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</story>
|
||||
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
|
||||
<pageTemplate id="first">
|
||||
<frame id="first" x1="35.0" y1="57.0" width="525" height="728"/>
|
||||
</pageTemplate>
|
||||
</template>
|
||||
<stylesheet>
|
||||
<blockTableStyle id="Standard_Outline">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table5">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table8">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="GRID" colorName="black"/>
|
||||
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="3,0" stop="3,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="4,0" stop="4,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="5,0" stop="5,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="6,0" stop="6,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="7,0" stop="7,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table4">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table1">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table6">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table7">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
<paraStyle name="P1" fontName="Times-Roman" alignment="LEFT"/>
|
||||
<paraStyle name="P2" fontName="Times-Bold" fontSize="20.0" leading="25" alignment="CENTER"/>
|
||||
<paraStyle name="P3" fontName="Times-Bold" fontSize="10.0" leading="13" alignment="RIGHT"/>
|
||||
<paraStyle name="P4" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="RIGHT"/>
|
||||
<paraStyle name="P5" fontName="Times-Roman" fontSize="6.0" leading="8"/>
|
||||
<paraStyle name="P6" fontName="Times-Roman" alignment="LEFT"/>
|
||||
<paraStyle name="P7" fontName="Helvetica-Bold" fontSize="14.0" leading="20"/>
|
||||
<paraStyle name="P8" fontName="Times-Roman" alignment="RIGHT"/>
|
||||
<paraStyle name="P9" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT"/>
|
||||
<paraStyle name="P10" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT"/>
|
||||
<paraStyle name="P11" fontName="Times-Roman" fontSize="10.0" leading="13"/>
|
||||
<paraStyle name="P12" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="RIGHT"/>
|
||||
<paraStyle name="P13" fontName="Times-Roman" fontSize="10.0" leading="13"/>
|
||||
<paraStyle name="P14" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="RIGHT"/>
|
||||
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Contents" fontName="Times-Roman"/>
|
||||
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
|
||||
<paraStyle name="Caption" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||
<paraStyle name="Preformatted Text" fontName="Courier" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="Untitled1" fontName="Times-Roman"/>
|
||||
</stylesheet>
|
||||
<images/>
|
||||
<story>
|
||||
<blockTable colWidths="145.0,235.0,145.0" repeatRows="1" style="Table5">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P1">[[ company.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2">Invoice rate by user</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">Period from [[ data['form']['date_from'] ]]</para>
|
||||
<para style="P3">to [[ data['form']['date_to'] ]]</para>
|
||||
<para style="P4">Currency: [[ company.currency_id.name ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P6">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="118.0,44.0,55.0,67.0,68.0,66.0,55.0,50.0" style="Table8">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P9">Employee</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P10">Units</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P10">Theorical</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P10">Income</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P10">Cost</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P10">Profit</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P10">Eff.</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P6">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<section>
|
||||
<para style="P5">[[ repeatIn(user_ids(lines(data['form'])), 'e') ]]</para>
|
||||
<para style="P7">[[ e.name ]]</para>
|
||||
<blockTable colWidths="92.0,433.0" style="Table4">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P11">[[ repeatIn(journal_ids(data['form'], e.id), 'j') ]]</para>
|
||||
<para style="P13">[[ j.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<blockTable colWidths="70.0,55.0,68.0,68.0,66.0,55.0,50.0" style="Table1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P14">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">[[ reduce(lambda x, y: x+y['unit_amount'], line(data['form'], [j.id], [e.id]), 0)]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">[[ reduce(lambda x, y: x+y['amount_th'], line(data['form'], [j.id], [e.id]), 0) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">[[ reduce(lambda x, y: x+y['amount'], line(data['form'], [j.id], [e.id]), 0) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">[[ reduce(lambda x, y: x+y['cost'], line(data['form'], [j.id], [e.id]), 0) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">[[ reduce(lambda x, y: x+y['profit'], line(data['form'], [j.id], [e.id]), 0)]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">[[ '%d' % (-reduce(lambda x, y: x+y['amount'], line(data['form'], [j.id], [e.id]), 0) / reduce(lambda x, y: x+y['cost'], line(data['form'], [j.id], [e.id]), 0) * 100.0,)]] %
|
||||
</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P12">[[ repeatIn(line(data['form'], [j.id], [e.id]), 'l') ]]</para>
|
||||
<para style="P12">[[ l['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">[[ l['unit_amount'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">[[ l['amount_th'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">[[ l['amount'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">[[ l['cost'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">[[ l['profit'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">[[ l['eff'] ]] %</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</section>
|
||||
<blockTable colWidths="103.0,422.0" style="Table6">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P7">Totals</para>
|
||||
</td>
|
||||
<td>
|
||||
<blockTable colWidths="59.0,55.0,67.0,68.0,66.0,55.0,51.0" style="Table7">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P12">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">[[ reduce(lambda x, y: x+y['unit_amount'], line(data['form'], data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">[[ reduce(lambda x, y: x+y['amount'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">[[ reduce(lambda x, y: x+y['cost'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">[[ reduce(lambda x, y: x+y['profit'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">[[ '%d' % (-reduce(lambda x, y: x+y['amount'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0)/reduce(lambda x, y: x+y['cost'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0)* 100, )]] %</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</story>
|
||||
</document>
|
||||
|
||||
|
|
|
@ -34,8 +34,8 @@ form='''<?xml version="1.0"?>
|
|||
<form string="Choose">
|
||||
<field name="date_from"/>
|
||||
<field name="date_to"/>
|
||||
<field name="journal_ids" colspan="3"/>
|
||||
<field name="employee_ids" colspan="3"/>
|
||||
<field name="journal_ids" colspan="4"/>
|
||||
<field name="employee_ids" colspan="4"/>
|
||||
</form>'''
|
||||
|
||||
class wizard_report(wizard.interface):
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"version" : "1.1",
|
||||
"author" : "Tiny",
|
||||
"category" : "Localisation/Account charts",
|
||||
"depends" : ["base", "account", "account_report", "base_vat", "base_iban",
|
||||
"depends" : ["account", "account_report", "base_vat", "base_iban",
|
||||
"account_chart"],
|
||||
"init_xml" : [],
|
||||
"demo_xml" : ["account_demo.xml","account.report.report.csv"],
|
||||
|
|
|
@ -385,8 +385,10 @@
|
|||
<field name="product_id" on_change="product_id_change(product_id)" select="1"/>
|
||||
<field name="product_qty"/>
|
||||
<field name="product_uom"/>
|
||||
<!--
|
||||
<field name="product_uos_qty"/>
|
||||
<field name="product_uos"/>
|
||||
-->
|
||||
<field name="bom_id" select="2"/>
|
||||
|
||||
<newline/>
|
||||
|
@ -664,6 +666,7 @@
|
|||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Minimum Stock Rules">
|
||||
<field name="name"/>
|
||||
<field name="warehouse_id"/>
|
||||
<field name="product_id"/>
|
||||
<field name="product_uom"/>
|
||||
|
|
|
@ -41,7 +41,7 @@ class price_type(osv.osv):
|
|||
sale and purchase prices based on some fields of the product.
|
||||
"""
|
||||
def _price_field_get(self, cr, uid, context={}):
|
||||
cr.execute('select name, field_description from ir_model_fields where model in (%s,%s) and ttype=%s', ('product.product', 'product.template', 'float'))
|
||||
cr.execute('select name, field_description from ir_model_fields where model in (%s,%s) and ttype=%s order by name', ('product.product', 'product.template', 'float'))
|
||||
return cr.fetchall()
|
||||
def _get_currency(self, cr, uid, ctx):
|
||||
comp = self.pool.get('res.users').browse(cr,uid,uid).company_id
|
||||
|
|
|
@ -44,12 +44,14 @@ class report_account_analytic_planning(osv.osv):
|
|||
'stat_ids': fields.one2many('report_account_analytic.planning.stat', 'planning_id', 'Planning analysis', readonly=True),
|
||||
'stat_user_ids': fields.one2many('report_account_analytic.planning.stat.user', 'planning_id', 'Planning by user', readonly=True),
|
||||
'stat_account_ids': fields.one2many('report_account_analytic.planning.stat.account', 'planning_id', 'Planning by account', readonly=True),
|
||||
'state': fields.selection([('open','Open'),('done','Done')], 'State', required=True)
|
||||
}
|
||||
_defaults = {
|
||||
'name': lambda *a: time.strftime('%Y-%m-%d'),
|
||||
'date_from': lambda *a: time.strftime('%Y-%m-01'),
|
||||
'date_to': lambda *a: (mx.DateTime.now()+mx.DateTime.RelativeDateTime(months=1,day=1,days=-1)).strftime('%Y-%m-%d'),
|
||||
'user_id': lambda self,cr,uid,c: uid
|
||||
'user_id': lambda self,cr,uid,c: uid,
|
||||
'state': lambda *args: 'open'
|
||||
}
|
||||
_order = 'date_from desc'
|
||||
report_account_analytic_planning()
|
||||
|
@ -164,7 +166,7 @@ class report_account_analytic_planning_stat(osv.osv):
|
|||
from
|
||||
report_account_analytic_planning_line l
|
||||
left join
|
||||
account_analytic_account a on (a.id = l.account_id)
|
||||
report_account_analytic_planning a on (a.id = l.planning_id)
|
||||
left join
|
||||
product_uom u on (l.amount_unit = u.id)
|
||||
group by
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<field name="user_id"/>
|
||||
<field name="date_from"/>
|
||||
<field name="date_to"/>
|
||||
<field name="state"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -36,6 +37,7 @@
|
|||
<field name="note"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="state" select="1"/>
|
||||
</page><page string="Analysis">
|
||||
<field name="stat_ids" colspan="4" nolabel="1" readonly="1">
|
||||
<tree string="Planning Line" editable="bottom">
|
||||
|
@ -138,6 +140,7 @@
|
|||
<tree string="Planning statistics">
|
||||
<field name="planning_id"/>
|
||||
<field name="user_id"/>
|
||||
<field name="manager_id"/>
|
||||
<field name="account_id"/>
|
||||
<field name="sum_amount"/>
|
||||
<field name="sum_amount_real"/>
|
||||
|
@ -175,7 +178,7 @@
|
|||
<record model="ir.actions.act_window" id="action_account_analytic_planning_stat_my_form">
|
||||
<field name="res_model">report_account_analytic.planning.stat</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[('user_id','=',uid)]</field>
|
||||
<field name="domain">[('user_id','=',uid),('planning_id.state','=','open')]</field>
|
||||
<field name="view_mode">graph,tree</field>
|
||||
</record>
|
||||
<menuitem
|
||||
|
@ -186,7 +189,7 @@
|
|||
<record model="ir.actions.act_window" id="action_account_analytic_planning_stat_my_manager_form">
|
||||
<field name="res_model">report_account_analytic.planning.stat</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[('manager_id','=',uid)]</field>
|
||||
<field name="domain">[('manager_id','=',uid),('planning_id.state','=','open')]</field>
|
||||
<field name="view_mode">graph,tree</field>
|
||||
</record>
|
||||
<menuitem
|
||||
|
|
|
@ -39,6 +39,7 @@ class report_task_user_pipeline_open (osv.osv):
|
|||
'task_hrs': fields.float('Task Hours', readonly=True),
|
||||
'task_progress': fields.float('Task Progress', readonly=True),
|
||||
'company_id' : fields.many2one('res.company', 'Company'),
|
||||
'task_state': fields.selection([('draft', 'Draft'),('open', 'Open'),('pending', 'Pending'), ('cancelled', 'Cancelled'), ('done', 'Done'),('no','No Task')], 'State', readonly=True),
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
|
@ -50,12 +51,16 @@ class report_task_user_pipeline_open (osv.osv):
|
|||
u.company_id as company_id,
|
||||
count(t.*) as task_nbr,
|
||||
sum(t.planned_hours) as task_hrs,
|
||||
sum(t.planned_hours * (100 - t.progress) / 100) as task_progress
|
||||
sum(t.planned_hours * (100 - t.progress) / 100) as task_progress,
|
||||
case when t.state is null then 'no' else t.state end as task_state
|
||||
from
|
||||
res_users u
|
||||
left join project_task t on (u.id = t.user_id)
|
||||
left join
|
||||
project_task t on (u.id = t.user_id)
|
||||
where
|
||||
u.active
|
||||
group by
|
||||
u.id, u.company_id
|
||||
u.id, u.company_id, t.state
|
||||
)
|
||||
''')
|
||||
report_task_user_pipeline_open()
|
||||
|
|
|
@ -218,17 +218,17 @@
|
|||
|
||||
|
||||
<record model="ir.actions.act_window" id="action_order_tree2">
|
||||
<field name="name">Sales in shipping exception</field>
|
||||
<field name="name">Sales in Exception</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sale.order</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('state','=','shipping_except')]</field>
|
||||
<field name="domain">[('state','in',('shipping_except','invoice_except')]</field>
|
||||
</record>
|
||||
<menuitem name="Sales Management/Sales Order/All Sales Order/" id="menu_action_order_tree2" action="action_order_tree2"/>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_order_tree3">
|
||||
<field name="name">Sales order to be invoiced</field>
|
||||
<field name="name">Sales Order To Be Invoiced</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sale.order</field>
|
||||
<field name="view_type">form</field>
|
||||
|
@ -238,12 +238,12 @@
|
|||
<menuitem name="Sales Management/Sales Order/All Sales Order/" id="menu_action_order_tree3" action="action_order_tree3"/>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_order_tree4">
|
||||
<field name="name">Sales order in progress</field>
|
||||
<field name="name">Sales Order in Progress</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sale.order</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('state','=','progress')]</field>
|
||||
<field name="domain">[('state','in',('progress','waiting_date','manual'))]</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Sales Management/Sales Order/All Sales Order/Sales in Progress"
|
||||
|
@ -253,7 +253,7 @@
|
|||
|
||||
|
||||
<record model="ir.actions.act_window" id="action_order_tree5">
|
||||
<field name="name">All quotations</field>
|
||||
<field name="name">All Quotations</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sale.order</field>
|
||||
<field name="view_type">form</field>
|
||||
|
@ -266,27 +266,15 @@
|
|||
sequence="1"
|
||||
action="action_order_tree5"/>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_order_tree6">
|
||||
<field name="name">Sales order in invoice exception</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sale.order</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('state','=','invoice_except')]</field>
|
||||
</record>
|
||||
<menuitem name="Sales Management/Sales Order/All Sales Order/" id="menu_action_order_tree6" action="action_order_tree6"/>
|
||||
|
||||
|
||||
|
||||
<record model="ir.actions.act_window" id="action_order_tree7">
|
||||
<field name="name">My sales in shipping exception</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sale.order</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('state','=','shipping_except'),('user_id','=',uid)]</field>
|
||||
<field name="domain">[('state','in',('shipping_except','invoice_except')),('user_id','=',uid)]</field>
|
||||
</record>
|
||||
<menuitem name="Sales Management/Sales Order/My Sales Order/My Sales in Shipping Exception" id="menu_action_order_tree7" action="action_order_tree7"/>
|
||||
<menuitem name="Sales Management/Sales Order/My Sales Order/My Sales in Exception" id="menu_action_order_tree7" action="action_order_tree7"/>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_order_tree8">
|
||||
<field name="name">My sales order waiting Invoice</field>
|
||||
|
@ -304,7 +292,7 @@
|
|||
<field name="res_model">sale.order</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('state','=','progress'),('user_id','=',uid)]</field>
|
||||
<field name="domain">[('state','in',('progress','waiting_date','manual')),('user_id','=',uid)]</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Sales Management/Sales Order/My Sales Order/My Sales in Progress"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name" : "Double-entry Inventory Management",
|
||||
"name" : "Stock Management",
|
||||
"version" : "1.0",
|
||||
"author" : "Tiny",
|
||||
"website" : "http://tinyerp.com/module_stock.html",
|
||||
|
|
|
@ -134,7 +134,7 @@ class stock_location(osv.osv):
|
|||
continue
|
||||
product = products_by_id[product_id]
|
||||
result.append({
|
||||
'price': product.list_price,
|
||||
'price': product.standard_price,
|
||||
'name': product.name,
|
||||
'code': product.default_code, # used by lot_overview_all report!
|
||||
'variants': product.variants or '',
|
||||
|
|
|
@ -79,7 +79,7 @@ def _get_moves(self, cr, uid, data, context):
|
|||
if hasattr(pick, 'purchase_id') and pick.purchase_id:
|
||||
currency=pick.purchase_id.pricelist_id.currency_id.id
|
||||
|
||||
_moves_arch_lst.append('<group col="6"><field name="uom%s"/>\
|
||||
_moves_arch_lst.append('<group col="6"><field name="uom%s" nolabel="1"/>\
|
||||
<field name="price%s"/>' % (m.id,m.id,))
|
||||
|
||||
_moves_fields['price%s' % m.id] = {'string': 'Unit Price',
|
||||
|
@ -89,7 +89,7 @@ def _get_moves(self, cr, uid, data, context):
|
|||
'relation': 'product.uom', 'required': True,
|
||||
'default': make_default(m.product_uom.id)}
|
||||
|
||||
_moves_arch_lst.append('<field name="currency%d"/></group>' % (m.id,))
|
||||
_moves_arch_lst.append('<field name="currency%d" nolabel="1"/></group>' % (m.id,))
|
||||
_moves_fields['currency%s' % m.id] = {'string': 'Currency',
|
||||
'type': 'many2one', 'relation': 'res.currency',
|
||||
'required': True, 'default': make_default(currency)}
|
||||
|
|
Loading…
Reference in New Issue