Print my timesheet only

Better workflow for mrp and project (services, mto)
Better reports for the purchase order:
	Request for quotation
	Order

bzr revid: pinky-1d6119b7f3152ec48e12f1d1b7d6f0482b5916ae
This commit is contained in:
pinky 2006-12-11 05:35:47 +00:00
parent 12fea2a68e
commit d5ce43fd18
8 changed files with 130 additions and 84 deletions

View File

@ -3,7 +3,7 @@
"version":"1.0",
"author":"Tiny",
"category":"Board",
"depends":["base","sale", "report_crm"],
"depends":["base","sale", "report_crm", "report_sale"],
"demo_xml":[],
"update_xml":["board_sale_view.xml"],
"active":False,

View File

@ -15,7 +15,22 @@
model="hr.employee"
name="hr.analytical.timesheet"
menu="False" />
<menuitem name="Human Resources/Hours encoding/Print timesheet" action="wizard_hr_timesheet" type="wizard" />
<menuitem
name="Human Resources/Hours encoding/Print a user timesheet"
action="wizard_hr_timesheet"
type="wizard"
id="menu_wizard_hr_timesheet"/>
<wizard id="wizard_hr_timesheet_my"
string="Print my timesheet"
model="hr.employee"
name="hr.analytical.timesheet.my"
menu="False" />
<menuitem
name="Human Resources/Hours encoding/Print my timesheet"
id="menu_wizard_hr_timesheet_my"
action="wizard_hr_timesheet_my"
type="wizard" />
<report id="report_users_timesheet"
string="Employees timesheet"

View File

@ -32,6 +32,8 @@ import datetime
from report.interface import report_rml
from report.interface import toxml
import pooler
def lengthmonth(year, month):
if month == 2 and ((year % 4 == 0) and ((year % 100 != 0) or (year % 400 == 0))):
return 29
@ -74,6 +76,9 @@ class report_custom(report_rml):
account_xml = []
for account, telems in accounts.iteritems():
aid, aname = account
aname = pooler.get_pool(cr.dbname).get('account.analytic.account').name_get(cr, uid, [aid], context)
aname = aname[0][1]
account_xml.append('<account id="%d" name="%s">' % (aid, toxml(aname)))
account_xml.append('\n'.join([xml % (day, amount) for day, amount in telems.iteritems()]))
account_xml.append('</account>')

View File

