diff --git a/addons/project/project.py b/addons/project/project.py index cc7e226e59d5db2d89071a57151843e4186704a7..4cdd80a992e05ede297726947a935f8a5979b115 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -163,6 +163,7 @@ class project(osv.osv): 'task_ids': fields.one2many('project.task', 'project_id', domain=[('stage_id.fold', '=', False)]), 'color': fields.integer('Color Index'), + 'user_id': fields.many2one('res.users', 'Project Manager'), 'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="restrict", required=True, help="Internal email associated with this project. Incoming emails are automatically synchronized " "with Tasks (or optionally Issues if the Issue Tracker module is installed)."), @@ -185,7 +186,9 @@ class project(osv.osv): 'Status', required=True, copy=False), 'doc_count': fields.function( _get_attached_docs, string="Number of documents attached", type='integer' - ) + ), + 'date_start': fields.date('Start Date'), + 'date': fields.date('Expiration Date', select=True, track_visibility='onchange'), } def _get_type_common(self, cr, uid, context): @@ -201,6 +204,7 @@ class project(osv.osv): 'label_tasks': 'Tasks', 'state': 'open', 'sequence': 10, + 'user_id': lambda self,cr,uid,ctx: uid, 'type_ids': _get_type_common, 'alias_model': 'project.task', 'privacy_visibility': 'employees', @@ -257,7 +261,6 @@ class project(osv.osv): data_obj = self.pool.get('ir.model.data') result = [] for proj in self.browse(cr, uid, ids, context=context): - parent_id = context.get('parent_id', False) context.update({'analytic_project_copy': True}) new_date_start = time.strftime('%Y-%m-%d') new_date_end = False @@ -270,15 +273,9 @@ class project(osv.osv): 'name':_("%s (copy)") % (proj.name), 'state':'open', 'date_start':new_date_start, - 'date':new_date_end, - 'parent_id':parent_id}, context=context) + 'date':new_date_end}, context=context) result.append(new_id) - child_ids = self.search(cr, uid, [('parent_id','=', proj.analytic_account_id.id)], context=context) - parent_id = self.read(cr, uid, new_id, ['analytic_account_id'])['analytic_account_id'][0] - if child_ids: - self.duplicate_template(cr, uid, child_ids, context={'parent_id': parent_id}) - if result and len(result): res_id = result[0] form_view_id = data_obj._get_id(cr, uid, 'project', 'edit_project') @@ -308,9 +305,6 @@ class project(osv.osv): tasks_id = [x[0] for x in cr.fetchall()] if tasks_id: task_obj.write(cr, uid, tasks_id, {'active': value}, context=context) - child_ids = self.search(cr, uid, [('parent_id','=', proj.analytic_account_id.id)]) - if child_ids: - self.setActive(cr, uid, child_ids, value, context=None) return True def create(self, cr, uid, vals, context=None): @@ -322,9 +316,6 @@ class project(osv.osv): alias_parent_model_name=self._name, mail_create_nosubscribe=True) - if vals.get('type', False) not in ('template', 'contract'): - vals['type'] = 'contract' - ir_values = self.pool.get('ir.values').get_default(cr, uid, 'project.config.settings', 'generate_project_alias') if ir_values: vals['alias_name'] = vals.get('alias_name') or vals.get('name') @@ -870,8 +861,6 @@ class account_analytic_account(osv.osv): for account in self.browse(cr, uid, ids, context=context): if not vals.get('name'): vals_for_project['name'] = account.name - if not vals.get('type'): - vals_for_project['type'] = account.type self.project_create(cr, uid, account.id, vals_for_project, context=context) return super(account_analytic_account, self).write(cr, uid, ids, vals, context=context) diff --git a/addons/project/project_dashboard.xml b/addons/project/project_dashboard.xml index bcc07510d127b054fbbde675a02955bd145c0b86..6d650bbd5bf1e57e965643d14c2468d6b499ac22 100644 --- a/addons/project/project_dashboard.xml +++ b/addons/project/project_dashboard.xml @@ -7,7 +7,6 @@ <field name="name"/> <field name="use_tasks"/> <field name="user_id"/> - <field name="date"/> <field name="color"/> <field name="task_count"/> <field name="label_tasks"/> @@ -68,4 +67,4 @@ </kanban> </field> </record> -</odoo> \ No newline at end of file +</odoo> diff --git a/addons/project/project_data.xml b/addons/project/project_data.xml index b7f44bb3957602f9997c6cc0b2ef74b2eb08069f..e3ea0e030a21eb8a22e83078899562a1d024d9cb 100644 --- a/addons/project/project_data.xml +++ b/addons/project/project_data.xml @@ -18,14 +18,6 @@ <field name="object">project.task</field> </record> - <!-- Resource: project.project --> - <record id="all_projects_account" model="account.analytic.account"> - <field name="name">Projects</field> - <field name="code">PP001</field> - <field name="type">view</field> - </record> - <function id="parent_project_default_set" model="ir.values" name="set" eval="('default',False,'parent_id', [('project.project', False)], all_projects_account, True, False, False, False, True)"/> - <!-- alias domain: project.config.settings --> <function id="default_alias_domain_project" model="ir.values" name="set_default" eval="('project.config.settings', 'generate_project_alias', 1)"/> @@ -109,7 +101,6 @@ <data noupdate="1"> <record id="project_project_data" model="project.project"> <field name="name">Discover Odoo</field> - <field name="parent_id" ref="all_projects_account"/> <field name="privacy_visibility">followers</field> <field name="user_id" ref="base.user_root"/> <field name="alias_model">project.task</field> diff --git a/addons/project/project_demo.xml b/addons/project/project_demo.xml index 99239df0ee2ea25f7a34346bc754980771ddcf4e..a0955435d1dd3bc700279db0643b379c1ad82ca5 100644 --- a/addons/project/project_demo.xml +++ b/addons/project/project_demo.xml @@ -49,14 +49,11 @@ <record id="project_project_1" model="project.project"> <field name="date_start" eval="time.strftime('%Y-%m-01 10:00:00')"/> <field name="state">open</field> - <field name="type">normal</field> <field name="name">Website for Sales & WMS</field> <field name="color">3</field> <field name="partner_id" ref="portal.partner_demo_portal"/> - <field name="parent_id" ref="all_projects_account"/> <field name="privacy_visibility">portal</field> <field name="user_id" ref="base.user_demo"/> - <field name="description">Implement new website for Sale and Warehouse Management for a customer.</field> <field name="alias_model">project.task</field> <field name="type_ids" eval="[(4, ref('project_stage_0')) ,(4,ref('project_stage_1'))]"/> <field name="message_follower_ids" eval="[ @@ -67,7 +64,6 @@ <record id="project_project_2" model="project.project"> <field name="name">Research & Development</field> - <field name="parent_id" ref="all_projects_account"/> <field name="privacy_visibility">followers</field> <field name="user_id" ref="base.user_demo"/> <field name="alias_model">project.task</field> @@ -75,7 +71,6 @@ <record id="project_project_3" model="project.project"> <field name="sequence">10</field> - <field name="parent_id" ref="all_projects_account"/> <field name="name">E-Learning Integration</field> <field name="label_tasks">Trainings</field> <field name="user_id" ref="base.user_demo"/> @@ -85,7 +80,6 @@ <record id="project_project_4" model="project.project"> <field name="sequence">20</field> - <field name="parent_id" ref="all_projects_account"/> <field name="name">Website Design Templates</field> <field name="label_tasks">Designs</field> <field name="user_id" ref="base.user_root"/> @@ -96,7 +90,6 @@ <record id="project_project_5" model="project.project"> <field name="sequence">2</field> - <field name="parent_id" ref="all_projects_account"/> <field name="partner_id" ref="base.res_partner_4"/> <field name="name">Data Import/Export Plugin</field> <field name="label_tasks">Databases</field> diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index 28d6634c4d5051d52452ee8a6fd254f36cec9e5e..bf1d346344f99af61563cde8332b60e00ad0c2b3 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -77,7 +77,7 @@ <form string="Project"> <header> <button name="set_template" string="Set as Template" type="object" states="open" groups="base.group_user"/> - <button string="New Project Based on Template" name="duplicate_template" type="object" states="template" context="{'parent_id':parent_id}" class="oe_highlight" groups="base.group_user"/> + <button string="New Project Based on Template" name="duplicate_template" type="object" states="template" class="oe_highlight" groups="base.group_user"/> <button name="reset_project" string="Reset as Project" type="object" states="template" class="oe_highlight" groups="base.group_user"/> <field name="state" widget="statusbar" clickable="True"/> </header> @@ -116,21 +116,12 @@ </group> <group name="misc"> <group string="Time Scheduling" groups="project.group_time_work_estimation_tasks"> - <field name="date_start" string="Start Date" - readonly="1"/> - <field name="date" string="End Date" - readonly="1"/> <field name="resource_calendar_id"/> </group> <group string="Configuration" groups="base.group_no_one"> <field name="sequence" groups="base.group_no_one"/> <field name="active" attrs="{'invisible':[('state','in',['open', 'pending', 'template'])]}"/> <field name="currency_id" groups="base.group_multi_currency" required="1"/> - <field name="parent_id" string="Parent" - help="Append this project to another one using analytic accounts hierarchy" - domain="[('id','!=',analytic_account_id)]" - context="{'current_model': 'project.project'}" - groups="project.group_time_work_estimation_tasks"/> </group> </group> </page> @@ -179,7 +170,6 @@ <group expand="0" string="Group By"> <filter string="Manager" name="Manager" context="{'group_by':'user_id'}"/> <filter string="Contact" name="Partner" context="{'group_by':'partner_id'}"/> - <filter string="Parent" name="Parent" help="Parent" context="{'group_by':'parent_id'}"/> </group> </search> </field> @@ -190,14 +180,12 @@ <field name="model">project.project</field> <field name="field_parent">child_ids</field> <field name="arch" type="xml"> - <tree decoration-bf="message_needaction==True" decoration-danger="date and (date<current_date) and (state == 'open')" decoration-info="state in ('draft','pending')" decoration-muted="state in ('close','cancelled')" string="Projects"> + <tree decoration-bf="message_needaction==True" decoration-info="state in ('draft','pending')" decoration-muted="state in ('close','cancelled')" string="Projects"> <field name="sequence" widget="handle"/> <field name="message_needaction" invisible="1"/> - <field name="date" invisible="1"/> <field name="name" string="Project Name"/> <field name="user_id" string="Project Manager"/> <field name="partner_id" string="Contact"/> - <field name="parent_id" string="Parent" invisible="1"/> <field name="state"/> </tree> </field> diff --git a/addons/project/security/ir.model.access.csv b/addons/project/security/ir.model.access.csv index e1e9261d9da564664b5cdfc51fe54e533c0a71a7..84fea7b5ffeeddf55ec50da63fca24a44bdd8788 100644 --- a/addons/project/security/ir.model.access.csv +++ b/addons/project/security/ir.model.access.csv @@ -4,8 +4,6 @@ access_project_project_manager,project.project,model_project_project,project.gro access_account_analytic_account_user,account.analytic.account,analytic.model_account_analytic_account,project.group_project_user,1,0,0,0 access_account_analytic_account_manager,account.analytic.account,analytic.model_account_analytic_account,project.group_project_manager,1,1,1,1 access_account_analytic_account_portal,account_analytic_account,analytic.model_account_analytic_account,base.group_portal,1,0,0,0 -access_account_analytic_journal_project_manager,account.analytic.journal.project.manager,analytic.model_account_analytic_journal,project.group_project_manager,1,1,1,1 -access_account_analytic_journal_project_user,account.analytic.journal.project.user,analytic.model_account_analytic_journal,project.group_project_user,1,1,1,0 access_project_task_type_user,project.task.type.user,model_project_task_type,base.group_user,1,0,0,0 access_project_task_type_project_user,project.task.type.project.user,model_project_task_type,project.group_project_user,1,0,0,0 access_project_task_type_manager,project.task.type manager,model_project_task_type,project.group_project_manager,1,1,1,1 diff --git a/addons/project_issue_sheet/project_issue_sheet.py b/addons/project_issue_sheet/project_issue_sheet.py index f70fd928c13cff349ca4c0d610952d1f5338f621..d55e737f12cb714ac7ae80280e98e2212d4f8673 100644 --- a/addons/project_issue_sheet/project_issue_sheet.py +++ b/addons/project_issue_sheet/project_issue_sheet.py @@ -26,7 +26,6 @@ class project_issue(osv.osv): }), 'timesheet_ids': fields.one2many('account.analytic.line', 'issue_id', 'Timesheets'), 'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account'), - 'contract_state': fields.related('analytic_account_id', 'state', string='Contract Status', type='selection', selection=analytic.ANALYTIC_ACCOUNT_STATE), } def on_change_project(self, cr, uid, ids, project_id, context=None): @@ -42,7 +41,6 @@ class project_issue(osv.osv): account = project.analytic_account_id if account: result['value']['analytic_account_id'] = account.id - result['value']['contract_state'] = account.state return result diff --git a/addons/project_issue_sheet/project_issue_sheet_view.xml b/addons/project_issue_sheet/project_issue_sheet_view.xml index 6ef158b3e359442f5f79bdbc0e9571b47ccc7e15..c137c9891f9fcbc5c6b1b4ec820cb5551677073f 100644 --- a/addons/project_issue_sheet/project_issue_sheet_view.xml +++ b/addons/project_issue_sheet/project_issue_sheet_view.xml @@ -14,13 +14,9 @@ </field> <field name="active" position="after"> <field name="analytic_account_id" - domain="[('parent_id','!=',False),('partner_id', '=', partner_id),('type', '!=', 'view')]" + domain="[('parent_id','!=',False),('partner_id', '=', partner_id)]" on_change='on_change_account_id(analytic_account_id)'/> </field> - <xpath expr='//div[@name="project"]' position='after'> - <field name="contract_state" widget="label_selection" attrs="{'invisible': ['|', ('partner_id', '=', False), ('analytic_account_id', '=', False)]}" - options="{'classes': {'template': 'default', 'draft': 'info', 'open': 'success', 'pending': 'warning', 'close': 'danger', 'cancelled': 'warning'}}" readonly="1"/> - </xpath> <xpath expr="//notebook/page[@name='extra_info']" position="before"> <page string="Timesheets" groups="project.group_tasks_work_on_tasks,project.group_time_work_estimation_tasks"> <field name="timesheet_ids" colspan="4" nolabel="1" context="{'default_user_id' : uid, 'default_account_id' : analytic_account_id, 'default_is_timesheet':1}" @@ -30,13 +26,7 @@ <field name="user_id" required="1"/> <field name="name"/> <field name="account_id" invisible="0" domain="[('partner_id', '=', parent.partner_id)]" on_change="on_change_account_id(account_id, user_id, is_timesheet, context)" options="{'no_open': True, 'no_create': True}" groups="analytic.group_analytic_accounting"/> - <field name="unit_amount" string="Duration" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id, context)" widget="float_time"/> - <field name="to_invoice" invisible="1"/> - <field name="product_uom_id" invisible="1" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id, context)"/> - <field name="journal_id" invisible="1"/> - <field name="amount" invisible="1"/> - <field name="general_account_id" invisible="1"/> - <field name="product_id" invisible="1"/> + <field name="unit_amount" string="Duration" widget="float_time"/> <field name="is_timesheet" invisible="1"/> </tree> </field> diff --git a/addons/project_issue_sheet/security/ir.model.access.csv b/addons/project_issue_sheet/security/ir.model.access.csv index 0450d8fa2b715225206d30820d9de33e485acd20..4f339d418180711bdcf66feedecec2a24ca2313c 100644 --- a/addons/project_issue_sheet/security/ir.model.access.csv +++ b/addons/project_issue_sheet/security/ir.model.access.csv @@ -4,10 +4,6 @@ access_account_analytic_line_project_user,account_analytic_line user,hr_timeshee access_account_analytic_line_project_manager,account_analytic_line manager,hr_timesheet_sheet.model_account_analytic_line,project.group_project_manager,1,0,0,0 access_hr_timesheet_sheet_sheet_project_manager,hr_timesheet_sheet.sheet manager,hr_timesheet_sheet.model_hr_timesheet_sheet_sheet,project.group_project_manager,1,0,0,0 access_account_analytic_line_project_manager,account.analytic.line.timesheet.project.manager,account.model_account_analytic_line,project.group_project_manager,1,1,1,1 -access_account_analytic_journal_project_manager,account.analytic.journal.project.manager,analytic.model_account_analytic_journal,project.group_project_manager,1,1,1,1 -access_hr_timesheet_invoice_factor_project_manager,hr_timesheet_invoice.factor.project.manager,hr_timesheet_invoice.model_hr_timesheet_invoice_factor,project.group_project_manager,1,1,1,1 access_account_invoice_project_manager,account.invoice.project.manager,account.model_account_invoice,project.group_project_manager,1,1,1,1 access_analytic_account_line_project_user,analytic_account_line_timesheet user,analytic.model_account_analytic_line,project.group_project_user,1,1,1,0 -access_account_analytic_journal_project_user,account.analytic.journal.project.user,analytic.model_account_analytic_journal,project.group_project_user,1,1,1,0 -access_hr_timesheet_invoice_factor_project_user,hr_timesheet_invoice.factor.project.user,hr_timesheet_invoice.model_hr_timesheet_invoice_factor,project.group_project_user,1,1,1,0 access_account_invoice_project_user,account.invoice.project.user,account.model_account_invoice,project.group_project_user,1,1,1,0 diff --git a/addons/project_timesheet/__openerp__.py b/addons/project_timesheet/__openerp__.py index 7700b44dabfa5102050ee79bde34b45e2adf34a4..73de0351a59474b0cbd5b7083083cf53f38bf206 100644 --- a/addons/project_timesheet/__openerp__.py +++ b/addons/project_timesheet/__openerp__.py @@ -15,13 +15,12 @@ with the effect of creating, editing and deleting either ways. """, 'website': 'https://www.odoo.com/page/project-management', 'images': ['images/invoice_task_work.jpeg', 'images/my_timesheet.jpeg', 'images/working_hour.jpeg'], - 'depends': ['resource', 'project', 'sale_contract'], + 'depends': ['resource', 'project', 'sale_timesheet'], 'data': [ 'security/ir.model.access.csv', 'security/project_timesheet_security.xml', 'report/project_report_view.xml', 'project_timesheet_view.xml', - 'project_dashboard.xml', 'res_config_view.xml', ], 'demo': ['project_timesheet_demo.xml'], diff --git a/addons/project_timesheet/project_dashboard.xml b/addons/project_timesheet/project_dashboard.xml deleted file mode 100644 index aec13ff42c384d7a0638f0eb20dd82d047b7a7d7..0000000000000000000000000000000000000000 --- a/addons/project_timesheet/project_dashboard.xml +++ /dev/null @@ -1,30 +0,0 @@ -<odoo> - <record id="action_project_analytic_account" model="ir.actions.act_window"> - <field name="name">Analytic Account</field> - <field name="res_model">account.analytic.account</field> - <field name="view_type">form</field> - <field name="view_mode">form</field> - <field name="domain">[]</field> - <field name="context">{}</field> - </record> - - <!--Project Inherit Kanban view--> - <record id="view_project_kanban_inherit" model="ir.ui.view"> - <field name="name">project.project.kanban.inherit</field> - <field name="model">project.project</field> - <field name="inherit_id" ref="project.view_project_kanban"/> - <field name="arch" type="xml"> - <data> - <field name="use_tasks" position="after"> - <field name="total_hours"/> - </field> - <xpath expr="//div[contains(@class, 'o_project_kanban_boxes')]" position="inside"> - <a t-if="record.total_hours.value and record.total_hours.value > 0" class="o_project_kanban_box" name="open_timesheets" type="object"> - <span class="o_value"><t t-raw="record.total_hours.value"/></span> - <span class="o_label">Hours</span> - </a> - </xpath> - </data> - </field> - </record> -</odoo> \ No newline at end of file diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py index 34c267d17b6779fcf4dd02ff208d9a0405b23484..9cfa29bbf30d4ac44e67bde03fdeef9435d42e63 100644 --- a/addons/project_timesheet/project_timesheet.py +++ b/addons/project_timesheet/project_timesheet.py @@ -13,111 +13,6 @@ from openerp.exceptions import UserError class project_project(osv.osv): _inherit = 'project.project' - def _get_project_and_children(self, cr, uid, ids, context=None): - """ retrieve all children projects of project ids; - return a dictionary mapping each project to its parent project (or None) - """ - res = dict.fromkeys(ids, None) - while ids: - cr.execute(""" - SELECT project.id, parent.id - FROM project_project project, project_project parent, account_analytic_account account - WHERE project.analytic_account_id = account.id - AND parent.analytic_account_id = account.parent_id - AND parent.id IN %s - """, (tuple(ids),)) - dic = dict(cr.fetchall()) - res.update(dic) - ids = dic.keys() - return res - - def _progress_rate(self, cr, uid, ids, names, arg, context=None): - child_parent = self._get_project_and_children(cr, uid, ids, context) - # compute planned_hours, total_hours, effective_hours specific to each project - cr.execute(""" - SELECT project_id, COALESCE(SUM(planned_hours), 0.0), - COALESCE(SUM(total_hours), 0.0), COALESCE(SUM(effective_hours), 0.0) - FROM project_task - LEFT JOIN project_task_type ON project_task.stage_id = project_task_type.id - WHERE project_task.project_id IN %s AND project_task_type.fold = False - GROUP BY project_id - """, (tuple(child_parent.keys()),)) - # aggregate results into res - res = dict([(id, {'planned_hours': 0.0, 'total_hours': 0.0, 'effective_hours': 0.0}) for id in ids]) - for id, planned, total, effective in cr.fetchall(): - # add the values specific to id to all parent projects of id in the result - while id: - if id in ids: - res[id]['planned_hours'] += planned - res[id]['total_hours'] += total - res[id]['effective_hours'] += effective - id = child_parent[id] - # compute progress rates - for id in ids: - if res[id]['total_hours']: - res[id]['progress_rate'] = round(100.0 * res[id]['effective_hours'] / res[id]['total_hours'], 2) - else: - res[id]['progress_rate'] = 0.0 - return res - - def _get_projects_from_tasks(self, cr, uid, task_ids, context=None): - tasks = self.pool.get('project.task').browse(cr, uid, task_ids, context=context) - project_ids = [task.project_id.id for task in tasks if task.project_id] - return self.pool.get('project.project')._get_project_and_parents(cr, uid, project_ids, context) - - def _get_project_and_parents(self, cr, uid, ids, context=None): - """ return the project ids and all their parent projects """ - res = set(ids) - while ids: - cr.execute(""" - SELECT DISTINCT parent.id - FROM project_project project, project_project parent, account_analytic_account account - WHERE project.analytic_account_id = account.id - AND parent.analytic_account_id = account.parent_id - AND project.id IN %s - """, (tuple(ids),)) - ids = [t[0] for t in cr.fetchall()] - res.update(ids) - return list(res) - - 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): - # set Invoice Task Work to 100% - data_obj = self.pool.get('ir.model.data') - data_id = data_obj._get_id(cr, uid, 'hr_timesheet_invoice', 'timesheet_invoice_factor1') - if data_id: - factor_id = data_obj.browse(cr, uid, data_id).res_id - res['value'].update({'to_invoice': factor_id}) - return res - - _columns = { - 'planned_hours': fields.function(_progress_rate, multi="progress", string='Planned Time', help="Sum of planned hours of all tasks related to this project and its child projects.", - store = { - 'project.project': (_get_project_and_parents, ['tasks', 'parent_id', 'child_ids'], 10), - 'project.task': (_get_projects_from_tasks, ['planned_hours', 'remaining_hours', 'timesheet_ids', 'stage_id'], 20), - }), - 'effective_hours': fields.function(_progress_rate, multi="progress", string='Time Spent', help="Sum of spent hours of all tasks related to this project and its child projects.", - store = { - 'project.project': (_get_project_and_parents, ['tasks', 'parent_id', 'child_ids'], 10), - 'project.task': (_get_projects_from_tasks, ['planned_hours', 'remaining_hours', 'timesheet_ids', 'stage_id'], 20), - }), - 'total_hours': fields.function(_progress_rate, multi="progress", string='Total Time', help="Sum of total hours of all tasks related to this project and its child projects.", - store = { - 'project.project': (_get_project_and_parents, ['tasks', 'parent_id', 'child_ids'], 10), - 'project.task': (_get_projects_from_tasks, ['planned_hours', 'remaining_hours', 'timesheet_ids', 'stage_id'], 20), - }), - 'progress_rate': fields.function(_progress_rate, multi="progress", string='Progress', type='float', group_operator="avg", help="Percent of tasks closed according to the total of tasks todo.", - store = { - 'project.project': (_get_project_and_parents, ['tasks', 'parent_id', 'child_ids'], 10), - 'project.task': (_get_projects_from_tasks, ['planned_hours', 'remaining_hours', 'timesheet_ids', 'stage_id'], 20), - }), - } - - _defaults = { - 'invoice_on_timesheets': True, - } - def open_timesheets(self, cr, uid, ids, context=None): """ open Timesheets view """ mod_obj = self.pool.get('ir.model.data') @@ -130,12 +25,6 @@ class project_project(osv.osv): 'default_is_timesheet':True } help = _("""<p class="oe_view_nocontent_create">Record your timesheets for the project '%s'.</p>""") % (project.name,) - try: - if project.to_invoice and project.partner_id: - help+= _("""<p>Timesheets on this project may be invoiced to %s, according to the terms defined in the contract.</p>""" ) % (project.partner_id.name,) - except: - # if the user do not have access rights on the partner - pass res = mod_obj.get_object_reference(cr, uid, 'hr_timesheet', 'act_hr_timesheet_line_evry1_all_form') id = res and res[1] or False @@ -213,7 +102,6 @@ class task(osv.osv): 'timesheet_ids': fields.one2many('account.analytic.line', 'task_id', 'Timesheets'), 'analytic_account_id': fields.related('project_id', 'analytic_account_id', type='many2one', relation='account.analytic.account', string='Analytic Account', store=True), - 'contract_state': fields.related('project_id', 'analytic_account_id', 'state', relation="account.analytic.account", string='Contract Status', type='selection', selection=analytic.ANALYTIC_ACCOUNT_STATE), } _defaults = { @@ -233,7 +121,6 @@ class task(osv.osv): if 'value' not in result: result['value'] = {} project = self.pool['project.project'].browse(cr, uid, project_id, context=context) - result['value']['contract_state'] = project.analytic_account_id.state return result diff --git a/addons/project_timesheet/project_timesheet_demo.xml b/addons/project_timesheet/project_timesheet_demo.xml index 78aade689999cd801d52fd114e86fb182cb5c068..577bab6101ea9142f458869ad279c269d232347d 100644 --- a/addons/project_timesheet/project_timesheet_demo.xml +++ b/addons/project_timesheet/project_timesheet_demo.xml @@ -2,20 +2,11 @@ <openerp> <data noupdate="1"> <!-- Example employee --> - <record id="hr.employee_qdp" model="hr.employee"> - <field name="product_id" ref="product.product_product_2"/> - <field name="journal_id" ref="hr_timesheet.analytic_journal"/> - </record> - - <record id="hr.employee_al" model="hr.employee"> - <field name="journal_id" ref="hr_timesheet.analytic_journal"/> - </record> <record id="hr.employee_phu" model="hr.employee"> <field name="name">Lisa Jongejans</field> <field name="calendar_id" ref="resource.timesheet_group1"/> <field name="category_ids" eval="[(6, 0, [ref('hr.employee_category_4')])]"/> - <field name="journal_id" ref="hr_timesheet.analytic_journal"/> <field name="work_location">Building 1, Second Floor</field> <field name="work_phone">+3282623500</field> <field name="image" type="base64" file="project_timesheet/static/img/employee_phu-image.jpg"/> @@ -25,20 +16,16 @@ <field name="name">Martin Lawrence</field> <field name="calendar_id" ref="resource.timesheet_group1"/> <field name="category_ids" eval="[(6, 0, [ref('hr.employee_category_4')])]"/> - <field name="product_id" ref="product.product_product_2"/> - <field name="journal_id" ref="hr_timesheet.analytic_journal"/> </record> <record id="hr.employee_jth" model="hr.employee"> <field name="name">Jimmy Kosikin</field> <field name="calendar_id" ref="resource.timesheet_group1"/> <field name="category_ids" eval="[(6, 0, [ref('hr.employee_category_4')])]"/> - <field name="journal_id" ref="hr_timesheet.analytic_journal"/> </record> <record id="hr.employee7" model="hr.employee"> <field name="name">Alice Englert</field> <field name="calendar_id" ref="resource.timesheet_group1"/> <field name="category_ids" eval="[(6, 0, [ref('hr.employee_category_4')])]"/> - <field name="journal_id" ref="hr_timesheet.analytic_journal"/> <field name="work_location">Building 1, Second Floor</field> <field name="work_phone">+3282823500</field> <field name="work_email">alice@openerp.com</field> @@ -48,7 +35,6 @@ </record> <record id="hr.employee_fp" model="hr.employee"> <field name="calendar_id" ref="resource.timesheet_group1"/> - <field name="journal_id" ref="hr_timesheet.analytic_journal"/> </record> </data> diff --git a/addons/project_timesheet/project_timesheet_view.xml b/addons/project_timesheet/project_timesheet_view.xml index eba621401fc8ec5ea75dc3e7bab37fe20c372cee..b63032805a68e6395e273d33568990f6a4a4b90e 100644 --- a/addons/project_timesheet/project_timesheet_view.xml +++ b/addons/project_timesheet/project_timesheet_view.xml @@ -2,62 +2,14 @@ <openerp> <data> - <record id="view_project_tree_inherited" model="ir.ui.view"> - <field name="name">project.project.tree.inherited</field> - <field name="model">project.project</field> - <field name="inherit_id" ref="project.view_project"/> - <field name="arch" type="xml"> - <field name="partner_id" position="after"> - <field name="planned_hours" widget="float_time" groups="project.group_time_work_estimation_tasks"/> - <field name="total_hours" widget="float_time"/> - <field name="effective_hours" widget="float_time" groups="project.group_time_work_estimation_tasks"/> - <field name="progress_rate" widget="progressbar"/> - </field> - </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='//div[@name="options_active"]' position="attributes"> - <attribute name="invisible">0</attribute> - </xpath> - <xpath expr='//div[@name="options_active"]' position='inside'> - <field name="invoice_on_timesheets" class="oe_inline"/> - <label for="invoice_on_timesheets"/> - </xpath> - <xpath expr='//group[@name="group_alias"]' position='before'> - <p attrs="{'invisible': [('analytic_account_id','=',False)]}"> - To invoice or setup invoicing and renewal options, go to the related contract: - <field name="analytic_account_id" readonly="1" required="0" class="oe_inline" nolabel="1"/>. - </p> - </xpath> - <field name="privacy_visibility" position="after"> - <field name="planned_hours" widget="float_time" - groups="project.group_time_work_estimation_tasks"/> - <field name="effective_hours" widget="float_time" - groups="project.group_time_work_estimation_tasks"/> - </field> <div name="button_box" position="inside"> - <button class="oe_stat_button" name="open_timesheets" type="object" attrs="{'invisible':[('invoice_on_timesheets','=',False)]}" - icon="fa-calendar" string="Timesheets"/> + <button class="oe_stat_button" name="open_timesheets" type="object" icon="fa-calendar" string="Timesheets"/> </div> - <xpath expr='//field[@name="partner_id"]' position='after'> - <field name="pricelist_id" invisible="1"/> - </xpath> - </field> - </record> - - <record id="project_invoice_search" model="ir.ui.view"> - <field name="name">Inherit project search view : Invoicing Data</field> - <field name="model">project.project</field> - <field name="inherit_id" ref="project.view_project_project_filter"/> - <field name="arch" type="xml"> - <xpath expr='//filter[@name="Template"]' position='after'> - <filter string="Billable" domain="[('to_invoice','!=', False)]"/> - </xpath> </field> </record> @@ -98,45 +50,6 @@ </field> </record> - <!-- Menus --> - <record id="action_project_timesheet_bill_task" model="ir.actions.act_window"> - <field name="name">Invoice Tasks</field> - <field name="res_model">account.analytic.line</field> - <field name="view_type">form</field> - <field name="view_mode">tree,form,pivot</field> - <field name="domain">[]</field> - <field name="context">{'search_default_to_invoice': 1}</field> - <field name="view_id" ref="view_account_analytic_line_tree_inherit_account_id"/> - <field name="help" type="html"> - <p> - You will find here timesheets and purchases you did for contracts that can be reinvoiced to the customer. - If you want to record new jobs to invoice, you should use the timesheet menu instead. - </p> - </field> - </record> - - <!-- - Time Tracking menu in project Management - --> - - <record id="action_account_analytic_overdue" model="ir.actions.act_window"> - <field name="name">Customer Projects</field> - <field name="res_model">account.analytic.account</field> - <field name="view_type">form</field> - <field name="view_mode">tree,form,graph</field> - <field name="context">{}</field> - <field name="domain">[('type','=','normal')]</field> - <field name="search_view_id" ref="sale_contract.view_account_analytic_account_overdue_search"/> - <field name="help" type="html"> - <p class="oe_view_nocontent_create"> - Click to add a customer contract. - </p><p> - You will find here the contracts related to your customer - projects in order to track the invoicing progress. - </p> - </field> - </record> - <record model="ir.ui.view" id="view_task_form2_inherited"> <field name="name">project.task.form.inherited</field> <field name="model">project.task</field> @@ -145,10 +58,6 @@ <field name="project_id" position="attributes"> <attribute name="on_change">onchange_project(project_id)</attribute> </field> - <xpath expr='//field[@name="project_id"]' position='after'> - <field name="contract_state" widget="label_selection" attrs="{'invisible': ['|', ('project_id', '=', False), ('partner_id', '=', False)]}" - options="{'classes': {'template': 'default', 'draft': 'info', 'open': 'success', 'pending': 'warning', 'close': 'danger', 'cancelled': 'warning'}}" readonly="1"/> - </xpath> <field name="tag_ids" position="after"> <field name="analytic_account_id" invisible="1"/> <field name="progress" widget="progressbar" @@ -161,14 +70,8 @@ <field name="date"/> <field name="user_id" required="1"/> <field name="name"/> - <field name="account_id" on_change="on_change_account_id(account_id, user_id, unit_amount, is_timesheet, context)"/> - <field name="unit_amount" string="Duration" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id, context)" sum="Total time" widget="float_time"/> - <field name="to_invoice"/> - <field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id, context)" invisible="1"/> - <field name="journal_id" invisible="1"/> - <field name="amount" sum="Total cost" invisible="1"/> - <field name="general_account_id" invisible="1"/> - <field name="product_id" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id, context)" domain="[('type','=','service')]" invisible="1"/> + <field name="account_id"/> + <field name="unit_amount" string="Duration" sum="Total time" widget="float_time"/> <field name="is_timesheet" invisible="1"/> </tree> </field> diff --git a/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml b/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml index c677ebc5310db6b3765b6e9ceb338224a0bb057d..861b91ee4587f2b491a7fe48ed15cddf680f5c34 100644 --- a/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml +++ b/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml @@ -12,7 +12,6 @@ - !record {model: product.product, id: product_product_hrmanger0}: categ_id: product.product_category_5 - mes_type: fixed name: HR Manager standard_price: 1.0 type: service @@ -21,13 +20,6 @@ volume: 0.0 warranty: 0.0 weight: 0.0 -- - Create an analytic journal for employees timesheet -- - !record {model: account.analytic.journal, id: account_analytic_journal_hrtimesheet0}: - company_id: base.main_company - name: HR Timesheet - type: general - Create a financial account - @@ -41,8 +33,6 @@ !record {model: hr.employee, id: hr_employee_hrmanager0}: name: HR Manager user_id: res_users_hrmanager0 - product_id: product_product_hrmanger0 - journal_id: account_analytic_journal_hrtimesheet0 - Create a project 'Timesheet Management' - @@ -69,5 +59,5 @@ name: Get work calendar of all employees user_id: res_users_hrmanager0 account_id: analytic.analytic_administratif - journal_id: account_analytic_journal_hrtimesheet0 general_account_id: financial_account0 + product_id: product_product_hrmanger0