This commit (and its enterprise equivalent) purpose is to smooth the user experience and remove unnecessary steps. The commits: - Remove all stat buttons except the status and collaborators one from the project edit form. - Add multiple small changes to string/name fo fields in views - Change the custom O2M widget for a standard M2M for the management of child tasks - Add the milestone field to the portal page of shared project. - Remove the wizard 'marked_as_reached_milestone' - Add the automatic generation of milestone when a SO is confirmed if some SOL need it task-2941835 closes odoo/odoo#98546 Related: odoo/enterprise#30628 Related: odoo/upgrade#3798 Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
39 lines
1.9 KiB
Python
39 lines
1.9 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import _lt
|
|
from odoo.osv.expression import OR
|
|
|
|
from odoo.addons.project.controllers.portal import ProjectCustomerPortal
|
|
|
|
|
|
class SaleProjectCustomerPortal(ProjectCustomerPortal):
|
|
|
|
def _task_get_searchbar_groupby(self, milestones_allowed):
|
|
values = super()._task_get_searchbar_groupby(milestones_allowed)
|
|
values['sale_order'] = {'input': 'sale_order', 'label': _lt('Sales Order'), 'order': 8}
|
|
values['sale_line'] = {'input': 'sale_line', 'label': _lt('Sales Order Item'), 'order': 9}
|
|
return dict(sorted(values.items(), key=lambda item: item[1]["order"]))
|
|
|
|
def _task_get_groupby_mapping(self):
|
|
groupby_mapping = super()._task_get_groupby_mapping()
|
|
groupby_mapping.update(sale_order='sale_order_id', sale_line='sale_line_id')
|
|
return groupby_mapping
|
|
|
|
def _task_get_searchbar_inputs(self, milestones_allowed):
|
|
values = super()._task_get_searchbar_inputs(milestones_allowed)
|
|
values['sale_order'] = {'input': 'sale_order', 'label': _lt('Search in Sales Order'), 'order': 8}
|
|
values['sale_line'] = {'input': 'sale_line', 'label': _lt('Search in Sales Order Item'), 'order': 9}
|
|
values['invoice'] = {'input': 'invoice', 'label': _lt('Search in Invoice'), 'order': 10}
|
|
return dict(sorted(values.items(), key=lambda item: item[1]["order"]))
|
|
|
|
def _task_get_search_domain(self, search_in, search):
|
|
search_domain = [super()._task_get_search_domain(search_in, search)]
|
|
if search_in in ('sale_order', 'all'):
|
|
search_domain.append([('sale_order_id.name', 'ilike', search)])
|
|
if search_in in ('sale_line', 'all'):
|
|
search_domain.append([('sale_line_id.name', 'ilike', search)])
|
|
if search_in in ('invoice', 'all'):
|
|
search_domain.append([('sale_order_id.invoice_ids.name', 'ilike', search)])
|
|
return OR(search_domain)
|