Skip to content

Commit

Permalink
[10.0][ADD] account_invoice_date_required
Browse files Browse the repository at this point in the history
  • Loading branch information
rousseldenis committed Mar 14, 2019
1 parent cbe957e commit 60635b4
Show file tree
Hide file tree
Showing 16 changed files with 636 additions and 0 deletions.
91 changes: 91 additions & 0 deletions account_invoice_date_required/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
=============================
Account Invoice Date Required
=============================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--invoicing-lightgray.png?logo=github
:target: https://github.com/OCA/account-invoicing/tree/10.0/account_invoice_date_required
:alt: OCA/account-invoicing
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-invoicing-10-0/account-invoicing-10-0-account_invoice_date_required
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/95/10.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

In Odoo, when you validate an invoice with a void invoice date, it is
automatically filled in with current date (today).

The invoice validation is now restricted if the invoice date is not filled in.

**Table of contents**

.. contents::
:local:

Usage
=====

Create an invoice with a void date (Invoicing > Sales > Customer Invoices).

Try to validate it. An error is raised.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-invoicing/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 <https://github.com/OCA/account-invoicing/issues/new?body=module:%20account_invoice_date_required%0Aversion:%2010.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* ACSONE SA/NV

Contributors
~~~~~~~~~~~~

* Denis Roussel <[email protected]>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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.

.. |maintainer-rousseldenis| image:: https://github.com/rousseldenis.png?size=40px
:target: https://github.com/rousseldenis
:alt: rousseldenis

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-rousseldenis|

This module is part of the `OCA/account-invoicing <https://github.com/OCA/account-invoicing/tree/10.0/account_invoice_date_required>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions account_invoice_date_required/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
20 changes: 20 additions & 0 deletions account_invoice_date_required/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Copyright 2018 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
'name': 'Account Invoice Date Required',
'summary': """
Requires invoice date before validation to avoid Odoo setting 'today'
as default if not filled in.""",
'version': '10.0.1.0.0',
'development_status': 'Alpha',
'maintainers': ['rousseldenis'],
'category': 'Accounting',
'license': 'AGPL-3',
'author': 'ACSONE SA/NV,Odoo Community Association (OCA)',
'website': 'https://github.com/OCA/account-invoicing',
'depends': [
'account',
],
}
1 change: 1 addition & 0 deletions account_invoice_date_required/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_invoice
28 changes: 28 additions & 0 deletions account_invoice_date_required/models/account_invoice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# Copyright 2018 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, models, _
from odoo.exceptions import ValidationError


class AccountInvoice(models.Model):

_inherit = 'account.invoice'

@api.multi
def _check_invoice_date(self):
if self.filtered(lambda i: not i.date_invoice):
raise ValidationError(
_('You have to fill in the invoice date before validating'
'the invoice !')
)

@api.multi
def action_invoice_open(self):
"""
Force user to fill in the invoice date manually before validating
the invoice
"""
self._check_invoice_date()
return super(AccountInvoice, self).action_invoice_open()
1 change: 1 addition & 0 deletions account_invoice_date_required/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Denis Roussel <[email protected]>
4 changes: 4 additions & 0 deletions account_invoice_date_required/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
In Odoo, when you validate an invoice with a void invoice date, it is
automatically filled in with current date (today).

The invoice validation is now restricted if the invoice date is not filled in.
3 changes: 3 additions & 0 deletions account_invoice_date_required/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Create an invoice with a void date (Invoicing > Sales > Customer Invoices).

Try to validate it. An error is raised.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 60635b4

Please sign in to comment.