Skip to content

Commit

Permalink
Merge pull request #135 from coopiteasy/12.0-mig-invoice_default_acco…
Browse files Browse the repository at this point in the history
…unt_date

[12.0][MIG] invoice_default_account_date >> account_invoice_default_account_date
  • Loading branch information
vvrossem authored Nov 19, 2020
2 parents cf713af + 6d89eff commit d6828c6
Show file tree
Hide file tree
Showing 9 changed files with 530 additions and 0 deletions.
65 changes: 65 additions & 0 deletions account_invoice_default_account_date/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
============================
Invoice Default Account Date
============================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |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-coopiteasy%2Faddons-lightgray.png?logo=github
:target: https://github.com/coopiteasy/addons/tree/12.0/account_invoice_default_account_date
:alt: coopiteasy/addons

|badge1| |badge2| |badge3|

On a Vendor Bill, sets Accounting Date (date)
to the invoice validation date instead of Bill Date (date_invoice).

**Table of contents**

.. contents::
:local:

Known issues / Roadmap
======================

This module will set `date` as `context_today()` at any `write` (even if still in `draft`).
We should set the date either when the invoice is validated or switches to 'open'.

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

Bugs are tracked on `GitHub Issues <https://github.com/coopiteasy/addons/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/coopiteasy/addons/issues/new?body=module:%20account_invoice_default_account_date%0Aversion:%2012.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
~~~~~~~

* Coop IT Easy SCRLfs

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

* Robin Keunen <[email protected]>
* Vincent Van Rossem <[email protected]>

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

This module is part of the `coopiteasy/addons <https://github.com/coopiteasy/addons/tree/12.0/account_invoice_default_account_date>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions account_invoice_default_account_date/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions account_invoice_default_account_date/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2017 - Today Coop IT Easy SCRLfs (<http://www.coopiteasy.be>)
# - Robin Keunen <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Invoice Default Account Date",
"version": "12.0.1.0.0",
"depends": ["account"],
"author": "Coop IT Easy SCRLfs",
"license": "AGPL-3",
"category": "Invoice",
"website": "https://coopiteasy.be",
"summary": """
Sets the accounting date to the invoice date by default.
""",
"data": [],
"installable": True,
}
1 change: 1 addition & 0 deletions account_invoice_default_account_date/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_invoice
18 changes: 18 additions & 0 deletions account_invoice_default_account_date/models/account_invoice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from odoo import api, fields, models


class AccountInvoice(models.Model):
_inherit = "account.invoice"

@api.multi
def write(self, vals):
# vendor bills
if (
not self.date
and "date" not in vals
and self.type in ("in_invoice", "in_refund")
):

vals["date"] = fields.Date.context_today(self)

return super(AccountInvoice, self).write(vals)
2 changes: 2 additions & 0 deletions account_invoice_default_account_date/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Robin Keunen <[email protected]>
* Vincent Van Rossem <[email protected]>
2 changes: 2 additions & 0 deletions account_invoice_default_account_date/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
On a Vendor Bill, sets Accounting Date (date)
to the invoice validation date instead of Bill Date (date_invoice).
2 changes: 2 additions & 0 deletions account_invoice_default_account_date/readme/ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module will set `date` as `context_today()` at any `write` (even if still in `draft`).
We should set the date either when the invoice is validated or switches to 'open'.
Loading

0 comments on commit d6828c6

Please sign in to comment.