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/>
<div class="manager"><field name="user_id"/></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 class="td_name">
<div class="oe_project_border">
<div>
<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>
<table >
<tr class ="task">
@ -212,14 +218,6 @@
</table>
</div>
</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>
</table>
<table class="project_table">
@ -231,11 +229,6 @@
<t t-esc="Math.round(record.total_hours.raw_value)"/> hrs
</div>
</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>
</table>
</div>

View File

@ -36,6 +36,7 @@
text-align: center;
}
.project_icon{
width: 30px;
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)]}),
'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"),
'open_issues': fields.function(_compute_issue , store=True,type='integer',string="Issue"),
'total_issues': fields.function(_compute_issue , type='integer',string="Issue"),
}
_defaults = {

View File

@ -53,7 +53,7 @@
view_mode="tree,form,calendar,graph"
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"/>
</data>
</openerp>

View File

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

View File

@ -29,23 +29,29 @@ from tools.translate import _
class project_project(osv.osv):
_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 = {}
task_pool=self.pool.get('project.task')
for id in ids:
task_ids = task_pool.search(cr, uid, [('project_id', '=', id)])
total = 0.0
project_record = self.browse(cr,uid,id)
acc_model = self.pool.get("account.analytic.line")
acc_id = acc_model.search(cr, uid, [('account_id', '=', project_record.analytic_account_id.id),('to_invoice', '=', 1),('invoice_id', '=', False)])
if acc_id:
for record in acc_model.browse(cr,uid,acc_id):
total += record.amount
res[id]= total
aal_pool = self.pool.get("account.analytic.line")
for project in self.browse(cr,uid,ids,context=context):
line_ids = aal_pool.search(cr, uid, [('account_id','=',project.analytic_account_id.id),('to_invoice','=',1),('invoice_id','=',False)])
res[project.id] = {
'amt_to_invoice': 0.0,
'hrs_to_invoice': 0.0,
}
if line_ids:
amt_to_invoice,hrs_to_invoice = 0.0,0.0
for line in aal_pool.browse(cr,uid,line_ids,context=context):
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
_columns = {
'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 = {
'timesheets' : True,
@ -72,19 +78,14 @@ class project_project(osv.osv):
context = {}
value = {}
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):
# Get Timesheet views
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')
search_view = data_obj.get_object_reference(cr, uid, 'project_timesheet', 'view_account_analytic_line_search_account_inherit')
context.update({
#'search_default_user_id': uid,
'search_default_account_id':project.analytic_account_id.id,
#'search_default_open':1,
})
value = {
'name': _('Bill Tasks Works'),
@ -93,8 +94,6 @@ class project_project(osv.osv):
'view_mode': 'form,tree',
'res_model': 'account.analytic.line',
'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')],
'type': 'ir.actions.act_window',
'search_view_id': search_view and search_view[1] or False,

View File

@ -9,7 +9,8 @@
<field name="arch" type="xml">
<xpath expr="//field[@name='task']" position='after'>
<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>
<field name="warn_customer" position="after">
@ -30,11 +31,8 @@
<field name="type">kanban</field>
<field name="inherit_id" ref="project.view_project_kanban"/>
<field name="arch" type="xml">
<field name="task" position="after">
<field name="task" position="after">
<field name="timesheets"/>
<field name="total_hours"/>
<field name="effective_hours"/>
<field name="to_amt_invoice"/>
</field>
<xpath expr="//t[@t-name='tasks']" position="after">
<t t-name="timesheets">
@ -43,26 +41,30 @@
</ul>
</t>
</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">
<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>
</t>
<t t-esc = "to_amt_invoice"/>
</xpath>
<xpath expr="//td[@class='td_image']" position="inside">
<div class="sequence">
<kbd class="user">Remaining Hours</kbd>
<div class="manager"><b><t t-esc="Math.round(record.total_hours.raw_value-record.effective_hours.raw_value)"/> h</b></div>
</div>
</xpath>
<xpath expr="//td[@class='td_deadline']" position="inside">
<div class="sequence">
<kbd class="user">To invoice</kbd>
<div class="manager"><b><field name="to_amt_invoice"/> <field name="currency_id"/></b></div>
</div>
<div class="sequence">
<button name="open_timesheets" class="oe_to_invoice_buttons" type="object" context="{'btn':'invoice'}">Invoice</button>
</div>
<xpath expr="//td[@class='td_name']" position="after">
<td class="td_deadline">
<div class="sequence">
<strong>To invoice</strong>
</div>
<div class="sequence">
<kbd class="user">Amount</kbd>
<div class="manager"><b><field name="amt_to_invoice"/> <field name="currency_id"/></b></div>
</div>
<div class="sequence">
<kbd class="user">Hours</kbd>
<div class="manager"><b><field name="hrs_to_invoice"/> h</b></div>
</div>
</td>
</xpath>
</field>
</record>