Fixed coflicts

This commit is contained in:
projectsodoo 2021-01-23 09:29:01 +05:30
commit 8d71b9c3f9
3 changed files with 100 additions and 8 deletions

View File

@ -69,6 +69,28 @@ class Project(models.Model):
copy=False, help="Consultant timesheet hours")
project_cons_hrs = fields.One2many('project.consultant.hrs', 'project_id', 'Consultant Allocation', copy=False)
comment = fields.Text(string='Comment')
tag_ids = fields.Many2many('custom.project.tags', string='Tags')
@api.onchange('allowed_internal_user_ids')
def onchange_add_allowed_internal_users(self):
user_list = []
consultant_list = []
employee_obj = []
if self.allowed_internal_user_ids:
user_list = self.allowed_internal_user_ids.ids
if self.sale_line_employee_ids:
for consultant in self.sale_line_employee_ids:
consultant_list.append(consultant.employee_id.user_id.id)
users = (set(user_list)) - (set(consultant_list))
for record in list(users):
emp_obj = self.env['hr.employee'].search([('user_id', '=', record)]).id
if emp_obj:
employee_obj.append(emp_obj)
if employee_obj:
for employee in employee_obj:
self.sale_line_employee_ids.create({'project_id': self._origin.id,
'employee_id': employee})
def _onchange_calculate_timesheet_hours(self):
self.consultant_timesheet_hrs = [(6, 0, False)]
@ -263,3 +285,14 @@ class InheritProjectProductEmployeeMap(models.Model):
else:
# line.price_unit = 0
line.currency_id = False
class CustomProjectTags(models.Model):
""" Tags of project's tasks """
_name = "custom.project.tags"
_description = "Project Tag"
name = fields.Char('Name', required=True)
_sql_constraints = [
('name_uniq', 'unique (name)', "Tag name already exists!"),
]

View File

@ -9,4 +9,6 @@ access_model_project_multi_budget_assign_pmanager,project.multi.budget.assign,mo
access_model_project_multi_budget_assign_line_puser,project.multi.budget.assign.line,model_project_multi_budget_assign_line,project.group_project_user,1,0,0,0
access_model_project_multi_budget_assign_line_pmanager,project.multi.budget.assign.line,model_project_multi_budget_assign_line,project.group_project_manager,1,1,1,1
access_project_consultant_hrs_report_puser,project.consultant.hrs.report,model_project_consultant_hrs_report,project.group_project_user,1,0,0,0
access_project_consultant_hrs_report_pmanager,project.consultant.hrs.report,model_project_consultant_hrs_report,project.group_project_manager,1,1,1,1
access_project_consultant_hrs_report_pmanager,project.consultant.hrs.report,model_project_consultant_hrs_report,project.group_project_manager,1,1,1,1
access_custom_project_tags_puser,custom.project.tags,model_custom_project_tags,project.group_project_user,1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
9 access_model_project_multi_budget_assign_line_puser project.multi.budget.assign.line model_project_multi_budget_assign_line project.group_project_user 1 0 0 0
10 access_model_project_multi_budget_assign_line_pmanager project.multi.budget.assign.line model_project_multi_budget_assign_line project.group_project_manager 1 1 1 1
11 access_project_consultant_hrs_report_puser project.consultant.hrs.report model_project_consultant_hrs_report project.group_project_user 1 0 0 0
12 access_project_consultant_hrs_report_pmanager project.consultant.hrs.report model_project_consultant_hrs_report project.group_project_manager 1 1 1 1
13 access_custom_project_tags_puser custom.project.tags model_custom_project_tags project.group_project_user 1 1 1 1
14

View File

