Skip to content

Commit

Permalink
[ADD] [15.0]account_invoice_date
Browse files Browse the repository at this point in the history
  • Loading branch information
ikapasi-initos committed Jun 3, 2022
1 parent 31db5af commit d2ace09
Show file tree
Hide file tree
Showing 16 changed files with 291 additions and 0 deletions.
6 changes: 6 additions & 0 deletions account_invoice_date/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
====================
Account Invoice Date
====================

When an invoice is validated from Draft to Open automatically, the invoice date
is set to current date.If an invoice is validated from Draft to Open manually, a window is displayed to query the invoice date from the user.
5 changes: 5 additions & 0 deletions account_invoice_date/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016 Thomas Rehn (initOS GmbH)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models, wizard
23 changes: 23 additions & 0 deletions account_invoice_date/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# © 2022 Thomas Rehn (initOS GmbH)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Account Invoice Date",
"description": """
When an invoice is validated from Draft to Open automatically, the invoice date is set to current date.
If an invoice is validated from Draft to Open manually, a window is displayed to query the invoice date from the user.
""",
"category": "Accounting",
"version": "15.0.1.0.0",
"license": "LGPL-3",
"depends": [
"account",
],
"data": [
"security/ir.model.access.csv",
"wizard/account_voucher_proforma_date_view.xml",
"views/account_move_view.xml",
],
"author": "initOS",
"website": "https://github.com/OCA/account-invoicing",
}
106 changes: 106 additions & 0 deletions account_invoice_date/i18n/de.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_invoice_date
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-05-04 11:47+0000\n"
"PO-Revision-Date: 2020-05-04 11:47+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: account_invoice_date
#: model:ir.model,name:account_invoice_date.model_account_voucher_proforma_date
msgid "Account Voucher Proforma Date"
msgstr ""

#. module: account_invoice_date
#: model_terms:ir.ui.view,arch_db:account_invoice_date.view_account_credit_voucher_proforma_date
#: model_terms:ir.ui.view,arch_db:account_invoice_date.view_account_voucher_proforma_date
msgid "Cancel"
msgstr "Abbrechen"

#. module: account_invoice_date
#: model:ir.model.fields,field_description:account_invoice_date.field_account_voucher_proforma_date__create_uid
msgid "Created by"
msgstr "erstellt von"

#. module: account_invoice_date
#: model:ir.model.fields,field_description:account_invoice_date.field_account_voucher_proforma_date__create_date
msgid "Created on"
msgstr "erstellt am"

#. module: account_invoice_date
#: model:ir.model.fields,field_description:account_invoice_date.field_account_voucher_proforma_date__display_name
msgid "Display Name"
msgstr "Anzeigename"

#. module: account_invoice_date
#: model:ir.model.fields,field_description:account_invoice_date.field_account_voucher_proforma_date__id
msgid "ID"
msgstr ""

#. module: account_invoice_date
#: model:ir.model,name:account_invoice_date.model_account_invoice
msgid "Invoice"
msgstr "Rechnung"

#. module: account_invoice_date
#: model:ir.model.fields,field_description:account_invoice_date.field_account_voucher_proforma_date____last_update
msgid "Last Modified on"
msgstr "Zuletzt geändert am"

#. module: account_invoice_date
#: model:ir.model.fields,field_description:account_invoice_date.field_account_voucher_proforma_date__write_uid
msgid "Last Updated by"
msgstr "zuletzt aktualisiert von"

#. module: account_invoice_date
#: model:ir.model.fields,field_description:account_invoice_date.field_account_voucher_proforma_date__write_date
msgid "Last Updated on"
msgstr "zuletzt aktualisiert am"

#. module: account_invoice_date
#: model:ir.actions.act_window,name:account_invoice_date.action_credit_invoice_customer
#: model_terms:ir.ui.view,arch_db:account_invoice_date.view_account_credit_voucher_proforma_date
msgid "Open credit note"
msgstr "Gutschrift eröffnen"

#. module: account_invoice_date
#: model:ir.actions.act_window,name:account_invoice_date.action_invoice_customer
#: model_terms:ir.ui.view,arch_db:account_invoice_date.view_account_voucher_proforma_date
msgid "Open invoice"
msgstr "Rechnung eröffnen"

#. module: account_invoice_date
#: model_terms:ir.ui.view,arch_db:account_invoice_date.view_account_credit_voucher_proforma_date
msgid "Please enter credit note date (should correspond to payment date)"
msgstr "Bitte Gutschriftsdatum eingeben (sollte Zahlungsdatum entsprechen)"

#. module: account_invoice_date
#: model_terms:ir.ui.view,arch_db:account_invoice_date.view_account_voucher_proforma_date
msgid "Please enter invoice date (should correspond to payment date)"
msgstr "Bitte Rechnungsdatum eingeben (sollte Zahlungsdatum entsprechen)"

#. module: account_invoice_date
#: model:ir.model.fields,field_description:account_invoice_date.field_account_voucher_proforma_date__date
msgid "Rechnungsdatum"
msgstr ""

