[IMP] cleaning project/contracts and removing unused code

bzr revid: fp@tinyerp.com-20120830074903-m8yiovofd2891p7i
This commit is contained in:
Fabien Pinckaers 2012-08-30 09:49:03 +02:00
parent a96751985e
commit 8b0f2cfd71
16 changed files with 75 additions and 488 deletions

View File

@ -23,6 +23,7 @@
<label for="quantity_max"/>
<div>
<field name="quantity_max" class="oe_inline"/>
<field name="company_uom_id" readonly="1" class="oe_inline"/>
</div>
</xpath>
<xpath expr='//group[@name="invoice_on_timesheets"]' position="replace">

View File

@ -1,24 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import analytic_contract_expense_project
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,41 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'Projects Management: hr_expense link',
'version': '1.1',
'category': 'Hidden',
'description': """
This module is for modifying project view to show some data related to the hr_expense module.
=============================================================================================
""",
'author': 'OpenERP S.A.',
'website': 'http://www.openerp.com/',
'depends': ['analytic_contract_hr_expense','project'],
'data': ['analytic_contract_expense_project_view.xml'],
'demo': [],
'css' : [],
'installable': True,
'auto_install': True,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,37 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import osv
class project_project(osv.osv):
_inherit = "project.project"
def open_hr_expense(self, cr, uid, ids, context=None):
account_ids = [x.analytic_account_id.id for x in self.browse(cr, uid, ids, context=context)]
return self.pool.get('account.analytic.account').open_hr_expense(cr, uid, account_ids, context=context)
def hr_to_invoice_expense(self, cr, uid, ids, context=None):
account_ids = [x.analytic_account_id.id for x in self.browse(cr, uid, ids, context=context)]
return self.pool.get('account.analytic.account').hr_to_invoice_expense(cr, uid, account_ids, context=context)
project_project()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="project_form_expense_form" model="ir.ui.view">
<field name="name">project.project.form.expense.inherit</field>
<field name="model">project.project</field>
<field name="inherit_id" ref="analytic_contract_project.project_account_analytic_account_form"/>
<field eval="20" name="priority"/>
<field name="arch" type="xml">
<xpath expr='//tr[@name="total"]' position='before'>
<tr>
<td>
<label for="charge_expenses"/>
</td><td>
<field name="charge_expenses"/>
</td><td>
<field class="oe_inline" name="est_expenses" attrs="{'invisible': [('charge_expenses','=',False)]}"/>
</td><td>
<field class="oe_inline" name="expense_invoiced" attrs="{'invisible': [('charge_expenses','=',False)]}"/>
</td><td>
<field class="oe_inline" name="remaining_expense" attrs="{'invisible': [('charge_expenses','=',False)]}"/>
</td><td>
<field class="oe_inline" name="expense_to_invoice" attrs="{'invisible': [('charge_expenses','=',False)]}"/>
</td><td>
<button name="open_hr_expense" string="All Expenses" type="object" attrs="{'invisible': [('charge_expenses','=',False)]}"/>
<button name="hr_to_invoice_expense" string="Expenses to Invoice" type="object" attrs="{'invisible': [('charge_expenses','=',False)]}"/>
</td>
</tr>
</xpath>
</field>
</record>
</data>
</openerp>

View File

