Sanjay Gohel (Open ERP) 2012-03-30 18:24:49 +05:30
commit 87319499be
7 changed files with 55 additions and 59 deletions

View File

@ -188,11 +188,17 @@
<button name = "open_users" type="object" class="oe_project_buttons"><img t-att-src="kanban_image('res.users', 'avatar', record.user_id.raw_value[0])" class="avatar"/></button><br/> <button name = "open_users" type="object" class="oe_project_buttons"><img t-att-src="kanban_image('res.users', 'avatar', record.user_id.raw_value[0])" class="avatar"/></button><br/>
<div class="manager"><field name="user_id"/></div> <div class="manager"><field name="user_id"/></div>
</div> </div>
<t t-if="record.date.raw_value">
<div class="sequence">
<kbd class="user">Deadline</kbd>
<div class="manager"><b><field name="date"/></b></div>
</div>
</t>
</td> </td>
<td class="td_name"> <td class="td_name">
<div class="oe_project_border"> <div>
<h4 class="oe_project_font1"> <h4 class="oe_project_font1">
<a type="edit"><div class="oe_project_font"><t t-esc="record.name.value.substr(0,28)"/><t t-if="record.name.value.length > 28">...</t></div></a> <a type="edit"><div class="oe_project_font"><t t-esc="record.name.value.substr(0,35)"/><t t-if="record.name.value.length > 35">...</t></div></a>
</h4> </h4>
<table > <table >
<tr class ="task"> <tr class ="task">
@ -212,14 +218,6 @@
</table> </table>
</div> </div>
</td> </td>
<td class="td_deadline">
<t t-if="record.date.raw_value">
<div class="sequence">
<kbd class="user">Deadline</kbd>
<div class="manager"><b><field name="date"/></b></div>
</div>
</t>
</td>
</tr> </tr>
</table> </table>
<table class="project_table"> <table class="project_table">
@ -231,11 +229,6 @@
<t t-esc="Math.round(record.total_hours.raw_value)"/> hrs <t t-esc="Math.round(record.total_hours.raw_value)"/> hrs
</div> </div>
</td> </td>
<!--<td class="td_member">-->
<!-- <t t-foreach="record.members.raw_value" t-as="member">-->
<!-- <img t-att-src="kanban_image('res.users', 'avatar', member)" class="img_member"/>-->
<!-- </t>-->
<!--</td>-->
</tr> </tr>
</table> </table>
</div> </div>

View File

