diff --git a/cor_custom/models/__init__.py b/cor_custom/models/__init__.py index e6f2e93..57c1fa3 100755 --- a/cor_custom/models/__init__.py +++ b/cor_custom/models/__init__.py @@ -5,4 +5,5 @@ from . import models from . import project from . import project_overview from . import analytic -from . import product \ No newline at end of file +from . import product +from . import sale \ No newline at end of file diff --git a/cor_custom/models/project.py b/cor_custom/models/project.py index 022e993..0421303 100755 --- a/cor_custom/models/project.py +++ b/cor_custom/models/project.py @@ -24,6 +24,20 @@ class Project(models.Model): ('no_limit', 'Projects that have no time limit') ], string="Project Type", default="no_limit") + privacy_visibility = fields.Selection([ + ('followers', 'Invited internal users'), + ('employees', 'All internal users'), + ('portal', 'Invited portal users and all internal users'), + ], + string='Visibility', required=True, + default='followers', + help="Defines the visibility of the tasks of the project:\n" + "- Invited internal users: employees may only see the followed project and tasks.\n" + "- All internal users: employees may see all project and tasks.\n" + "- Invited portal and all internal users: employees may see everything." + " Portal users may see project and tasks followed by\n" + " them or by someone of their company.") + class InheritProjectProductEmployeeMap(models.Model): _inherit = 'project.sale.line.employee.map' diff --git a/cor_custom/models/sale.py b/cor_custom/models/sale.py new file mode 100755 index 0000000..c2e54c1 --- /dev/null +++ b/cor_custom/models/sale.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- + +from odoo import api, fields, models, _ + + +class SaleOrderLine(models.Model): + _inherit = 'sale.order.line' + + def _timesheet_create_project_prepare_values(self): + """Generate project values""" + values = super()._timesheet_create_project_prepare_values() + name = False + project_mangager_id = False + if self.order_id.opportunity_id: + name = self.order_id.opportunity_id.project_name + project_mangager_id = self.order_id.opportunity_id.project_manager_id.id if self.order_id.opportunity_id.project_manager_id else False + elif self.order_id.client_order_ref: + name = self.order_id.client_order_ref + if name: + name = '%s - %s' % (name, self.order_id.name) + else: + name = self.order_id.name + values['name'] = name + if project_mangager_id: + values['user_id'] = project_mangager_id + return values + + + + + + + diff --git a/cor_custom/wizard/crm_opportunity_to_quotation.py b/cor_custom/wizard/crm_opportunity_to_quotation.py index 614003d..22372da 100755 --- a/cor_custom/wizard/crm_opportunity_to_quotation.py +++ b/cor_custom/wizard/crm_opportunity_to_quotation.py @@ -8,14 +8,13 @@ from odoo.exceptions import UserError class Opportunity2Quotation(models.TransientModel): _inherit = 'crm.quotation.partner' - action = fields.Selection([ ('create', 'Create a new client'), ('exist', 'Link to an existing client'), ('nothing', 'Do not link to a client') - ], string='Quotation client', required=True) + ], string='Quotation Client', required=True) lead_id = fields.Many2one('crm.lead', "Associated Lead", required=True) - partner_id = fields.Many2one('res.partner', 'Customer') + partner_id = fields.Many2one('res.partner', 'Client')