@ -21,8 +21,9 @@
<field name="date"/>
</xpath>
<xpath expr="//page[@name='settings']" position="after">
<page string="Consultant Allocation" attrs="{'invisible':['|',('pricing_type','!=','employee_rate'),('project_type','!=','hours_in_consultant')]}">
<field name="project_cons_hrs">
<page string="Consultant Allocation"
attrs="{'invisible':['|',('pricing_type','!=','employee_rate'),('project_type','!=','hours_in_consultant')]}">
<field name="project_cons_hrs">
<tree editable="top">
<field name="project_id" invisible="1"/>
<field name="employee_id" options="{'no_create_edit': True, 'no_quick_create': True}"/>
@ -33,7 +34,10 @@
<field name="actual_hours"/>
</tree>
</field>
</page>
</page>
</xpath>
<xpath expr="//field[@name='privacy_visibility']" position="before">
<field name="tag_ids" widget="many2many_tags"/>
</xpath>
</field>
</record>
@ -60,9 +64,10 @@
widget="radio"/>
<field name="project_type" attrs="{'invisible': [('pricing_type', '=', 'fixed_rate')]}"
widget="radio"/>
<field name="budgeted_revenue" attrs="{'invisible': [('pricing_type', '=', 'fixed_rate')], 'required': [('pricing_type','!=','fixed_rate')]}" />
<field name="budgeted_revenue"
attrs="{'invisible': [('pricing_type', '=', 'fixed_rate')], 'required': [('pricing_type','!=','fixed_rate')]}"/>
<field name="comment"/>
<!-- attrs="{'invisible': [('pricing_type','=','fixed_rate')], 'required': [('pricing_type','!=','fixed_rate')]}"-->
<!-- attrs="{'invisible': [('pricing_type','=','fixed_rate')], 'required': [('pricing_type','!=','fixed_rate')]}"-->
<field name="hour_distribution" widget="radio"
attrs="{'invisible': ['|',('project_type','!=','hours_in_consultant'),('pricing_type','=','fixed_rate')]}"/>
@ -107,7 +112,8 @@
domain="[('order_id','=',parent.sale_order_id), ('is_service', '=', True)]"/>
<field name="price_unit" widget="monetary" options="{'currency_field': 'currency_id'}"
attrs="{'readonly': [('parent.sale_order_id', '!=', False)]}"/>-->
<field name="price_unit" attrs="{'readonly': [('parent.project_type', '=', 'hours_no_limit')]}"/>
<field name="price_unit"
attrs="{'readonly': [('parent.project_type', '=', 'hours_no_limit')]}"/>
<field name="currency_id" invisible="1"/>
<field name="budgeted_qty"
attrs="{'readonly': [('parent.project_type', '=', 'hours_no_limit')]}"/>
@ -190,6 +196,57 @@
</field>
</record>
<!-- Tags -->
<record model="ir.ui.view" id="custom_project_tags_search_view">
<field name="name">Tags</field>
<field name="model">custom.project.tags</field>
<field name="arch" type="xml">
<search string="Tags">
<field name="name"/>
</search>
</field>
</record>
<record model="ir.ui.view" id="custom_project_tags_form_view">
<field name="name">Tags</field>
<field name="model">custom.project.tags</field>
<field name="arch" type="xml">
<form string="Tags">
<sheet>
<group>
<field name="name"/>
</group>
</sheet>
</form>
</field>
</record>
<record model="ir.ui.view" id="custom_project_tags_tree_view">
<field name="name">Tags</field>
<field name="model">custom.project.tags</field>
<field name="arch" type="xml">
<tree string="Tags" editable="bottom" sample="1">
<field name="name"/>
</tree>
</field>
</record>
<record id="custom_project_tags_action" model="ir.actions.act_window">
<field name="name">Project Tags</field>
<field name="res_model">custom.project.tags</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
No tags found. Let's create one!
</p>
<p>
Tags are perfect to categorize your tasks.
</p>
</field>
</record>
<menuitem action="custom_project_tags_action" id="menu_custom_project_tags_act"
parent="project.menu_project_config" sequence="9"/>
<menuitem name="Tasks" id="menu_main_cor_tasks"
action="project.action_view_all_task" sequence="52" groups="base.group_no_one,project.group_project_user"/>
action="project.action_view_all_task" sequence="52"
groups="base.group_no_one,project.group_project_user"/>
</odoo>