@ -36,6 +36,7 @@
text-align: center; text-align: center;
} }
.project_icon{ .project_icon{
width: 30px; width: 30px;
display: block; display: block;

View File

@ -500,7 +500,7 @@ class project(osv.osv):
'project_escalation_id' : fields.many2one('project.project','Project Escalation', help='If any issue is escalated from the current Project, it will be listed under the project selected here.', states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}), 'project_escalation_id' : fields.many2one('project.project','Project Escalation', help='If any issue is escalated from the current Project, it will be listed under the project selected here.', states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'reply_to' : fields.char('Reply-To Email Address', size=256), 'reply_to' : fields.char('Reply-To Email Address', size=256),
'issues' : fields.boolean('Issues',help = "If you check this field issues are appears in kanban view"), 'issues' : fields.boolean('Issues',help = "If you check this field issues are appears in kanban view"),
'open_issues': fields.function(_compute_issue , store=True,type='integer',string="Issue"), 'total_issues': fields.function(_compute_issue , type='integer',string="Issue"),
} }
_defaults = { _defaults = {

View File

@ -53,7 +53,7 @@
view_mode="tree,form,calendar,graph" view_mode="tree,form,calendar,graph"
view_type="form"/> view_type="form"/>
<menuitem name="Issues" id="menu_project_issue_track" <menuitem name="Issues" id="menu_project_issue_track" parent="project.menu_project_management"
action="project_issue_categ_act0" sequence="15"/> action="project_issue_categ_act0" sequence="15"/>
</data> </data>
</openerp> </openerp>

View File

@ -388,11 +388,12 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="task" position="after"> <field name="task" position="after">
<field name="issues"/> <field name="issues"/>
<field name="total_issues" invisible="1"/>
</field> </field>
<xpath expr="//t[@t-name='tasks']" position="after"> <xpath expr="//t[@t-name='tasks']" position="after">
<t t-name="issues"> <t t-name="issues">
<ul class="oe_kanban_tooltip"> <ul class="oe_kanban_tooltip">
<li><b>Issues:</b> <field name="open_issues"/></li> <li><b>Issues:</b> <field name="total_issues"/></li>
</ul> </ul>
</t> </t>
</xpath> </xpath>

View File

@ -29,23 +29,29 @@ from tools.translate import _
class project_project(osv.osv): class project_project(osv.osv):
_inherit = 'project.project' _inherit = 'project.project'
def _amt_to_invoiced(self, cr, uid, ids,field_name, arg, context=None): def _amt_to_invoice(self, cr, uid, ids,field_name, arg, context=None):
res = {} res = {}
task_pool=self.pool.get('project.task') aal_pool = self.pool.get("account.analytic.line")
for id in ids: for project in self.browse(cr,uid,ids,context=context):
task_ids = task_pool.search(cr, uid, [('project_id', '=', id)]) line_ids = aal_pool.search(cr, uid, [('account_id','=',project.analytic_account_id.id),('to_invoice','=',1),('invoice_id','=',False)])
total = 0.0 res[project.id] = {
project_record = self.browse(cr,uid,id) 'amt_to_invoice': 0.0,
acc_model = self.pool.get("account.analytic.line") 'hrs_to_invoice': 0.0,
acc_id = acc_model.search(cr, uid, [('account_id', '=', project_record.analytic_account_id.id),('to_invoice', '=', 1),('invoice_id', '=', False)]) }
if acc_id: if line_ids:
for record in acc_model.browse(cr,uid,acc_id): amt_to_invoice,hrs_to_invoice = 0.0,0.0
total += record.amount for line in aal_pool.browse(cr,uid,line_ids,context=context):
res[id]= total amt_to_invoice += line.amount
hrs_to_invoice += line.unit_amount
res[project.id]['amt_to_invoice'] = (amt_to_invoice)*-1
res[project.id]['hrs_to_invoice'] = hrs_to_invoice
return res return res
_columns = { _columns = {
'timesheets' : fields.boolean('Timesheets',help = "If you check this field timesheets appears in kanban view"), 'timesheets' : fields.boolean('Timesheets',help = "If you check this field timesheets appears in kanban view"),
'to_amt_invoice': fields.function(_amt_to_invoiced,string="Open Tasks") 'amt_to_invoice': fields.function(_amt_to_invoice,string="Amount to Invoice",multi="sums"),
'hrs_to_invoice': fields.function(_amt_to_invoice,string="Hours to Invoice",multi="sums")
} }
_defaults = { _defaults = {
'timesheets' : True, 'timesheets' : True,
@ -72,19 +78,14 @@ class project_project(osv.osv):
context = {} context = {}
value = {} value = {}
data_obj = self.pool.get('ir.model.data') data_obj = self.pool.get('ir.model.data')
if context.get('btn'):
context.update({
'search_default_to_invoice':1,
})
for project in self.browse(cr, uid, ids, context=context): for project in self.browse(cr, uid, ids, context=context):
# Get Timesheet views # Get Timesheet views
tree_view = data_obj.get_object_reference(cr, uid, 'project_timesheet', 'view_account_analytic_line_tree_inherit_account_id') tree_view = data_obj.get_object_reference(cr, uid, 'project_timesheet', 'view_account_analytic_line_tree_inherit_account_id')
form_view = data_obj.get_object_reference(cr, uid, 'project_timesheet', 'view_account_analytic_line_form_inherit_account_id') form_view = data_obj.get_object_reference(cr, uid, 'project_timesheet', 'view_account_analytic_line_form_inherit_account_id')
search_view = data_obj.get_object_reference(cr, uid, 'project_timesheet', 'view_account_analytic_line_search_account_inherit') search_view = data_obj.get_object_reference(cr, uid, 'project_timesheet', 'view_account_analytic_line_search_account_inherit')
context.update({ context.update({
#'search_default_user_id': uid,
'search_default_account_id':project.analytic_account_id.id, 'search_default_account_id':project.analytic_account_id.id,
#'search_default_open':1,
}) })
value = { value = {
'name': _('Bill Tasks Works'), 'name': _('Bill Tasks Works'),
@ -93,8 +94,6 @@ class project_project(osv.osv):
'view_mode': 'form,tree', 'view_mode': 'form,tree',
'res_model': 'account.analytic.line', 'res_model': 'account.analytic.line',
'view_id': False, 'view_id': False,
# 'domain':[('project_id','=', context.get('active_id',False))],
#'context': context,
'views': [(tree_view and tree_view[1] or False, 'tree'),(form_view and form_view[1] or False, 'form')], 'views': [(tree_view and tree_view[1] or False, 'tree'),(form_view and form_view[1] or False, 'form')],
'type': 'ir.actions.act_window', 'type': 'ir.actions.act_window',
'search_view_id': search_view and search_view[1] or False, 'search_view_id': search_view and search_view[1] or False,

View File

@ -9,7 +9,8 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//field[@name='task']" position='after'> <xpath expr="//field[@name='task']" position='after'>
<field name="timesheets"/> <field name="timesheets"/>
<field name="to_amt_invoice" invisible="True"/> <field name="amt_to_invoice" invisible="True"/>
<field name="hrs_to_invoice" invisible="True"/>
</xpath> </xpath>
<field name="warn_customer" position="after"> <field name="warn_customer" position="after">
@ -30,11 +31,8 @@
<field name="type">kanban</field> <field name="type">kanban</field>
<field name="inherit_id" ref="project.view_project_kanban"/> <field name="inherit_id" ref="project.view_project_kanban"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="task" position="after"> <field name="task" position="after">
<field name="timesheets"/> <field name="timesheets"/>
<field name="total_hours"/>
<field name="effective_hours"/>
<field name="to_amt_invoice"/>
</field> </field>
<xpath expr="//t[@t-name='tasks']" position="after"> <xpath expr="//t[@t-name='tasks']" position="after">
<t t-name="timesheets"> <t t-name="timesheets">
@ -43,26 +41,30 @@
</ul> </ul>
</t> </t>
</xpath> </xpath>
<xpath expr="//h4[@class='oe_project_font1']" position="replace">
<h4 class="oe_project_font1">
<a type="edit"><div class="oe_project_font"><t t-esc="record.name.value.substr(0,28)"/><t t-if="record.name.value.length > 28">...</t></div></a>
</h4>
</xpath>
<xpath expr="//td[@class='buttons']" position="inside"> <xpath expr="//td[@class='buttons']" position="inside">
<t t-if="record.timesheets.raw_value"> <t t-if="record.timesheets.raw_value">
<button name="open_timesheets" class="oe_project_buttons" type="object" tooltip="timesheets"><img src="/project_timesheet/static/src/img/timesheet_icon.png" class="project_icon"/></button> <button name="open_timesheets" class="oe_project_buttons" type="object" tooltip="timesheets"><img src="/project_timesheet/static/src/img/timesheet_icon.png" class="project_icon"/></button>
</t> </t>
<t t-esc = "to_amt_invoice"/>
</xpath> </xpath>
<xpath expr="//td[@class='td_image']" position="inside"> <xpath expr="//td[@class='td_name']" position="after">
<div class="sequence"> <td class="td_deadline">
<kbd class="user">Remaining Hours</kbd> <div class="sequence">
<div class="manager"><b><t t-esc="Math.round(record.total_hours.raw_value-record.effective_hours.raw_value)"/> h</b></div> <strong>To invoice</strong>
</div> </div>
</xpath> <div class="sequence">
<xpath expr="//td[@class='td_deadline']" position="inside"> <kbd class="user">Amount</kbd>
<div class="sequence"> <div class="manager"><b><field name="amt_to_invoice"/> <field name="currency_id"/></b></div>
<kbd class="user">To invoice</kbd> </div>
<div class="manager"><b><field name="to_amt_invoice"/> <field name="currency_id"/></b></div> <div class="sequence">
</div> <kbd class="user">Hours</kbd>
<div class="sequence"> <div class="manager"><b><field name="hrs_to_invoice"/> h</b></div>
<button name="open_timesheets" class="oe_to_invoice_buttons" type="object" context="{'btn':'invoice'}">Invoice</button> </div>
</div> </td>
</xpath> </xpath>
</field> </field>
</record> </record>