@ -1,24 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import analytic_contract_project
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,38 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name' : 'Contract on Project',
'version': '1.1',
'author' : 'OpenERP SA',
'category': 'Hidden',
'website' : 'http://www.openerp.com',
'depends' : ['project', 'account_analytic_analysis'],
'description': """
Add "Contract Data" in project view.
====================================
""",
'data': ['analytic_contract_project_view.xml'],
'demo': [],
'installable': True,
'auto_install': True,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,84 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields, osv
from tools.translate import _
class project_project(osv.osv):
_inherit = 'project.project'
_defaults = {
'use_timesheets': True,
}
def open_sale_order_lines(self,cr,uid,ids,context=None):
account_ids = [x.analytic_account_id.id for x in self.browse(cr, uid, ids, context=context)]
return self.pool.get('account.analytic.account').open_sale_order_lines(cr, uid, account_ids, context=context)
def open_timesheets_to_invoice(self,cr,uid,ids,context=None):
if context is None:
context = {}
analytic_account_id = self.browse(cr, uid, ids[0], context=context).analytic_account_id.id
context.update({'search_default_account_id': analytic_account_id, 'default_account_id': analytic_account_id, 'search_default_to_invoice': 1})
return {
'type': 'ir.actions.act_window',
'name': _('Timesheet Lines to Invoice'),
'view_type': 'form',
'view_mode': 'tree,form',
'context': context,
'domain' : [('invoice_id','=',False),('to_invoice','!=',False), ('journal_id.type', '=', 'general')],
'res_model': 'account.analytic.line',
'nodestroy': True,
}
def open_timesheets(self, cr, uid, ids, context=None):
""" open Timesheets view """
project = self.browse(cr, uid, ids[0], context)
try:
journal_id = self.pool.get('ir.model.data').get_object(cr, uid, 'hr_timesheet', 'analytic_journal').id
except ValueError:
journal_id = False
view_context = {
'search_default_account_id': [project.analytic_account_id.id],
'default_account_id': project.analytic_account_id.id,
'default_journal_id': journal_id,
}
return {
'type': 'ir.actions.act_window',
'name': _('Bill Tasks Works'),
'res_model': 'account.analytic.line',
'view_type': 'form',
'view_mode': 'tree,form',
'context': view_context,
'nodestroy': True,
}
project_project()
class task(osv.osv):
_inherit = "project.task"
def create(self, cr, uid, vals, context=None):
task_id = super(task, self).create(cr, uid, vals, context=context)
task_browse = self.browse(cr, uid, task_id, context=context)
if task_browse.project_id.analytic_account_id:
self.pool.get('account.analytic.account').message_append_note(cr, uid, [task_browse.project_id.analytic_account_id.id], body=_("Task <em>%s</em> has been <b>created</b>.") % (task_browse.name), context=context)
return task_id
task()

View File

