Skip to content

Commit

Permalink
Merge a8fb44a into bfb8633
Browse files Browse the repository at this point in the history
  • Loading branch information
Chandresh-SerpentCS committed Jun 23, 2018
2 parents bfb8633 + a8fb44a commit f9a7149
Show file tree
Hide file tree
Showing 13 changed files with 67 additions and 56 deletions.
1 change: 1 addition & 0 deletions oca_dependencies.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# list the OCA project dependencies, one per line
# add a github url if you need a forked version
project-service
reporting-engine
1 change: 1 addition & 0 deletions project_billing_utils/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Contributors
* 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
----------
Expand Down
4 changes: 1 addition & 3 deletions project_billing_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,5 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import project
from . import models
from . import wizard
from . import invoice
from . import analytic
16 changes: 8 additions & 8 deletions project_billing_utils/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@
##############################################################################
{
'name': 'Analytic and project wizard for service companies',
'version': '8.0.1.4',
'version': '9.0.1.0.0',
'category': 'Generic Modules/Projects & Services',
'author': "Camptocamp,Odoo Community Association (OCA)",
'author': 'Camptocamp,Odoo Community Association (OCA),'
'Serpent Consulting Services Pvt. Ltd.',
'website': 'http://www.camptocamp.com',
'depends': ['project',
'hr_timesheet_invoice',
'project_analytic_line_view'],
'license': 'AGPL-3',
'depends': ['project', 'hr_timesheet'],
'data': [
'invoice_view.xml',
'project_view.xml',
'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': False,
'installable': True,
'auto_install': False,
'application': False,
}
13 changes: 0 additions & 13 deletions project_billing_utils/invoice_view.xml

This file was deleted.

6 changes: 6 additions & 0 deletions project_billing_utils/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# 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
Expand Up @@ -20,7 +20,7 @@
##############################################################################
"""Changes to allow the dissociate analytic lines wizard to work."""

from openerp import models, api
from openerp import models, api, fields


class AccountAnalyticLine(models.Model):
Expand All @@ -29,6 +29,8 @@ class AccountAnalyticLine(models.Model):

_inherit = 'account.analytic.line'

invoice_id = fields.Many2one("account.invoice", "Invoice")

@api.multi
def write(self, vals):
"""Put a key in the vals, since we have no context. Return super."""
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def unlink(self):
# If we found line linked with account we raise an error
if account_lines:
raise exceptions.Warning(
_('Invalid Action'),
_('You cannot delete account %s as there are analytic '
'lines linked to it') % project.name)
else:
Expand Down
18 changes: 0 additions & 18 deletions project_billing_utils/project_view.xml

This file was deleted.

24 changes: 24 additions & 0 deletions project_billing_utils/views/invoice_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0"?>
<openerp>
<data>

<act_window
id="act_aal_account_invoice_opened"
name="Analytic Lines"
res_model="account.analytic.line"
domain="[('invoice_id', '=', [active_id])]"
src_model="account.invoice"/>

<record id="view_account_analytic_line_form_project_invoice_inherit" model="ir.ui.view">
<field name="name">account.analytic.line.form.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="invoice_id"/>
</field>
</field>
</record>

</data>
</openerp>
18 changes: 18 additions & 0 deletions project_billing_utils/views/project_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<openerp>
<data>

<!-- 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>

</data>
</openerp>
17 changes: 5 additions & 12 deletions project_billing_utils/wizard/blank_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,13 @@ def _prepare_invoice(self, project):
"""
if not project.partner_id:
raise exceptions.Warning(
_('UserError'),
_('The Partner is missing on the project:\n%s') % project.name)

if not project.pricelist_id:
raise exceptions.Warning(
_('UserError'),
_('The Customer Pricelist is '
'missing on the project:\n%s') % project.name)

partner = project.partner_id

date_due = False
if partner.property_payment_term:
pterm_list = partner.property_payment_term.compute(
if partner.property_payment_term_id:
pterm_list = partner.property_payment_term_id.compute(
value=1,
date_ref=fields.Date.today())
if pterm_list:
Expand All @@ -64,9 +57,9 @@ def _prepare_invoice(self, project):
'type': 'out_invoice',
'date_due': date_due,
'partner_id': partner.id,
'payment_term': partner.property_payment_term.id or False,
'account_id': partner.property_account_receivable.id,
'currency_id': project.pricelist_id.currency_id.id,
'payment_term': partner.property_payment_term_id.id or False,
'account_id': partner.property_account_receivable_id.id,
'currency_id': project.currency_id.id,
}

@api.multi
Expand Down

0 comments on commit f9a7149

Please sign in to comment.