#. module: account_invoice_date
#: model_terms:ir.ui.view,arch_db:account_invoice_date.view_invoice_customer
msgid "Validate"
msgstr "Bestätigen"

#. module: account_invoice_date
#: model_terms:ir.ui.view,arch_db:account_invoice_date.view_account_credit_voucher_proforma_date
#: model_terms:ir.ui.view,arch_db:account_invoice_date.view_account_voucher_proforma_date
msgid "or"
msgstr "oder"

5 changes: 5 additions & 0 deletions account_invoice_date/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# © 2022 Thomas Rehn (initOS GmbH)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import account_move
16 changes: 16 additions & 0 deletions account_invoice_date/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
from datetime import date

from odoo import api, models


class AccountMove(models.Model):
_inherit = "account.move"

def action_post(self):
invoice = super(AccountMove, self).action_post()
inv_date = date.today()
if self.env.context.get("invoice_date"):
inv_date = self.env.context.get("invoice_date")
self.write({"invoice_date": inv_date})
return invoice
1 change: 1 addition & 0 deletions account_invoice_date/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* isufi kapasi <[email protected]>
1 change: 1 addition & 0 deletions account_invoice_date/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
When an invoice is validated from Draft to Open automatically, the invoice date is set to current date.If an invoice is validated from Draft to Open manually, a window is displayed to query the invoice date from the user.
3 changes: 3 additions & 0 deletions account_invoice_date/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#. Go to Invoice > Click Create > Create new invoice.
#. Click on "Confirm" button.
#. Select the date and Click on "Open invoice" button.
5 changes: 5 additions & 0 deletions account_invoice_date/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
account_invoice_date.access_account_voucher_proforma_date,access_account_voucher_proforma_date,account_invoice_date.model_account_voucher_proforma_date,base.group_user,1,1,1,1



30 changes: 30 additions & 0 deletions account_invoice_date/views/account_move_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="view_move_form" model="ir.ui.view">
<field name="name">account.move.form</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='action_post'][1]" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//button[@name='action_post'][2]" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<button name="action_post" position="after">
<button name="%(account_invoice_date.action_invoice_customer)d"
type="action"
string="Confirm"
class="oe_highlight"
attrs="{'invisible': ['|',('move_type', '!=','out_invoice'),('state','!=','draft')]}"
groups="account.group_account_invoice"/>
<button name="%(account_invoice_date.action_credit_invoice_customer)d"
type="action"
string="Confirm"
class="oe_highlight"
attrs="{'invisible': ['|',('move_type', '!=','out_refund'),('state','!=','draft')]}"
groups="account.group_account_invoice"/>
</button>
</field>
</record>
</odoo>
5 changes: 5 additions & 0 deletions account_invoice_date/wizard/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# © 2022 Thomas Rehn (initOS GmbH)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import account_voucher_proforma_date
26 changes: 26 additions & 0 deletions account_invoice_date/wizard/account_voucher_proforma_date.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# © 2022 Thomas Rehn (initOS GmbH)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

import logging

from odoo import api, fields, models

_logger = logging.getLogger(__name__)


class AccountVoucherProformaDate(models.TransientModel):
_name = "account.voucher.proforma.date"
_description = "Account Voucher Proforma Date"

date = fields.Date(
string="Rechnungsdatum", required=True, default=fields.Date.context_today
)

def action_post(self):
invoice_id = False
if self.env.context.get("active_model") == "account.move":
invoice_id = self.env.context.get("active_id")
assert invoice_id, "Could not determine invoice to open"
invoice = self.env["account.move"].browse(invoice_id)
invoice.with_context(invoice_date=self.date).action_post()
52 changes: 52 additions & 0 deletions account_invoice_date/wizard/account_voucher_proforma_date_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="view_account_voucher_proforma_date" model="ir.ui.view">
<field name="name">view.account.voucher.proforma.date</field>
<field name="model">account.voucher.proforma.date</field>
<field name="arch" type="xml">
<form>
<group>
<field name="date" string="Please enter invoice date (should correspond to payment date)"/>
</group>
<footer>
<button string='Open invoice' name="action_post" default_focus="1" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
</form>
</field>
</record>

<record id="action_invoice_customer" model="ir.actions.act_window">
<field name="name">Open invoice</field>
<field name="res_model">account.voucher.proforma.date</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_account_voucher_proforma_date"/>
<field name="target">new</field>
</record>

<record id="view_account_credit_voucher_proforma_date" model="ir.ui.view">
<field name="name">view.account.credit.voucher.proforma.date</field>
<field name="model">account.voucher.proforma.date</field>
<field name="arch" type="xml">
<form>
<group>
<field name="date" string="Please enter credit note date (should correspond to payment date)"/>
</group>
<footer>
<button string='Open credit note' name="action_post" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
</form>
</field>
</record>

<record id="action_credit_invoice_customer" model="ir.actions.act_window">
<field name="name">Open credit note</field>
<field name="res_model">account.voucher.proforma.date</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_account_credit_voucher_proforma_date"/>
<field name="target">new</field>
</record>
</odoo>
6 changes: 6 additions & 0 deletions setup/account_invoice_date/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit d2ace09

Please sign in to comment.