Files
odoo_source/addons/sale_project/models/project_milestone.py
T
Rohitkumar (roku) f7f3d9610b [IMP] sale_(project): improve the UX for project app
Purpose of this commit to improve generic usage of project app.

So in this commit done the following changes:
 - switch the id and the priority fields from place for task list view
 - add a 'view sales order' button that should open the form view of the SO
   linked to the SOL set on the milestone for milestone list view
 - add a 'sales order' stat button that should open the form view of the SO
   linked to the SOL set on the milestone for milestone form view
 - add a 'done' option; represent it in purple in status field
 - if there is only 1 assignee, display its name on the card instead of
   1 assignee for project sharing kanban view
 - add an 'all tasks' menu on the right of the 'my tasks' one

task-2917086

closes odoo/odoo#97669

Related: odoo/upgrade#3893
Related: odoo/enterprise#30195
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
2022-11-25 17:55:56 +01:00

32 lines
1.3 KiB
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
class ProjectMilestone(models.Model):
_name = 'project.milestone'
_inherit = 'project.milestone'
allow_billable = fields.Boolean(related='project_id.allow_billable')
project_partner_id = fields.Many2one(related='project_id.partner_id')
sale_line_id = fields.Many2one('sale.order.line', 'Sales Order Item', help='Sales Order Item that will be updated once the milestone is reached.',
domain="[('order_partner_id', '=?', project_partner_id), ('qty_delivered_method', '=', 'milestones')]")
quantity_percentage = fields.Float('Quantity', help='Percentage of the ordered quantity that will automatically be delivered once the milestone is reached.')
sale_line_name = fields.Text(related='sale_line_id.name')
@api.model
def _get_fields_to_export(self):
return super()._get_fields_to_export() + ['allow_billable', 'quantity_percentage', 'sale_line_name']
def action_view_sale_order(self):
self.ensure_one()
return {
'type': 'ir.actions.act_window',
'name': _('Sales Order'),
'res_model': 'sale.order',
'res_id': self.sale_line_id.order_id.id,
'view_mode': 'form',
}