Skip to content

[16.0][ADD] sale_invoice_date_from_picking_actual_date #1946

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

Open
wants to merge 2 commits into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
87 changes: 87 additions & 0 deletions sale_invoice_date_from_picking_actual_date/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
==========================================
Sale Invoice Date From Picking Actual Date
==========================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:301cfdc0e50c47a339e70ae88715e14470a67f7226bd4fd094739f8d15a1de93
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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-OCA%2Faccount--invoicing-lightgray.png?logo=github
:target: https://github.com/OCA/account-invoicing/tree/16.0/sale_invoice_date_from_picking_actual_date
: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-16-0/account-invoicing-16-0-sale_invoice_date_from_picking_actual_date
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-invoicing&target_branch=16.0
:alt: Try me on Runboat

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

This module sets the invoice date based on the actual or effective date
of the picking.

**Table of contents**

.. contents::
:local:

Configuration
=============

1. Navigate to *Sales > Configuration > Settings*.
2. Find and enable the 'Use Actual Date For Invoice' option to activate
this feature.

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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-invoicing/issues/new?body=module:%20sale_invoice_date_from_picking_actual_date%0Aversion:%2016.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
-------

* Quartile

Contributors
------------

- `Quartile <https://www.quartile.co>`__:

- Aung Ko Ko Lin
- Yoshi Tashiro

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.

This module is part of the `OCA/account-invoicing <https://github.com/OCA/account-invoicing/tree/16.0/sale_invoice_date_from_picking_actual_date>`_ 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 sale_invoice_date_from_picking_actual_date/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
13 changes: 13 additions & 0 deletions sale_invoice_date_from_picking_actual_date/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2025 Quartile (https://www.quartile.co)
# Licence AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0).
{
"name": "Sale Invoice Date From Picking Actual Date",
"version": "16.0.1.0.0",
"category": "Invoicing",
"license": "AGPL-3",
"author": "Quartile,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-invoicing",
"depends": ["sale_stock", "stock_move_actual_date"],
"data": ["views/res_config_settings_views.xml"],
"installable": True,
}
3 changes: 3 additions & 0 deletions sale_invoice_date_from_picking_actual_date/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import res_company
from . import res_config_settings
from . import sale_order
10 changes: 10 additions & 0 deletions sale_invoice_date_from_picking_actual_date/models/res_company.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2025 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class ResCompany(models.Model):
_inherit = "res.company"

use_picking_actual_date_for_invoice = fields.Boolean()
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2025 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

use_picking_actual_date_for_invoice = fields.Boolean(
related="company_id.use_picking_actual_date_for_invoice",
readonly=False,
)
29 changes: 29 additions & 0 deletions sale_invoice_date_from_picking_actual_date/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2025 Quartile (https://www.quartile.co)
# Licence AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0).

from odoo import fields, models


class SaleOrder(models.Model):
_inherit = "sale.order"

def _get_picking_for_actual_date(self):
self.ensure_one()
return self.picking_ids.filtered(lambda p: p.state == "done").sorted(
key=lambda p: p.date_done, reverse=True
)[:1]

def _prepare_invoice(self):
invoice_vals = super()._prepare_invoice()
if not self.company_id.use_picking_actual_date_for_invoice:
return invoice_vals
picking = self._get_picking_for_actual_date()
if picking:
if picking.actual_date:
invoice_vals["invoice_date"] = picking.actual_date
else:
invoice_vals["invoice_date"] = fields.Datetime.context_timestamp(
self.with_context(tz=self.company_id.partner_id.tz),
picking.date_done,
)
return invoice_vals
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1. Navigate to *Sales > Configuration > Settings*.
2. Find and enable the 'Use Actual Date For Invoice' option to activate this feature.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- [Quartile](https://www.quartile.co):
- Aung Ko Ko Lin
- Yoshi Tashiro
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module sets the invoice date based on the actual or effective date of the picking.
Loading
Loading