diff --git a/addons/account_sale_timesheet/__init__.py b/addons/account_sale_timesheet/__init__.py new file mode 100644 index 00000000000..dc5e6b693d1 --- /dev/null +++ b/addons/account_sale_timesheet/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from . import models diff --git a/addons/account_sale_timesheet/__manifest__.py b/addons/account_sale_timesheet/__manifest__.py new file mode 100644 index 00000000000..792e8e8fb86 --- /dev/null +++ b/addons/account_sale_timesheet/__manifest__.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + + +{ + 'name': 'Account Sale Timesheet', + 'version': '1.0', + 'category': 'Account/sale/timesheet', + 'summary': 'Account sale timesheet', + 'description': 'Bridge created to add the number of invoices linked to an AA to a project form', + 'depends': ['account', 'sale_timesheet'], + 'data': [ + 'views/project_project_views.xml', + ], + 'demo': [], + 'installable': True, + 'auto_install': True, + 'license': 'OEEL-1', +} diff --git a/addons/account_sale_timesheet/models/__init__.py b/addons/account_sale_timesheet/models/__init__.py new file mode 100644 index 00000000000..527e2954c06 --- /dev/null +++ b/addons/account_sale_timesheet/models/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from . import project diff --git a/addons/account_sale_timesheet/models/project.py b/addons/account_sale_timesheet/models/project.py new file mode 100644 index 00000000000..d8086b57a4c --- /dev/null +++ b/addons/account_sale_timesheet/models/project.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import fields, models, _ + +class Project(models.Model): + _inherit = 'project.project' + + invoice_count = fields.Integer(related='analytic_account_id.invoice_count') + + # ---------------------------- + # Project Updates + # ---------------------------- + + def _get_stat_buttons(self): + buttons = super(Project, self)._get_stat_buttons() + buttons.append({ + 'icon': 'pencil-square-o', + 'text': _('Invoices'), + 'number': self.invoice_count, + 'action_type': 'object', + 'action': 'action_open_project_invoices', + 'show': self.user_has_groups('account.group_account_readonly') and bool(self.analytic_account_id) and self.invoice_count > 0, + 'sequence': 11, + }) + return buttons diff --git a/addons/account_sale_timesheet/views/project_project_views.xml b/addons/account_sale_timesheet/views/project_project_views.xml new file mode 100644 index 00000000000..77a119d9b6a --- /dev/null +++ b/addons/account_sale_timesheet/views/project_project_views.xml @@ -0,0 +1,26 @@ + + + + + project.project.form.inherit + project.project + + + + + + + + +