forked from OCA/account-financial-reporting
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1003 from OCA/16.0
Syncing from upstream OCA/account-financial-reporting (16.0)
- Loading branch information
Showing
21 changed files
with
1,147 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
======================================== | ||
Account Purchase Stock Report Non Billed | ||
======================================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:69cf0bac2cf28bf0ef4563949a0ba70e6e8fde03ce12e5abd030f1d749476703 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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--financial--reporting-lightgray.png?logo=github | ||
:target: https://github.com/OCA/account-financial-reporting/tree/16.0/account_purchase_stock_report_non_billed | ||
:alt: OCA/account-financial-reporting | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/account-financial-reporting-16-0/account-financial-reporting-16-0-account_purchase_stock_report_non_billed | ||
: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-financial-reporting&target_branch=16.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
Module that extends account_sale_stock_report_non_billed to add the non billed stock | ||
moves comming from purchase orders. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Usage | ||
===== | ||
|
||
To use this module, you need to: | ||
|
||
#. Go to `Invicing > Reporting > Non Billed Stock Moves`. | ||
#. Select a concrete date. | ||
#. The stock moves created before this date with quantity to be invoiced, are being | ||
showed at the tree view. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-reporting/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-financial-reporting/issues/new?body=module:%20account_purchase_stock_report_non_billed%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 | ||
~~~~~~~ | ||
|
||
* Tecnativa | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* `Tecnativa <https://www.tecnativa.com>`_: | ||
|
||
* Carlos Roca | ||
* Pedro M. Baeza | ||
* Stefan Ungureanu | ||
|
||
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-CarlosRoca13| image:: https://github.com/CarlosRoca13.png?size=40px | ||
:target: https://github.com/CarlosRoca13 | ||
:alt: CarlosRoca13 | ||
|
||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-CarlosRoca13| | ||
|
||
This module is part of the `OCA/account-financial-reporting <https://github.com/OCA/account-financial-reporting/tree/16.0/account_purchase_stock_report_non_billed>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import models | ||
from . import wizard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Copyright 2022 Tecnativa - Carlos Roca | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
{ | ||
"name": "Account Purchase Stock Report Non Billed", | ||
"version": "16.0.1.0.0", | ||
"license": "AGPL-3", | ||
"author": "Tecnativa, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/account-financial-reporting", | ||
"depends": [ | ||
"account_sale_stock_report_non_billed", | ||
"purchase_stock_picking_invoice_link", | ||
"purchase_stock", | ||
], | ||
"data": [], | ||
"installable": True, | ||
"maintainers": ["CarlosRoca13"], | ||
"development_status": "Beta", | ||
} |
24 changes: 24 additions & 0 deletions
24
account_purchase_stock_report_non_billed/i18n/account_purchase_stock_report_non_billed.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_purchase_stock_report_non_billed | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \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_purchase_stock_report_non_billed | ||
#: model:ir.model,name:account_purchase_stock_report_non_billed.model_stock_move | ||
msgid "Stock Move" | ||
msgstr "" | ||
|
||
#. module: account_purchase_stock_report_non_billed | ||
#: model:ir.model,name:account_purchase_stock_report_non_billed.model_account_sale_stock_report_non_billed_wiz | ||
msgid "Wizard to open stock moves that have not been invoiced at that time" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_purchase_stock_report_non_billed | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 13.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2022-08-30 06:00+0000\n" | ||
"PO-Revision-Date: 2023-06-28 18:08+0000\n" | ||
"Last-Translator: Ivorra78 <[email protected]>\n" | ||
"Language-Team: \n" | ||
"Language: es\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=n != 1;\n" | ||
"X-Generator: Weblate 4.17\n" | ||
|
||
#. module: account_purchase_stock_report_non_billed | ||
#: model:ir.model,name:account_purchase_stock_report_non_billed.model_stock_move | ||
msgid "Stock Move" | ||
msgstr "Movimiento de stock" | ||
|
||
#. module: account_purchase_stock_report_non_billed | ||
#: model:ir.model,name:account_purchase_stock_report_non_billed.model_account_sale_stock_report_non_billed_wiz | ||
msgid "Wizard to open stock moves that have not been invoiced at that time" | ||
msgstr "" | ||
"Asistente para abrir movimientos de stock que no han sido facturados a una " | ||
"fecha dada" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import stock_move |
86 changes: 86 additions & 0 deletions
86
account_purchase_stock_report_non_billed/models/stock_move.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# Copyright 2022 Tecnativa - Carlos Roca | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). | ||
|
||
from odoo import api, models | ||
|
||
|
||
class StockMove(models.Model): | ||
_inherit = "stock.move" | ||
|
||
@api.depends("purchase_line_id") | ||
def _compute_currency_id(self): | ||
non_purchase_move = self.env["stock.move"] | ||
for move in self: | ||
if move.purchase_line_id: | ||
move.currency_id = move.purchase_line_id.currency_id | ||
else: | ||
non_purchase_move |= move | ||
if non_purchase_move: | ||
return super(StockMove, non_purchase_move)._compute_currency_id() | ||
|
||
def get_quantity_invoiced(self, invoice_lines): | ||
if self.purchase_line_id: | ||
if not invoice_lines: | ||
return 0 | ||
qty_invoiced = abs( | ||
sum( | ||
invoice_lines.mapped( | ||
lambda l: l.quantity | ||
if (l.move_id.move_type == "in_invoice" and not self.to_refund) | ||
or (l.move_id.move_type == "in_refund" and self.to_refund) | ||
else -l.quantity | ||
) | ||
) | ||
) | ||
# Check when grouping different moves in an invoice line | ||
moves = invoice_lines.mapped("move_line_ids") | ||
date_start = self.env.context.get("moves_date_start") | ||
date_end = self.env.context.get("moves_date_end") | ||
if date_start and date_end: | ||
moves = moves.filtered( | ||
lambda ml: ml.date_done >= date_start and ml.date_done <= date_end | ||
) | ||
total_qty = moves.get_total_devolution_moves() | ||
if qty_invoiced != total_qty: | ||
invoiced = 0.0 | ||
for move in moves: | ||
qty = ( | ||
move.quantity_done | ||
if move.quantity_done <= (qty_invoiced - invoiced) | ||
else qty_invoiced - invoiced | ||
) | ||
if move.check_is_return(): | ||
qty = -qty | ||
if move == self: | ||
return qty | ||
invoiced += qty | ||
return 0 | ||
return ( | ||
self.quantity_done | ||
if not self.check_is_return() | ||
else -self.quantity_done | ||
) | ||
return super().get_quantity_invoiced(invoice_lines) | ||
|
||
def _set_not_invoiced_values(self, qty_to_invoice, invoiced_qty): | ||
self.ensure_one() | ||
if self.purchase_line_id: | ||
self.quantity_not_invoiced = qty_to_invoice - invoiced_qty | ||
price_unit = self.purchase_line_id.price_unit | ||
if "discount" in self.purchase_line_id._fields: | ||
price_unit = self.purchase_line_id.price_unit * ( | ||
1 - self.purchase_line_id.discount / 100 | ||
) | ||
self.price_not_invoiced = (qty_to_invoice - invoiced_qty) * price_unit | ||
else: | ||
return super()._set_not_invoiced_values(qty_to_invoice, invoiced_qty) | ||
|
||
@api.depends("purchase_line_id") | ||
@api.depends_context("date_check_invoiced_moves") | ||
def _compute_not_invoiced_values(self): | ||
return super()._compute_not_invoiced_values() | ||
|
||
def _get_model_id_origin_document(self): | ||
if not self.purchase_line_id: | ||
return super()._get_model_id_origin_document() | ||
return self.purchase_line_id.order_id._name, self.purchase_line_id.order_id.id |
5 changes: 5 additions & 0 deletions
5
account_purchase_stock_report_non_billed/readme/CONTRIBUTORS.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
* `Tecnativa <https://www.tecnativa.com>`_: | ||
|
||
* Carlos Roca | ||
* Pedro M. Baeza | ||
* Stefan Ungureanu |
2 changes: 2 additions & 0 deletions
2
account_purchase_stock_report_non_billed/readme/DESCRIPTION.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Module that extends account_sale_stock_report_non_billed to add the non billed stock | ||
moves comming from purchase orders. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
To use this module, you need to: | ||
|
||
#. Go to `Invicing > Reporting > Non Billed Stock Moves`. | ||
#. Select a concrete date. | ||
#. The stock moves created before this date with quantity to be invoiced, are being | ||
showed at the tree view. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.