Merge branch 'feedback_28july' into 'copy_master'

Feedback 28july

See merge request prakash.jain/cor-odoo!236
This commit is contained in:
pawan.sharma 2022-08-01 06:47:59 +00:00
commit a3673a6df5
4 changed files with 37 additions and 29 deletions

View File

@ -164,7 +164,7 @@
</group>
<group>
<group>
<field name="project_id" required="1"
<field name="project_id" required="1" options="{'no_open': True, 'no_create': True, 'no_create_edit': True}"
context="{'form_view_ref': 'project.project_project_view_form_simplified',}"/>
<field name="sub_project"
options="{'no_open': True, 'no_create': True, 'no_create_edit': True}"/>
@ -230,7 +230,7 @@
<calendar string="Timesheet" date_start="start_datetime" date_stop="end_datetime" date_delay="unit_amount"
color="project_id"
form_view_id="%(hr_timesheet.hr_timesheet_line_form)d" event_open_popup="true" quick_add="False">
<field name="project_id"/>
<field name="project_id" options="{'no_open': True, 'no_create': True, 'no_create_edit': True}"/>
<field name="name"/>
<field name="start_datetime" string="Start date"/>
<field name="end_datetime" string="End date"/>

View File

@ -6,12 +6,12 @@
<field name="model">project.project</field>
<field name="inherit_id" ref="sale_timesheet.project_project_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='options_active']/div" position="after">
<div name="creation_div" attrs="{'invisible': [('id', '=', False)]}">
<label for="create_date" class="oe_inline" string="Created On"/>
<field name="create_date" readonly="1" class="oe_inline"/>
</div>
</xpath>
<xpath expr="//div[@name='options_active']/div" position="after">
<div name="creation_div" attrs="{'invisible': [('id', '=', False)]}">
<label for="create_date" class="oe_inline" string="Created On"/>
<field name="create_date" readonly="1" class="oe_inline"/>
</div>
</xpath>
<xpath expr="//button[@name='action_view_timesheet']" position="replace">
<button string="Project Overview" class="oe_stat_button" type="object" name="action_view_timesheet"
icon="fa-puzzle-piece" attrs="{'invisible': [('allow_billable', '=', False)]}" invisible="1"/>
@ -263,9 +263,9 @@
<field name="binding_model_id" ref="project.model_project_task"/>
<field name="state">code</field>
<field name="code">
if records:
action = records.action_done_task()
</field>
if records:
action = records.action_done_task()
</field>
</record>
<!-- Tags -->

View File

@ -11,17 +11,16 @@ class SubProject(models.Model):
parent_project = fields.Many2one('project.project', domain="[('is_sub_project', '=', False)]", string='Parent Project')
total_timesheet_time_sub_project = fields.Integer(compute='_compute_total_timesheet_time_sub_project')
@api.depends('timesheet_ids')
def _compute_total_timesheet_time_sub_project(self):
for project in self:
total_time = 0.0
value = project.timesheet_ids.search([('sub_project', '!=', False)])
for timesheet in value:
record = self.env['account.analytic.line'].search([(('sub_project', '=', project.id))])
for timesheet in record:
total_time += timesheet.unit_amount * timesheet.product_uom_id.factor_inv
# Now convert to the proper unit of measure set in the settings
total_time *= project.timesheet_encode_uom_id.factor
#project.total_timesheet_time_sub_project = int(round(total_time))
project.total_timesheet_time_sub_project = total_time
#project.total_timesheet_time_sub_project = int(round(total_time))
def action_view_custom_sub_project(self):
action = self.env["ir.actions.actions"]._for_xml_id("hr_timesheet.timesheet_action_all")

View File

@ -1,18 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="edit_project_inherited" model="ir.ui.view">
<field name="name">project.project.form.inherit</field>
<!-- Inherit Timesheet Project Invoice Form View-->
<record id="project_invoice_form_inherited" model="ir.ui.view">
<field name="name">project.project.invoice.form.inherit</field>
<field name="model">project.project</field>
<field name="inherit_id" ref="project.edit_project"/>
<field name="inherit_id" ref="hr_timesheet.project_invoice_form"/>
<field name="arch" type="xml">
<data>
<!--<xpath expr="//button[@name='%(hr_timesheet.act_hr_timesheet_line_by_project)d']" position="replace">
<button class="oe_stat_button" name="%(hr_timesheet.act_hr_timesheet_line_by_project)d"
type="action"
icon="fa-calendar"
attrs="{'invisible': ['|',('allow_timesheets', '=', False),('parent_project', '!=', False)]}"
<xpath expr="//button[@name='%(hr_timesheet.act_hr_timesheet_line_by_project)d']"
position="replace">
<button class="oe_stat_button" name="%(hr_timesheet.act_hr_timesheet_line_by_project)d" type="action"
icon="fa-calendar" attrs="{'invisible': ['|', ('allow_timesheets', '=', False),('is_sub_project', '=', True)]}"
groups="hr_timesheet.group_hr_timesheet_user">
<div class="o_field_widget o_stat_info">
<div class="oe_inline">
@ -27,11 +26,22 @@
<span class="o_stat_text">Recorded</span>
</div>
</button>
</xpath>-->
</xpath>
</data>
</field>
</record>
<!-- Inherit Project Form View-->
<record id="edit_project_inherited" 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 name="arch" type="xml">
<data>
<div name="button_box" position="inside">
<button class="oe_stat_button" name="action_view_custom_sub_project" type="object"
icon="fa-calendar"
attrs="{'invisible': ['|', ('allow_timesheets', '=', False),('parent_project', '=', False)]}"
attrs="{'invisible': ['|', ('allow_timesheets', '=', False),('is_sub_project', '=', False)]}"
groups="hr_timesheet.group_hr_timesheet_user">
<div class="o_field_widget o_stat_info">
<div class="oe_inline">
@ -48,7 +58,7 @@
</button>
</div>
<xpath expr="//field[@name='allowed_internal_user_ids']" position="after">
<field name="is_sub_project" invisible="1"/>
<field name="is_sub_project" invisible="0"/>
</xpath>
<xpath expr="//field[@name='allowed_internal_user_ids']" position="after">
<field name="parent_project" attrs="{'invisible': [('is_sub_project', '=', False)]}"/>
@ -67,7 +77,6 @@
</group>
</page>
</xpath>-->
</data>
</field>
</record>