@ -39,6 +39,14 @@ dates_form = '''<?xml version="1.0"?>
<field name="user_id" colspan="3" />
</form>'''
dates_form_ro = '''<?xml version="1.0"?>
<form string="Choose your month">
<field name="month" />
<field name="year" />
<field name="user_id" colspan="3" readonly="1"/>
</form>'''
dates_fields = {
'month': dict(string=u'Month', type='selection', required=True, selection=[(x, datetime.date(2000, x, 1).strftime('%B')) for x in range(1, 13)]),
'year': dict(string=u'Year', type=u'integer', required=True),
@ -53,7 +61,7 @@ class wizard_report(wizard.interface):
states = {
'init': {
'actions': [_get_value],
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[ ('end','Cancel'),('report','Print')]}
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[ ('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]}
},
'report': {
'actions': [],
@ -61,3 +69,17 @@ class wizard_report(wizard.interface):
}
}
wizard_report('hr.analytical.timesheet')
class wizard_report_my(wizard.interface):
states = {
'init': {
'actions': [_get_value],
'result': {'type':'form', 'arch':dates_form_ro, 'fields':dates_fields, 'state':[ ('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]}
},
'report': {
'actions': [],
'result': {'type':'print', 'report':'hr.analytical.timesheet', 'state':'end'}
}
}
wizard_report_my('hr.analytical.timesheet.my')

View File

@ -51,7 +51,7 @@ class wizard_report(wizard.interface):
states={
'init':{
'actions':[_get_value],
'result':{'type':'form', 'arch':form, 'fields':fields, 'state':[('end','Cancel'),('report','Print')]}
'result':{'type':'form', 'arch':form, 'fields':fields, 'state':[('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]}
},
'report':{
'actions':[],

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<terp>
<data>
<record model="workflow.transition" id="mrp.trans_prod_service_end">
<record model="workflow.transition" id="mrp.trans_produce_service_make_done">
<field name="act_from" ref="mrp.act_produce_service"/>
<field name="act_to" ref="mrp.act_make_done"/>
<field name="signal">subflow.done</field>

View File

@ -28,7 +28,6 @@
<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="Tableau3">
<blockAlignment value="LEFT"/>
@ -60,20 +59,21 @@
<paraStyle name="P9" fontName="Times-Roman"/>
<paraStyle name="P10" fontName="Times-Roman" fontSize="16.0" leading="20"/>
<paraStyle name="P11" fontName="Times-Roman" fontSize="11.0" leading="14"/>
<paraStyle name="P12" fontName="Times-Bold" fontSize="8.0" leading="10"/>
<paraStyle name="P13" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="CENTER"/>
<paraStyle name="P14" fontName="Times-BoldItalic" fontSize="6.0" leading="8" alignment="LEFT"/>
<paraStyle name="P15" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT"/>
<paraStyle name="P16" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="CENTER"/>
<paraStyle name="P17" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT"/>
<paraStyle name="P18" fontName="Times-BoldItalic" fontSize="9.0" leading="11" alignment="LEFT"/>
<paraStyle name="P19" fontName="Times-Italic" fontSize="9.0" leading="11" alignment="LEFT"/>
<paraStyle name="P20" fontName="Times-Roman" fontSize="7.0" leading="9"/>
<paraStyle name="P21" fontName="Times-Bold" fontSize="9.0" leading="11" alignment="RIGHT"/>
<paraStyle name="P22" fontName="Times-Roman" fontSize="7.0" leading="9"/>
<paraStyle name="P23" fontName="Times-Bold" fontSize="9.0" leading="11" alignment="RIGHT"/>
<paraStyle name="P24" fontName="Times-Bold" fontSize="9.0" leading="11"/>
<paraStyle name="P25" fontName="Times-Roman" alignment="LEFT"/>
<paraStyle name="P12" fontName="Times-Roman" fontSize="11.0" leading="14"/>
<paraStyle name="P13" fontName="Times-Bold" fontSize="8.0" leading="10"/>
<paraStyle name="P14" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="CENTER"/>
<paraStyle name="P15" fontName="Times-BoldItalic" fontSize="6.0" leading="8" alignment="LEFT"/>
<paraStyle name="P16" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT"/>
<paraStyle name="P17" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="CENTER"/>
<paraStyle name="P18" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT"/>
<paraStyle name="P19" fontName="Times-BoldItalic" fontSize="9.0" leading="11" alignment="LEFT"/>
<paraStyle name="P20" fontName="Times-Italic" fontSize="9.0" leading="11" alignment="LEFT"/>
<paraStyle name="P21" fontName="Times-Roman" fontSize="7.0" leading="9"/>
<paraStyle name="P22" fontName="Times-Bold" fontSize="9.0" leading="11" alignment="RIGHT"/>
<paraStyle name="P23" fontName="Times-Roman" fontSize="7.0" leading="9"/>
<paraStyle name="P24" fontName="Times-Bold" fontSize="9.0" leading="11" alignment="RIGHT"/>
<paraStyle name="P25" fontName="Times-Bold" fontSize="9.0" leading="11"/>
<paraStyle name="P26" fontName="Times-Roman" alignment="LEFT"/>
<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"/>
@ -94,12 +94,15 @@
<blockTable colWidths="241.0" style="Tableau10">
<tr>
<td>
<para style="P2">Shipping address :</para>
<para style="P2">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P3">[[ repeatIn(o.dest_address_id and [o.dest_address_id] or [],'addr') ]]</para>
<para style="P2">Shipping address :</para>
<para style="P4">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
<para style="P4">[[ addr.title or '' ]] [[ addr.name ]]</para>
<para style="P4">[[ addr.street ]]</para>
@ -139,79 +142,80 @@
<para style="P9">
<font color="white"> </font>
</para>
<para style="P10">[[ o.state=='draft' and 'Quotation ' or 'Order ' ]] N° : [[ o.name ]]</para>
<para style="P10">
<font face="Times-Roman">Request for Quotation [[ (o.state=='draft' or removeParentNode('font')) and '' ]]</font>
<font face="Times-Roman"/>
<font face="Times-Roman">Order [[ (o.state&lt;&gt;'draft' or removeParentNode('font')) and '' ]]</font>
<font face="Times-Roman">N° : [[ o.name ]]</font>
</para>
<para style="P11">
<font color="white"> </font>
</para>
<para style="P11">Our order reference : [[ o.ref or '' ]]</para>
<para style="P11">Your order reference : [[ o.partner_ref or '' ]]</para>
<para style="P11">Date ordered : [[ time.strftime('%d/%m/%Y', time.strptime(o.date_order, '%Y-%m-%d')) ]]</para>
<para style="P11">Validated by : [[ o.validator and o.validator.name or '' ]]</para>
<para style="P11">Project: [[ o.project_id and o.project_id.complete_name ]]</para>
<para style="P12">Our order reference : [[ o.ref or '' ]]</para>
<para style="P12">Your order reference : [[ o.partner_ref or '' ]]</para>
<para style="P12">Date ordered : [[ time.strftime('%d/%m/%Y', time.strptime(o.date_order, '%Y-%m-%d')) ]]</para>
<para style="P12">Validated by : [[ o.validator and o.validator.name or '' ]]</para>
<para style="P9">
<font color="white"> </font>
</para>
<blockTable colWidths="195.0,65.0,46.0,42.0,28.0,65.0,69.0" repeatRows="1" style="Tableau2">
<blockTable colWidths="195.0,65.0,52.0,65.0,65.0,69.0" repeatRows="1" style="Tableau2">
<tr>
<td>
<para style="P12">Product Description</para>
<para style="P13">Product Description</para>
</td>
<td>
<para style="P13">Applicable Taxes</para>
<para style="P14">Applicable Taxes</para>
</td>
<td>
<para style="P13">Date Promised</para>
<para style="P14">Date Requested</para>
</td>
<td>
<para style="P13">Qty</para>
<para style="P14">Qty</para>
</td>
<td>
<para style="P13">UoM</para>
<para style="P14">Unit Price</para>
</td>
<td>
<para style="P13">Unit Price</para>
</td>
<td>
<para style="P13">Net Price</para>
<para style="P14">Net Price</para>
</td>
</tr>
</blockTable>
<section>
<para style="P14">[[ repeatIn(o.order_line,'line') ]]</para>
<blockTable colWidths="195.0,65.0,45.0,42.0,28.0,65.0,69.0" style="Tableau3">
<para style="P15">[[ repeatIn(o.order_line,'line') ]]</para>
<blockTable colWidths="194.0,65.0,52.0,65.0,64.0,69.0" style="Tableau3">
<tr>
<td>
<para style="P15">[[ line.name ]]</para>
<para style="P16">[[ line.code ]]</para>
<para style="P16">[[ line.name ]]</para>
</td>
<td>
<para style="P16">[[ ', '.join(map(lambda x: x.name, line.taxes_id))]]</para>
<para style="P17">[[ ', '.join(map(lambda x: x.name, line.taxes_id))]]</para>
</td>
<td>
<para style="P16">[[ time.strftime('%d/%m/%Y', time.strptime( line.date_planned, '%Y-%m-%d')) ]]</para>
<para style="P17">[[ time.strftime('%d/%m/%Y', time.strptime( line.date_planned, '%Y-%m-%d')) ]]</para>
</td>
<td>
<para style="P17">[[ line.product_qty ]]</para>
<para style="P18">[[ line.product_qty ]] [[ line.product_uom.name ]]</para>
</td>
<td>
<para style="P15">[[ line.product_uom.name ]]</para>
<para style="P18">[[ '%.2f' % line.price_unit ]]</para>
</td>
<td>
<para style="P17">[[ '%.2f' % line.price_unit ]]</para>
</td>
<td>
<para style="P17">[[ '%.2f' % line.price_subtotal ]]</para>
<para style="P18">[[ '%.2f' % line.price_subtotal ]]</para>
</td>
</tr>
</blockTable>
<blockTable colWidths="43.0,333.0,135.0" style="Tableau5">
<tr>
<td>
<para style="P18">[[ repeatIn((line.notes and [line.notes]) or [], 'l') ]]</para>
<para style="P19">[[ repeatIn((line.notes and [line.notes]) or [], 'l') ]]</para>
</td>
<td>
<para style="P19">[[ l or removeParentNode('table') ]]</para>
<para style="P20">[[ l or removeParentNode('table') ]]</para>
</td>
<td>
<para style="P18">
<para style="P19">
<font color="white"> </font>
</para>
</td>
@ -224,57 +228,57 @@
<blockTable colWidths="376.0,65.0,69.0" style="Tableau1">
<tr>
<td>
<para style="P20">
<para style="P21">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P21">Net Total :</para>
<para style="P22">Net Total :</para>
</td>
<td>
<para style="P21">[[ '%.2f' % o.amount_untaxed ]] [[ o.pricelist_id.currency_id.name ]]</para>
<para style="P22">[[ '%.2f' % o.amount_untaxed ]] [[ o.pricelist_id.currency_id.name ]]</para>
</td>
</tr>
<tr>
<td>
<para style="P20">
<para style="P21">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P21">Taxes :</para>
<para style="P22">Taxes :</para>
</td>
<td>
<para style="P21">[[ '%.2f' % o.amount_tax ]] [[ o.pricelist_id.currency_id.name ]]</para>
<para style="P22">[[ '%.2f' % o.amount_tax ]] [[ o.pricelist_id.currency_id.name ]]</para>
</td>
</tr>
<tr>
<td>
<para style="P22">
<para style="P23">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P23">TOTAL :</para>
<para style="P24">TOTAL :</para>
</td>
<td>
<para style="P23">[[ '%.2f' % o.amount_total ]] [[ o.pricelist_id.currency_id.name ]]</para>
</td>
</tr>
</blockTable>
<para style="P24">
<font color="white"> </font>
</para>
<blockTable colWidths="510.0" style="Tableau4">
<tr>
<td>
<para style="P25">[[ o.notes or '' ]] [[ setTag('para','xpre') ]]</para>
<para style="P24">[[ '%.2f' % o.amount_total ]] [[ o.pricelist_id.currency_id.name ]]</para>
</td>
</tr>
</blockTable>
<para style="P25">
<font color="white"> </font>
</para>
<blockTable colWidths="510.0" style="Tableau4">
<tr>
<td>
<para style="P26">[[ o.notes or '' ]] [[ setTag('para','xpre') ]]</para>
</td>
</tr>
</blockTable>
<para style="P26">
<font color="white"> </font>
</para>
</story>
</document>

View File

@ -25,7 +25,6 @@
<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"/>
</blockTableStyle>
<blockTableStyle id="Tableau3">
<blockAlignment value="LEFT"/>
@ -84,12 +83,15 @@
<blockTable colWidths="241.0" style="Tableau10">
<tr>
<td>
<para style="P3">Shipping address :</para>
<para style="P3">
<font color="white"> </font>
</para>
</td>
</tr>
<tr>
<td>
<para style="P4">[[ repeatIn(o.dest_address_id and [o.dest_address_id] or [],'addr') ]]</para>
<para style="P3">Shipping address :</para>
<para style="P5">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
<para style="P5">[[ addr.title or '' ]] [[ addr.name ]]</para>
<para style="P5">[[ addr.street ]]</para>
@ -139,6 +141,10 @@
</tr>
</blockTable>
<para style="P10">Request for Quotation [[ o.name ]]</para>
<para style="P11">
<font color="white"> </font>
</para>
<para style="P11">Our project: [[ o.project_id and o.project_id.complete_name or '/' ]]</para>
<para style="P11">Other reference : [[ o.ref or '' ]]</para>
<para style="P12">Printed: [[ time.strftime('%d/%m/%Y') ]]</para>
<para style="P12">
@ -148,11 +154,8 @@
<para style="P13">
<font color="white"> </font>
</para>
<blockTable colWidths="96.0,262.0,70.0,82.0" repeatRows="1" style="Tableau2">
<blockTable colWidths="358.0,70.0,82.0" repeatRows="1" style="Tableau2">
<tr>
<td>
<para style="P14">Code</para>
</td>
<td>
<para style="P14">Product</para>
</td>
@ -166,13 +169,10 @@
</blockTable>
<section>
<para style="P16">[[ repeatIn(o.order_line,'line') ]]</para>
<blockTable colWidths="96.0,262.0,70.0,82.0" style="Tableau3">
<blockTable colWidths="358.0,70.0,82.0" style="Tableau3">
<tr>
<td>
<para style="P17">[[ line.product_id and line.product_id.default_code or '' ]]</para>
</td>
<td>
<para style="P17">[[ line.name ]]</para>
<para style="P17">[[ line.product_id and line.product_id.default_code or '' ]] - [[ line.name ]]</para>
</td>
<td>
<para style="P18">[[ time.strftime('%d/%m/%Y', time.strptime( line.date_planned, '%Y-%m-%d')) ]]</para>
@ -215,10 +215,10 @@
<para style="P11">
<font color="white"> </font>
</para>
<para style="P11">[[ user.name ]]</para>
<para style="P11">Tel: [[ user.address_id.phone ]]</para>
<para style="P11">Email: [[ user.address_id.email ]]</para>
<para style="P11">Fax: [[ user.address_id.fax ]]</para>
<para style="P11">[[ user.signature ]]</para>
<para style="P11">
<font color="white"> </font>
</para>
<para style="P24">
<font color="white"> </font>
</para>