@ -1,127 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="project_account_analytic_account_form" model="ir.ui.view">
<field name="name">project.project.form.inherit</field>
<field name="model">project.project</field>
<field name="inherit_id" ref="project.edit_project"/>
<field eval="18" name="priority"/>
<field name="arch" type="xml">
<xpath expr='//page[@name="team"]' position='after'>
<page string="Contract Data">
<group>
<group string="Validity">
<label for="date_start" string="Duration"/>
<div name="duration">
<field name="date_start" class="oe_inline"/>
<label attrs="{'invisible':[('date','=',False)]}" class="oe_inline" string=" - "/>
<field name="date" class="oe_inline"/>
</div>
<label for="quantity_max"/>
<div>
<field name="quantity_max" class="oe_inline"/>
<field name="company_uom_id" readonly="1" class="oe_inline"/> / Remaining:
<field name="remaining_hours" class="oe_inline"/>
<field name="company_uom_id" readonly="1" class="oe_inline"/>
</div>
</group>
<group string="Invoice Options">
<field name="manager_id" />
<field name="pricelist_id" attrs="{'invisible': [('invoice_on_timesheets','=',0)]}"/>
<field name="to_invoice" widget="selection" attrs="{'invisible': [('invoice_on_timesheets','=',0)]}"/>
</group>
</group>
<separator name="toinvoice" string="Invoicing"/>
<table width="100%%">
<tr>
<th></th>
<th></th>
<th><label string="Est.Tot"/></th>
<th><label string="Invoiced"/></th>
<th><label string="Remaining"/></th>
<th><label string="To Invoice"/></th>
<th></th>
</tr><tr>
<td>
<label for="fix_price_invoices"/>
</td><td>
<field name="fix_price_invoices" class="oe_inline"/>
</td><td>
<field class="oe_inline" name="amount_max" attrs="{'invisible': [('fix_price_invoices','=',False)]}"/>
</td><td>
<field class="oe_inline" name="ca_invoiced" attrs="{'invisible': [('fix_price_invoices','=',False)]}"/>
</td><td>
<field class="oe_inline" name="remaining_ca" attrs="{'invisible': [('fix_price_invoices','=',False)]}"/>
</td><td>
<field class="oe_inline" name="fix_price_to_invoice" attrs="{'invisible': [('fix_price_invoices','=',False)]}"/>
</td><td>
<button name="%(account_analytic_analysis.action_sales_order)d" string="All Sales" type="action" context="{'default_partner_id': [partner_id], 'search_default_partner_id': [partner_id], 'default_project_id': analytic_account_id, 'search_default_project_id': analytic_account_id}" attrs="{'invisible': [('fix_price_invoices','=',False)]}"/>
<button name="open_sale_order_lines" string="Lines To Invoice" type="object" context="{'default_partner_id': [partner_id],'default_project_id': analytic_account_id,'search_default_uninvoiced': 1,'search_default_project_id': analytic_account_id,'search_default_partner_id': [partner_id]}" attrs="{'invisible': [('fix_price_invoices','=',False)]}"/></td>
</tr><tr attrs="{'invisible':[('use_timesheets','=',False)]}">
<td>
<label for="invoice_on_timesheets"/>
</td><td>
<field name="invoice_on_timesheets"/>
</td><td>
<field class="oe_inline" name="hours_qtt_est" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
</td><td>
<field class="oe_inline" name="timesheet_ca_invoiced" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
</td><td>
<field class="oe_inline" name="remaining_hours_to_invoice" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
</td><td>
<field class="oe_inline" name="ca_to_invoice" attrs="{'invisible': [('fix_price_invoices','=',False)]}"/>
</td><td>
<button name="%(hr_timesheet.act_hr_timesheet_line_evry1_all_form)d" string="All Timesheets" type="action" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}" context="{'default_account_id': analytic_account_id,'search_default_account_id': analytic_account_id}"/>
<button name="open_timesheets_to_invoice" string="Timesheets to Invoice" type="object" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
</td>
</tr><tr name="total">
<th>
<label string="Total"/>
</th><td>
</td><td>
<field name="est_total" class="oe_inline" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
</td><td>
<field name="invoiced_total" class="oe_inline"/>
</td><td>
<field name="remaining_total" class="oe_inline"/>
</td><td>
<field name="toinvoice_total" class="oe_inline"/>
</td><td>
</td>
</tr>
</table>
<separator string="Terms and Conditions" name="description"/>
<field name="description"/>
</page>
</xpath>
</field>
</record>
<record id="project_invoice_form" model="ir.ui.view">
<field name="name">Inherit project form : Invoicing Data</field>
<field name="model">project.project</field>
<field name="inherit_id" ref="project.edit_project"/>
<field name="arch" type="xml">
<xpath expr='//tr[@name="use_tasks_row"]' position='after'>
<tr>
<td><group><field name="use_timesheets"/></group></td>
<td><button icon="terp-gtk-go-back-rtl" name="open_timesheets" string="Timesheets" type="object" attrs="{'invisible':[('use_timesheets','=', 0)]}"/></td>
</tr>
</xpath>
</field>
</record>
<record id="contract_inherited_form" model="ir.ui.view">
<field name="name">Inherit contract form : adding UoM</field>
<field name="model">account.analytic.account</field>
<field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
<field name="priority">50</field>
<field name="arch" type="xml">
<xpath expr='//field[@name="quantity_max"]' position='after'>
<field name="company_uom_id" readonly="1" class="oe_inline"/>
</xpath>
</field>
</record>
</data>
</openerp>

View File

