add edit option

This commit is contained in:
pawan.sharma 2022-08-24 16:07:08 +05:30
parent 9d0385eb6b
commit 82b2c919b8
2 changed files with 58 additions and 0 deletions

View File

@ -419,6 +419,25 @@ class InheritProjectProductEmployeeMap(models.Model):
# line.price_unit = 0
line.currency_id = False
def edit_sale_line_employee_record(self):
context = dict(self.env.context)
context['form_view_initial_mode'] = 'edit'
return {
'name': ('Edit Resource History'),
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'target': 'new',
'res_model': 'project.sale.line.employee.map',
'res_id': self.id,
'context': context,
# 'view_id': view_id
}
def update_record(self):
return {
'type': 'ir.actions.act_window_close'}
class CustomProjectTags(models.Model):
""" Tags of project's tasks """

View File

@ -100,6 +100,7 @@
<field name="consultant_cost"/>
<field name="actual_revenue"/>
<field name="budgeted_hour_week" invisible="1"/>
<button type="object" name="edit_sale_line_employee_record" string="Edit" class="oe_highlight"/>
<button name="unlink" type="object" icon="fa-trash-o"/>
</tree>
</field>
@ -271,6 +272,44 @@
</field>
</record>
<record id="view_project_sale_line_employee_map" model="ir.ui.view">
<field name="name"> project.sale.line.employee.map.lines</field>
<field name="model">project.sale.line.employee.map</field>
<field name="arch" type="xml">
<form string="Project Sale Employee Lines">
<group>
<group>
<field name="project_id"/>
<field name="sale_line_id"/>
<field name="timesheet_product_id"/>
<field name="currency_id"/>
<field name="budgeted_uom"/>
<field name="employee_price"/>
<field name="cost"/>
<field name="role"/>
<field name="start_date"/>
</group>
<group>
<field name="employee_id"/>
<field name="company_id"/>
<field name="price_unit"/>
<field name="budgeted_qty"/>
<field name="timesheet_hour"/>
<field name="budgeted_hour_week"/>
<field name="consultant_cost"/>
<field name="hour_distribution"/>
<field name="distribution_per"/>
<field name="end_date"/>
</group>
</group>
<footer>
<button name="update_record" type="object" string="Update" class="oe_highlight"/>
<button special="cancel" string="Cancel"/>
</footer>
</form>
</field>
</record>
<!-- Done Task action -->
<record id="project_task_server_action_batch_done" model="ir.actions.server">
<field name="name">Done</field>