-
-
Notifications
You must be signed in to change notification settings - Fork 98
[11.0] [MIG] project_billing_utils: Migrated module for v11. #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 11.0
Are you sure you want to change the base?
Changes from 44 commits
6dcbe85
2091678
84082d4
9b61153
30b9b6e
db63278
38a8dcd
d1a629f
2020c7f
c6bdb00
5ef3e8a
009e156
af8aa7f
a52b3a2
cc45794
bdded07
3f6e6e8
225f1f4
7a2883d
acac262
95322b5
0b465af
c50c9df
9b571b5
8861ba7
5ecf3cf
69214c6
57af0f3
b56a252
82e4b58
c98503f
3f9ce94
b95e461
78cf26b
d11a05a
99c7ec7
0d1a1fc
807008e
8299f35
1ab682e
ac4109f
077c694
1d39a56
ceed42e
dff40e4
ee28f9b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # list the OCA project dependencies, one per line | ||
| # add a github url if you need a forked version | ||
| project |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
| :alt: License: AGPL-3 | ||
|
|
||
| Analytic and project wizard for service companies | ||
| ================================================= | ||
|
|
||
|
|
||
| Improve the view of analytic and timesheet lines for the project manager | ||
| Add a wizard to manage project and invoicing: | ||
|
|
||
| * Associate Analytic Lines to invoice (from an invoice or from analytic line directly) | ||
| * Dissociate Analytic Lines from an invoice | ||
| * Get all invoices from Project (with recursion in child account) | ||
| * Get Analytic Lines from an invoice for controlling | ||
| * Create a blank invoice from project (with related infos) | ||
|
|
||
|
|
||
| For further information, please visit: | ||
|
|
||
| * https://www.odoo.com/forum/help-1 | ||
|
|
||
|
|
||
| Bug Tracker | ||
| =========== | ||
|
|
||
| Bugs are tracked on `GitHub Issues <https://github.com/OCA/project-reporting/issues>`_. | ||
| In case of trouble, please check there if your issue has already been reported. | ||
| If you spotted it first, help us smashing it by providing a detailed and welcomed feedback | ||
| `here <https://github.com/OCA/project-reporting/issues/new?body=module:%20project_billing_utils%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
|
||
|
|
||
| Credits | ||
| ======= | ||
|
|
||
| Contributors | ||
| ------------ | ||
|
|
||
| * Yannick Vaucher <yannick.vaucher@camptocamp.com> | ||
| * Daniel Reis <dgreis@sapo.pt> | ||
| * Joël Grand-Guillaume <joel.grandguillaume@camptocamp.com> | ||
| * Leonardo Pistone <leonardo.pistone@camptocamp.com> | ||
| * Alexandre Fayolle <alexandre.fayolle@camptocamp.com> | ||
| * Vincent Renaville <vincent.renaville@camptocamp.com> | ||
| * Damien Crier <damien.crier@camptocamp.com> | ||
| * Serpent Consulting Services Pvt. Ltd. <contact@serpentcs.com> | ||
|
|
||
| Maintainer | ||
| ---------- | ||
|
|
||
| .. image:: https://odoo-community.org/logo.png | ||
| :alt: Odoo Community Association | ||
| :target: https://odoo-community.org | ||
|
|
||
| This module is maintained by the OCA. | ||
|
|
||
| OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
| mission is to support the collaborative development of Odoo features and | ||
| promote its widespread use. | ||
|
|
||
| To contribute to this module, please visit http://odoo-community.org. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| ############################################################################## | ||
| # | ||
| # Author: Joël Grand-Guillaume, Leonardo Pistone | ||
| # Copyright 2010-2014 Camptocamp SA | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
| ############################################################################## | ||
|
|
||
| from . import models | ||
| from . import wizard |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| ############################################################################## | ||
| # | ||
| # Author: Joël Grand-Guillaume | ||
| # Copyright 2010 Camptocamp SA | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
| ############################################################################## | ||
|
|
||
| { | ||
| 'name': 'Analytic and project wizard for service companies', | ||
| 'version': '11.0.1.0.0', | ||
| 'category': 'Generic Modules/Projects & Services', | ||
| 'author': "Camptocamp,Odoo Community Association (OCA)," | ||
| "Serpent Consulting Services Pvt. Ltd.", | ||
| 'website': 'https://www.camptocamp.com', | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO Change website as per this |
||
| 'depends': ['project', | ||
| 'hr_timesheet', | ||
| 'account', | ||
| 'sale_timesheet'], | ||
| 'license': 'AGPL-3', | ||
| 'data': [ | ||
| 'views/invoice_view.xml', | ||
| 'views/project_view.xml', | ||
| 'wizard/associate_aal_view.xml', | ||
| 'wizard/dissociate_aal_view.xml', | ||
| 'wizard/open_invoices_view.xml', | ||
| 'wizard/blank_invoice_view.xml', | ||
| ], | ||
| 'installable': True, | ||
| 'auto_install': False, | ||
| 'application': False, | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
|
||
| from . import analytic | ||
| from . import invoice | ||
| from . import project |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| ############################################################################## | ||
| # | ||
| # Author: Leonardo Pistone | ||
| # Copyright 2014 Camptocamp SA | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
| ############################################################################## | ||
|
|
||
| """Changes to allow the dissociate analytic lines wizard to work.""" | ||
|
|
||
| from odoo import models, api | ||
|
|
||
|
|
||
| class AccountAnalyticLine(models.Model): | ||
|
|
||
| """Hack the analytic line to optionally skip the invoice check.""" | ||
|
|
||
| _inherit = 'account.analytic.line' | ||
|
|
||
| @api.multi | ||
| def write(self, vals): | ||
| """Put a key in the vals, since we have no context. Return super.""" | ||
| if self.env.context.get('skip_invoice_check'): | ||
| vals['_x_vals_skip_invoice_check'] = True | ||
| return super(AccountAnalyticLine, self).write(vals) | ||
|
|
||
| @api.multi | ||
| def _check_inv(self, vals): | ||
| """Optionally skip invoice check. Return boolean.""" | ||
| if '_x_vals_skip_invoice_check' in vals: | ||
| del vals['_x_vals_skip_invoice_check'] | ||
| return True | ||
| return super(AccountAnalyticLine, self)._check_inv(vals) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| ############################################################################## | ||
| # | ||
| # Author: Joël Grand-Guillaume | ||
| # Copyright 2010 Camptocamp SA | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
| ############################################################################## | ||
|
|
||
| from odoo import models, api | ||
|
|
||
|
|
||
| class AccountInvoice(models.Model): | ||
| _inherit = 'account.invoice' | ||
|
|
||
| @api.multi | ||
| def name_get(self): | ||
| if 'special_search' not in self.env.context: | ||
| return super(AccountInvoice, self).name_get() | ||
| else: | ||
| if not self: | ||
| return [] | ||
| # We will return value | ||
| rest = [] | ||
| for r in self: | ||
| partner_name = r.partner_id.name_get() | ||
| if partner_name: | ||
| partner_name = partner_name[0][1] | ||
| rest.append( | ||
| (r['id'], | ||
| ('%s - %s - %s' % (r.number or '', | ||
| partner_name or '', r.name or '')) | ||
| ) | ||
| ) | ||
| # We will | ||
| return rest | ||
|
|
||
| @api.model | ||
| def name_search(self, name, args=None, operator='ilike', limit=100): | ||
| if 'special_search' not in self.env.context: | ||
| return super(AccountInvoice, self).name_search( | ||
| name, args=args, operator=operator, limit=limit) | ||
| invoices = self.env['account.invoice'] | ||
| if not args: | ||
| args = [] | ||
| if name: | ||
| invoices = self.search( | ||
| [('number', operator, name)] + args, limit=limit) | ||
| if not invoices: | ||
| invoices = self.search( | ||
| [('commercial_partner_id.name', operator, name)] + args, | ||
| limit=limit) | ||
| if not invoices: | ||
| invoices = self.search( | ||
| [('partner_id.name', operator, name)] + args, limit=limit) | ||
| return invoices.name_get() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| ############################################################################## | ||
| # | ||
| # Author: Joël Grand-Guillaume | ||
| # Copyright 2010 Camptocamp SA | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
| ############################################################################## | ||
|
|
||
| from odoo import models, api, _ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good to follow alphabetically ordered in imports |
||
| from odoo import exceptions | ||
|
|
||
|
|
||
| class ProjectProject(models.Model): | ||
| _inherit = 'project.project' | ||
| _description = 'Project' | ||
|
|
||
| @api.multi | ||
| def unlink(self): | ||
| # We will check if the account have no analytic line linked | ||
| account_line_obj = self.env['account.analytic.line'] | ||
| for project in self: | ||
| account_lines = account_line_obj.search( | ||
| [('account_id', '=', project.analytic_account_id.id)]) | ||
| # If we found line linked with account we raise an error | ||
| if account_lines: | ||
| raise exceptions.Warning( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO here |
||
| _('Invalid Action'), | ||
| _('You cannot delete account %s as there are analytic ' | ||
| 'lines linked to it') % project.name) | ||
| else: | ||
| super(ProjectProject, project).unlink() | ||
| return True | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| <?xml version="1.0"?> | ||
| <odoo> | ||
| <act_window | ||
| id="act_aal_account_invoice_opened" | ||
| name="Analytic Lines" | ||
| res_model="account.analytic.line" | ||
| domain="[('timesheet_invoice_id', '=', [active_id])]" | ||
| src_model="account.invoice"/> | ||
|
|
||
| <record id="view_account_analytic_line_inherit_project_invoice" model="ir.ui.view"> | ||
| <field name="name">account.analytic.line.project.invoice</field> | ||
| <field name="model">account.analytic.line</field> | ||
| <field name="inherit_id" ref="account.view_account_analytic_line_form_inherit_account"/> | ||
| <field name="arch" type="xml"> | ||
| <field name="move_id" position="after"> | ||
| <field name="timesheet_invoice_id"/> | ||
| </field> | ||
| </field> | ||
| </record> | ||
|
|
||
| </odoo> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| <?xml version="1.0"?> | ||
| <odoo> | ||
|
|
||
| <!-- set partner_id required --> | ||
| <record id="edit_project" model="ir.ui.view"> | ||
| <field name="name">project.project.form</field> | ||
| <field name="model">project.project</field> | ||
| <field name="inherit_id" ref="project.edit_project" /> | ||
| <field name="arch" type="xml"> | ||
| <field name="partner_id" position="attributes"> | ||
| <attribute name="required">1</attribute> | ||
| </field> | ||
| </field> | ||
| </record> | ||
|
|
||
| </odoo> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| ############################################################################## | ||
| # | ||
| # Author: Joël Grand-Guillaume | ||
| # Copyright 2010 Camptocamp SA | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
| ############################################################################## | ||
|
|
||
| from . import associate_aal | ||
| from . import dissociate_aal | ||
| from . import open_invoices | ||
| from . import blank_invoice |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| ############################################################################## | ||
| # | ||
| # Author: Joël Grand-Guillaume | ||
| # Copyright 2010 Camptocamp SA | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
| ############################################################################## | ||
|
|
||
| from odoo import models, api, fields, _ | ||
|
|
||
|
|
||
| class AssociateInvoice(models.TransientModel): | ||
| _name = 'associate.aal.to.invoice' | ||
| _description = 'Associate Analytic Lines' | ||
| invoice_id = fields.Many2one('account.invoice', string='Invoice', | ||
| required=True) | ||
|
|
||
| @api.multi | ||
| def associate_aal(self): | ||
| aal_obj = self.env[self.env.context['active_model']] | ||
| aal_ids = self.env.context.get('active_ids', False) | ||
| aal_rs = aal_obj.browse(aal_ids) | ||
| aal_rs.write({'timesheet_invoice_id': self.invoice_id.id}) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aal_rs.timesheet_invoice_id = self.invoice_id.id is better. |
||
| return { | ||
| 'domain': "[('id','in', [%s])]" % (self.invoice_id.id,), | ||
| 'name': _('Associated invoice'), | ||
| 'view_type': 'form', | ||
| 'view_mode': 'tree,form', | ||
| 'res_model': 'account.invoice', | ||
| 'view_id': False, | ||
| 'context': self.env.context, | ||
| 'type': 'ir.actions.act_window', | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <odoo> | ||
|
|
||
| <record id="view_associate_aal_to_invoice" model="ir.ui.view"> | ||
| <field name="name">Associate To Invoice</field> | ||
| <field name="model">associate.aal.to.invoice</field> | ||
| <field name="arch" type="xml"> | ||
| <form string="Associate Analytic Lines"> | ||
| <group colspan="4" col="4"> | ||
| <separator string="Associate Analytic Lines to invoice ?" colspan="4"/> | ||
| <field name="invoice_id" context="{'special_search':True}" domain="[('type','in',('out_invoice','in_invoice'))]"/> | ||
| </group> | ||
| <footer> | ||
| <button special="cancel" string="_Cancel" class="fa fa-times" /> | ||
| <button name="associate_aal" string="_Ok" type="object" class="fa fa-check"/> | ||
| </footer> | ||
| </form> | ||
| </field> | ||
| </record> | ||
|
|
||
| <act_window | ||
| name="Associate Analytic Line" | ||
| res_model="associate.aal.to.invoice" | ||
| src_model="account.analytic.line" | ||
| key2="client_action_multi" | ||
| view_mode="form" | ||
| view_type="form" | ||
| target="new" | ||
| id="action_associate_invoice"/> | ||
|
|
||
| </odoo> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Chandresh-SerpentCS Remove copyright from all
__init__.filefile.