-
-
Notifications
You must be signed in to change notification settings - Fork 91
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
[11.0] [MIG] project_billing_utils: Migrated module for v11. #27
Open
Chandresh-SerpentCS
wants to merge
46
commits into
OCA:11.0
Choose a base branch
from
Chandresh-SerpentCS:11.0-MIG-project_billing_utils
base: 11.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
6dcbe85
[ADD] Commit of the modules used by C2C to move in our new public branch
jgrandguillaume 2091678
[MRG] From trunk
yvaucher 84082d4
[MRG] Merge from c2c instance
jgrandguillaume 9b61153
[MRG] from trunk
nbessi 30b9b6e
[MRG] from 6.1
yvaucher db63278
[MRG] from 6.1
38a8dcd
[MRG] from upstream
d1a629f
[FIX] domain view for invoice filtering
vrenaville 2020c7f
[IMP] project_billing_utils: add a _prepare_invoice method so the inv…
c6bdb00
[FIX] project_billing_utils - context in invoices from project changed
yvaucher 5ef3e8a
[MIGR] created 7.0 branch, marked modules as not installable
gurneyalex 009e156
[MIG] portage of project_billing_utils by OpenERP
yvaucher af8aa7f
[IMP] project_billing_utils - chmod -x
yvaucher a52b3a2
[IMP] project_billing_utils - update license
yvaucher cc45794
[IMP] project_billing_utils - use orm.Model and orm.TransientModel in…
yvaucher bdded07
[IMP] project_billing_utils - coding style + adding missing context
yvaucher 3f6e6e8
[IMP] project_billing_utils - update with last changes of 6.1 (this p…
yvaucher 225f1f4
[IMP] project_billing_utils - retab xml
yvaucher 7a2883d
[IMP] project_billing_utils - clean xml view inherit of edit project
yvaucher acac262
[IMP] project_billing_utils - give some spaces
yvaucher 95322b5
[IMP] style in __openerp__.py
yvaucher 0b465af
[FIX] project_billing_utils - ids can be long in unlink overwrite of …
yvaucher c50c9df
[IMP] project_billing_utils - remove camelcase for variable
yvaucher 9b571b5
[IMP] project_billing_utils - add missing context propagation
yvaucher 8861ba7
[IMP] project_billing_utils - avoid sql injection by passing ids dire…
yvaucher 5ecf3cf
[IMP] project_billing_utils - add return True to unlink of project
yvaucher 69214c6
[IMP] project_billing_utils - remove useless construct of list of ids…
yvaucher 57af0f3
[FIX] change hr.analytic.timesheet instead of account.analytic.line w…
vrenaville b56a252
[FIX] account analytic get active model
vrenaville 82e4b58
[fix] use the orm, not sql to dissociate analytic lines from invoices.
lepistone c98503f
[FIX] remove contact_id and address_contact_id (not used in V7)
vrenaville 3f9ce94
[REF] auto-fix conventions
moylop260 b95e461
[FIX] Travis
pedrobaeza 78cf26b
[PRT] Move modules to __unported__ for 8.0 branch creation
d11a05a
[MIG] migrate module 'project_billing_utils' to v8
damdam-s 99c7ec7
[IMP] add README.rst
damdam-s 0d1a1fc
[FIX] remove summary key as it is the same in readme.rst
damdam-s 807008e
[FIX] typos
damdam-s 8299f35
[FIX] fix according to code review
damdam-s 1ab682e
[FIX] fix invoice name_get
damdam-s ac4109f
Use new module "project_analytic_line_view"
mdietrichc2c 077c694
[MIG] Make modules uninstallable
pedrobaeza 1d39a56
[MIG] Rename manifest files
pedrobaeza ceed42e
[MIG] Migrated project_billing_utils module in v11.
Chandresh-SerpentCS dff40e4
[ADD] Added runbot link.
Chandresh-SerpentCS ee28f9b
[IMP] Improved the code as per the mentioned comments.
Chandresh-SerpentCS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
.. 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 | ||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: https://runbot.odoo-community.org/runbot/139/11.0 | ||
|
||
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 <[email protected]> | ||
* Daniel Reis <[email protected]> | ||
* Joël Grand-Guillaume <[email protected]> | ||
* Leonardo Pistone <[email protected]> | ||
* Alexandre Fayolle <[email protected]> | ||
* Vincent Renaville <[email protected]> | ||
* Damien Crier <[email protected]> | ||
* Serpent Consulting Services Pvt. Ltd. <[email protected]> | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import models | ||
from . import wizard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
############################################################################## | ||
# | ||
# 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)", | ||
'website': 'https://github.com/OCA/project-reporting', | ||
'depends': ['hr_timesheet', '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, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
############################################################################## | ||
# | ||
# 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.exceptions import UserError | ||
|
||
|
||
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 UserError( | ||
_('You cannot delete project %s as there are analytic ' | ||
'lines linked to it') % project.name) | ||
else: | ||
super(ProjectProject, project).unlink() | ||
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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__.file
file.