@ -1265,7 +1265,7 @@ class account_analytic_account(osv.osv):
_inherit = 'account.analytic.account'
_description = 'Analytic Account'
_columns = {
'use_tasks': fields.boolean('Tasks Mgmt.',help="If check,this contract will be available in the project menu and you will be able to manage tasks or track issues"),
'use_tasks': fields.boolean('Tasks',help="If check,this contract will be available in the project menu and you will be able to manage tasks or track issues"),
'company_uom_id': fields.related('company_id', 'project_time_mode_id', type='many2one', relation='product.uom'),
}

View File

@ -76,33 +76,29 @@
</header>
<sheet string="Project">
<field name="analytic_account_id" invisible="1" required="0"/>
<label for="name" class="oe_edit_only" string="Project Name"/>
<h1>
<field name="name" string="Project Name"/>
</h1>
<div attrs="{'invisible': [('alias_domain', '=', False)]}">
<field name="alias_id" invisible="1" required="0"/>
<label for="alias_name" class="oe_edit_only "/>
<field name="alias_name" class="oe_inline" attrs="{'required': [('alias_id', '!=', False)]}"/>@<field name="alias_domain" class="oe_inline"/>
<div class="oe_title">
<label for="name" class="oe_edit_only" string="Project Name"/>
<h1>
<field name="name" string="Project Name"/>
</h1>
<div name="options_active">
<field name="use_tasks" class="oe_inline"/>
<label for="use_tasks"/>
</div>
</div>
<div class="oe_right oe_button_box" name="buttons">
<button name="%(act_project_project_2_project_task_all)d" string="Tasks"
type="action" attrs="{'invisible':[('use_tasks','=', 0)]}"/>
<button name="%(base.action_attachment)d" string="Documents" type="action"/>
</div>
<group>
<group>
<field name="user_id" string="Project Manager" attrs="{'readonly':[('state','in',['close', 'cancelled'])]}"/>
<field name="partner_id" string="Contact" on_change="onchange_partner_id(partner_id)"/>
<field name="privacy_visibility"/>
<field name="analytic_account_id" invisible="1" required="0"/>
</group>
<group>
<table>
<tr name="use_tasks_row">
<td><group><field name="use_tasks"/></group></td>
<td><button icon="terp-gtk-go-back-rtl" name="%(act_project_project_2_project_task_all)d" string="Tasks" type="action" attrs="{'invisible':[('use_tasks','=', 0)]}"/></td>
</tr>
<tr name="use_attachment_row">
<td/>
<td><button icon="terp-gtk-go-back-rtl" class="oe_btn_width" name="%(base.action_attachment)d" string="Documents" type="action"/></td>
</tr>
</table>
<field name="privacy_visibility"/>
<field name="analytic_account_id" invisible="1" required="0"/>
</group>
</group>
<notebook>
@ -126,6 +122,13 @@
</field>
</page>
<page string="Other Info">
<group string="Email Interface" colspan="2">
<div attrs="{'invisible': [('alias_domain', '=', False)]}">
<field name="alias_id" invisible="1" required="0"/>
<label for="alias_name" class="oe_edit_only "/>
<field name="alias_name" class="oe_inline" attrs="{'required': [('alias_id', '!=', False)]}"/>@<field name="alias_domain" class="oe_inline"/>
</div>
</group>
<group>
<group string="Administration">
<field name="planned_hours" widget="float_time"/>
@ -133,11 +136,11 @@
<field name="resource_calendar_id"/>
</group>
<group string="Miscellaneous" name="misc">
<field name="company_id" groups="base.group_multi_company" widget="selection" required="1"/>
<field name="parent_id" domain="[('id','!=',analytic_account_id)]" context="{'current_model': 'project.project'}"/>
<field name="priority"/>
<field name="active" attrs="{'invisible':[('state','in',['open', 'pending', 'template'])]}"/>
<field name="currency_id" groups="base.group_multi_company" required="1"/>
<field name="parent_id" domain="[('id','!=',analytic_account_id)]" context="{'current_model': 'project.project'}"/>
<field name="company_id" groups="base.group_multi_company" widget="selection" required="1"/>
</group>
</group>
</page>
@ -312,7 +315,7 @@
<field name="search_view_id" ref="view_project_project_filter"/>
<field name="context">{}</field>
<field name="help" type="html">
<p class="oe_form_nocontent_create">
<p class="oe_view_nocontent_create">
Click to start a new project.
</p>
<p>

