Skip to content
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
wants to merge 46 commits into
base: 11.0
Choose a base branch
from
Open
Show file tree
Hide file tree
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 Aug 12, 2011
2091678
[MRG] From trunk
yvaucher Sep 1, 2011
84082d4
[MRG] Merge from c2c instance
jgrandguillaume Nov 1, 2011
9b61153
[MRG] from trunk
nbessi Apr 2, 2012
30b9b6e
[MRG] from 6.1
yvaucher Jul 24, 2012
db63278
[MRG] from 6.1
Oct 17, 2012
38a8dcd
[MRG] from upstream
Apr 18, 2012
d1a629f
[FIX] domain view for invoice filtering
vrenaville Jun 5, 2012
2020c7f
[IMP] project_billing_utils: add a _prepare_invoice method so the inv…
Sep 19, 2012
c6bdb00
[FIX] project_billing_utils - context in invoices from project changed
yvaucher Oct 3, 2012
5ef3e8a
[MIGR] created 7.0 branch, marked modules as not installable
gurneyalex Jun 20, 2013
009e156
[MIG] portage of project_billing_utils by OpenERP
yvaucher Jun 20, 2013
af8aa7f
[IMP] project_billing_utils - chmod -x
yvaucher Jun 20, 2013
a52b3a2
[IMP] project_billing_utils - update license
yvaucher Jun 20, 2013
cc45794
[IMP] project_billing_utils - use orm.Model and orm.TransientModel in…
yvaucher Jun 20, 2013
bdded07
[IMP] project_billing_utils - coding style + adding missing context
yvaucher Jun 20, 2013
3f6e6e8
[IMP] project_billing_utils - update with last changes of 6.1 (this p…
yvaucher Jun 20, 2013
225f1f4
[IMP] project_billing_utils - retab xml
yvaucher Jun 20, 2013
7a2883d
[IMP] project_billing_utils - clean xml view inherit of edit project
yvaucher Jun 20, 2013
acac262
[IMP] project_billing_utils - give some spaces
yvaucher Jun 20, 2013
95322b5
[IMP] style in __openerp__.py
yvaucher Jun 20, 2013
0b465af
[FIX] project_billing_utils - ids can be long in unlink overwrite of …
yvaucher Jul 23, 2013
c50c9df
[IMP] project_billing_utils - remove camelcase for variable
yvaucher Jul 23, 2013
9b571b5
[IMP] project_billing_utils - add missing context propagation
yvaucher Jul 23, 2013
8861ba7
[IMP] project_billing_utils - avoid sql injection by passing ids dire…
yvaucher Jul 23, 2013
5ecf3cf
[IMP] project_billing_utils - add return True to unlink of project
yvaucher Jul 23, 2013
69214c6
[IMP] project_billing_utils - remove useless construct of list of ids…
yvaucher Jul 23, 2013
57af0f3
[FIX] change hr.analytic.timesheet instead of account.analytic.line w…
vrenaville Oct 31, 2013
b56a252
[FIX] account analytic get active model
vrenaville Oct 31, 2013
82e4b58
[fix] use the orm, not sql to dissociate analytic lines from invoices.
lepistone Jan 7, 2014
c98503f
[FIX] remove contact_id and address_contact_id (not used in V7)
vrenaville Apr 2, 2014
3f9ce94
[REF] auto-fix conventions
moylop260 Nov 14, 2014
b95e461
[FIX] Travis
pedrobaeza Dec 30, 2014
78cf26b
[PRT] Move modules to __unported__ for 8.0 branch creation
Feb 2, 2015
d11a05a
[MIG] migrate module 'project_billing_utils' to v8
damdam-s Jul 23, 2015
99c7ec7
[IMP] add README.rst
damdam-s Jul 30, 2015
0d1a1fc
[FIX] remove summary key as it is the same in readme.rst
damdam-s Aug 6, 2015
807008e
[FIX] typos
damdam-s Aug 6, 2015
8299f35
[FIX] fix according to code review
damdam-s Aug 6, 2015
1ab682e
[FIX] fix invoice name_get
damdam-s Aug 6, 2015
ac4109f
Use new module "project_analytic_line_view"
mdietrichc2c Aug 13, 2015
077c694
[MIG] Make modules uninstallable
pedrobaeza Oct 14, 2015
1d39a56
[MIG] Rename manifest files
pedrobaeza Oct 6, 2016
ceed42e
[MIG] Migrated project_billing_utils module in v11.
Chandresh-SerpentCS Jun 26, 2018
dff40e4
[ADD] Added runbot link.
Chandresh-SerpentCS Aug 30, 2018
ee28f9b
[IMP] Improved the code as per the mentioned comments.
Chandresh-SerpentCS Oct 1, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions oca_dependencies.txt
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
63 changes: 63 additions & 0 deletions project_billing_utils/README.rst
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.
4 changes: 4 additions & 0 deletions project_billing_utils/__init__.py
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
27 changes: 27 additions & 0 deletions project_billing_utils/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
##############################################################################
#
Copy link
Member

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.

# 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,
}
5 changes: 5 additions & 0 deletions project_billing_utils/models/__init__.py
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
32 changes: 32 additions & 0 deletions project_billing_utils/models/analytic.py
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)
54 changes: 54 additions & 0 deletions project_billing_utils/models/invoice.py
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()
30 changes: 30 additions & 0 deletions project_billing_utils/models/project.py
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, _

Choose a reason for hiding this comment

The 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
21 changes: 21 additions & 0 deletions project_billing_utils/views/invoice_view.xml
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>
16 changes: 16 additions & 0 deletions project_billing_utils/views/project_view.xml
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>
6 changes: 6 additions & 0 deletions project_billing_utils/wizard/__init__.py
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
32 changes: 32 additions & 0 deletions project_billing_utils/wizard/associate_aal.py
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})

Choose a reason for hiding this comment

The 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',
}
31 changes: 31 additions & 0 deletions project_billing_utils/wizard/associate_aal_view.xml
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>
Loading