View File

@ -569,7 +569,7 @@ class account_analytic_account(osv.osv):
_description = 'Analytic Account'
_columns = {
'use_issues' : fields.boolean('Issues Tracking', help="Check this field if this project manages issues"),
'use_issues' : fields.boolean('Issues', help="Check this field if this project manages issues"),
}
def on_change_template(self, cr, uid, ids, template_id, context=None):

View File

@ -355,11 +355,12 @@
<field name="model">project.project</field>
<field name="inherit_id" ref="project.edit_project"/>
<field name="arch" type="xml">
<xpath expr='//tr[@name="use_tasks_row"]' position='after'>
<tr>
<td><group><field name="use_issues"/></group></td>
<td><button icon="terp-gtk-go-back-rtl" name="%(act_project_project_2_project_issue_all)d" string="Issues" type="action" attrs="{'invisible':[('use_issues','=', 0)]}"/></td>
</tr>
<xpath expr='//div[@name="options_active"]' position='inside'>
<field name="use_issues" class="oe_inline"/>
<label for="use_issues"/>
</xpath>
<xpath expr='//div[@name="buttons"]' position='inside'>
<button name="%(act_project_project_2_project_issue_all)d" string="Issues" type="action" attrs="{'invisible':[('use_issues','=', 0)]}"/>
</xpath>
<field name="priority" position="before">
<field name="project_escalation_id"/>
@ -382,7 +383,7 @@
<xpath expr="//div[contains(@class, 'oe_kanban_project_list')]" position="inside">
<a t-if="record.use_issues.raw_value"
name="%(act_project_project_2_project_issue_all)d" type="action">
Issues(<field name="issue_count"/>)</a>
<field name="issue_count"/> Issues</a>
</xpath>
</field>
</record>

View File

@ -48,7 +48,7 @@ with the effect of creating, editing and deleting either ways.
'test/work_timesheet.yml',
],
'installable': True,
'auto_install': False,
'auto_install': True,
'certificate': '0075123647453',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -28,33 +28,6 @@ from tools.translate import _
class project_project(osv.osv):
_inherit = 'project.project'
def _to_invoice(self, cr, uid, ids, field_name, arg, context=None):
account_analytic_line = self.pool.get("account.analytic.line")
res = {}
for project in self.browse(cr,uid,ids,context=context):
line_ids = account_analytic_line.search(cr, uid, [('account_id', '=', project.analytic_account_id.id), ('to_invoice','=',1), ('invoice_id','=',False)])
lines = account_analytic_line.browse(cr, uid, line_ids, context)
res[project.id] = {
'amount_to_invoice': sum(line.amount for line in lines),
'time_to_invoice': sum(line.unit_amount for line in lines),
}
return res
def _timesheet_count(self, cr, uid, ids, field_name, arg, context=None):
account_analytic_line = self.pool.get('account.analytic.line')
res = {}
for project in self.browse(cr, uid, ids, context):
line_ids = account_analytic_line.search(cr, uid, [('account_id', '=', project.analytic_account_id.id)])
res[project.id] = len(line_ids)
return res
_columns = {
'amount_to_invoice': fields.function(_to_invoice, string="Amount to Invoice", multi="sums"),
'time_to_invoice': fields.function(_to_invoice, string="Time to Invoice", multi="sums"),
'timesheet_count': fields.function(_timesheet_count, type='integer', string="Issue"),
}
def onchange_partner_id(self, cr, uid, ids, part=False, context=None):
res = super(project_project, self).onchange_partner_id(cr, uid, ids, part, context)
if part and res and ('value' in res):
@ -66,6 +39,31 @@ class project_project(osv.osv):
res['value'].update({'to_invoice': factor_id})
return res
_defaults = {
'use_timesheets': True,
}
def open_timesheets(self, cr, uid, ids, context=None):
""" open Timesheets view """
project = self.browse(cr, uid, ids[0], context)
try:
journal_id = self.pool.get('ir.model.data').get_object(cr, uid, 'hr_timesheet', 'analytic_journal').id
except ValueError:
journal_id = False
view_context = {
'search_default_account_id': [project.analytic_account_id.id],
'default_account_id': project.analytic_account_id.id,
'default_journal_id': journal_id,
}
return {
'type': 'ir.actions.act_window',
'name': _('Bill Tasks Works'),
'res_model': 'account.analytic.line',
'view_type': 'form',
'view_mode': 'tree,form',
'context': view_context,
'nodestroy': True,
}
project_project()
class project_work(osv.osv):

View File

@ -9,36 +9,29 @@
<field name="arch" type="xml">
<field name="use_tasks" position="after">
<field name="use_timesheets"/>
<field name="timesheet_count"/>
<field name="hours_quantity"/>
<field name="currency_id"/>
<field name="partner_id"/>
</field>
<xpath expr="//div[contains(@class, 'oe_kanban_project_list')]" position="inside">
<a t-if="record.use_timesheets.raw_value"
name="open_timesheets" type="object">Timesheets(<field name="timesheet_count"/>)</a>
</xpath>
<xpath expr="//tr[contains(@class, 'oe_kanban_project_deadline')]" position="before">
<tr class="oe_kanban_project_fields oe_kanban_project_invoice" t-if="record.partner_id.raw_value">
<th>Amount to invoice</th>
<td><field name="amount_to_invoice"/> <t t-esc="record.currency_id.raw_value[1].split(' ')[1][1]"/></td>
</tr>
<tr class="oe_kanban_project_fields oe_kanban_project_invoice" t-if="record.partner_id.raw_value">
<th>Time to Invoice</th>
<td><field name="time_to_invoice"/> <field name="company_uom_id"/></td>
</tr>
name="open_timesheets" type="object"><field name="hours_quantity"/> Timesheets</a>
</xpath>
</field>
</record>
<record id="project_invoice_form_cutomer" model="ir.ui.view">
<field name="name">Inherit project form : Customer</field>
<record id="project_invoice_form" model="ir.ui.view">
<field name="name">Inherit project form : Invoicing Data</field>
<field name="model">project.project</field>
<field name="inherit_id" ref="analytic_contract_project.project_invoice_form"/>
<field name="inherit_id" ref="project.edit_project"/>
<field name="arch" type="xml">
<field name="partner_id" position="replace">
<field name="partner_id" on_change="onchange_partner_id(partner_id)" string="Contact" attrs="{'required':[('to_invoice','!=',False)]}"/>
</field>
<xpath expr='//div[@name="options_active"]' position='inside'>
<field name="use_timesheets" class="oe_inline"/>
<label for="use_timesheets"/>
</xpath>
<xpath expr='//div[@name="buttons"]' position="inside">
<button name="open_timesheets" string="Timesheets" type="object" attrs="{'invisible':[('use_timesheets','=', 0)]}"/>
</xpath>
</field>
</record>
@ -48,7 +41,6 @@
<field name="inherit_id" ref="project.view_project_project_filter"/>
<field name="arch" type="xml">
<xpath expr='//filter[@string="Project(s) Manager"]' position='after'>
<separator/>
<filter icon="terp-camera_test" string="Billable" domain="[('to_invoice','!=', False)]" help="Billable Project"/>
</xpath>
</field>
@ -98,7 +90,7 @@
Click to add a work to invoice.
</p><p>
You will find here all works made on tasks that you can
invoice.
invoice.
</p>
</field>
</record>