Skip to content
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

[18.0][MIG] purchase_stock_picking_invoice_link #1793

Open
wants to merge 32 commits into
base: 18.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
152c2dc
[ADD] purchase_stock_picking_invoice_link: linking purchases, picking…
cubells Jan 3, 2020
5c97597
[MIG] purchase_stock_picking_invoice_link: : Migration to 12.0
diggy128 Nov 19, 2020
ace98ec
[IMP] purchase_stock_picking_invoice_link: black, isort, prettier
Aug 31, 2021
a3c3b31
[MIG] purchase_stock_picking_invoice_link: Migration to 13.0
dalonsod Mar 2, 2021
ea52427
[IMP] Update dotfiles + switch to GH actions
pedrobaeza Apr 28, 2022
c2b8a51
[MIG] purchase_stock_picking_invoice_link: Migration to 14.0
RabbitJon-S73 Jun 13, 2022
bce4e4b
[IMP] purchase_stock_picking_invoice_link: Use the same technique as …
CarlosRoca13 Aug 17, 2022
0bda40a
[FIX] purchase_stock_picking_invoice_link: Consider DS pickings
pedrobaeza Aug 22, 2022
636dfa4
[FIX] purchase_stock_picking_invoice_link: Incorrect relation when ba…
CarlosRoca13 Sep 20, 2022
977fbbd
[FIX] purchase_stock_picking_invoice_link: Allow link more than one i…
CarlosRoca13 Sep 26, 2022
2504868
[15.0][MIG] purchase_stock_picking_invoice_link: Migration to version…
stefan-tecnativa Jan 5, 2023
334dfb1
[MIG] purchase_stock_picking_invoice_link: Migration to 16.0
Jan 24, 2023
09d0917
[UPD] Update purchase_stock_picking_invoice_link.pot
Jan 30, 2023
90bfa02
[UPD] README.rst
OCA-git-bot Jan 30, 2023
19a69a1
Update translation files
weblate Jan 30, 2023
80b6186
Added translation using Weblate (Croatian)
badbole Mar 2, 2023
e517e1f
Translated using Weblate (Croatian)
badbole Mar 2, 2023
5a15d51
Translated using Weblate (Spanish)
Gelo-fl Apr 18, 2023
26b40bf
Translated using Weblate (Spanish)
pedrobaeza Jun 5, 2023
d797079
[UPD] README.rst
OCA-git-bot Sep 3, 2023
2b47ba3
Added translation using Weblate (Italian)
mymage Nov 15, 2023
bc8e055
Translated using Weblate (Italian)
mymage Nov 17, 2023
6560995
Added translation using Weblate (Portuguese (Brazil))
adrianojprado Dec 28, 2023
c1aa6a9
Translated using Weblate (Portuguese (Brazil))
adrianojprado Dec 28, 2023
d2cf019
Added translation using Weblate (French)
MorganeGoujon Mar 13, 2024
94364b3
Translated using Weblate (French)
MorganeGoujon Mar 13, 2024
6260f29
[IMP] purchase_stock_picking_invoice_link: black, isort, prettier
JasminSForgeFlow Sep 16, 2024
ccabf64
[MIG] purchase_stock_picking_invoice_link: Migration to 17.0
JasminSForgeFlow Sep 17, 2024
05139b1
[UPD] Update purchase_stock_picking_invoice_link.pot
Sep 30, 2024
148ae87
[BOT] post-merge updates
OCA-git-bot Sep 30, 2024
3ccbe20
Update translation files
weblate Sep 30, 2024
82aaf48
[MIG] purchase_stock_picking_invoice_link: Migration to 18.0
JasminSForgeFlow Dec 17, 2024
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
105 changes: 105 additions & 0 deletions purchase_stock_picking_invoice_link/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
===================================
Purchase Stock Picking Invoice Link
===================================

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

.. |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%2Fstock--logistics--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-workflow/tree/18.0/purchase_stock_picking_invoice_link
:alt: OCA/stock-logistics-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-workflow-18-0/stock-logistics-workflow-18-0-purchase_stock_picking_invoice_link
: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/stock-logistics-workflow&target_branch=18.0
:alt: Try me on Runboat

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

This module adds a link between purchases, pickings and invoices as well
as on the lines. Invoices are generated from purchase orders. With this
module, you can find back which deliveries an invoice relates to.

This module improves **stock_picking_invoice_link** module by linking
purchases, pickings and invoices.

**Table of contents**

.. contents::
:local:

Usage
=====

- Create a Purchase Order and confirm.
- Deliver its pickings totally or partially.
- Create an invoice of the goods delivered.
- If you open invoice form, you must see a smart-button labeled
*Delivery*.
- Click on this smart-button to see the linked pickings.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-workflow/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/stock-logistics-workflow/issues/new?body=module:%20purchase_stock_picking_invoice_link%0Aversion:%2018.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>`__

- Vicent Cubells
- Ernesto Tejeda
- Pedro M. Baeza
- Carlos Roca
- Stefan Ungureanu

- `Obertix <https://www.obertix.net>`__

- Vicent Cubells <[email protected]>

- `Solvos <https://www.solvos.es>`__

- David Alonso <[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.

This module is part of the `OCA/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/18.0/purchase_stock_picking_invoice_link>`_ 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 purchase_stock_picking_invoice_link/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
14 changes: 14 additions & 0 deletions purchase_stock_picking_invoice_link/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2019 Vicent Cubells <[email protected]>
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

{
"name": "Purchase Stock Picking Invoice Link",
"version": "18.0.1.0.0",
"category": "Warehouse Management",
"summary": "Adds link between purchases, pickings and invoices",
"author": "Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-workflow",
"license": "AGPL-3",
"depends": ["stock_picking_invoice_link", "purchase"],
"installable": True,
}
34 changes: 34 additions & 0 deletions purchase_stock_picking_invoice_link/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_stock_picking_invoice_link
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-02-07 11:40+0000\n"
"PO-Revision-Date: 2023-06-05 11:08+0000\n"
"Last-Translator: \"Pedro M. Baeza\" <[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: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: purchase_stock_picking_invoice_link
#: model:ir.model,name:purchase_stock_picking_invoice_link.model_purchase_order_line
msgid "Purchase Order Line"
msgstr "Línea de Pedido de Compra"

#. module: purchase_stock_picking_invoice_link
#: model:ir.model,name:purchase_stock_picking_invoice_link.model_stock_move
msgid "Stock Move"
msgstr "Movimiento de existencias"

#~ msgid "Invoice"
#~ msgstr "Factura"

#~ msgid "Invoice Line"
#~ msgstr "Línea de factura"
27 changes: 27 additions & 0 deletions purchase_stock_picking_invoice_link/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_stock_picking_invoice_link
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-03-13 13:34+0000\n"
"Last-Translator: MorganeGoujon <[email protected]>\n"
"Language-Team: none\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: purchase_stock_picking_invoice_link
#: model:ir.model,name:purchase_stock_picking_invoice_link.model_purchase_order_line
msgid "Purchase Order Line"
msgstr "Ligne de bon de commande"

#. module: purchase_stock_picking_invoice_link
#: model:ir.model,name:purchase_stock_picking_invoice_link.model_stock_move
msgid "Stock Move"
msgstr "Mouvement de stock"
28 changes: 28 additions & 0 deletions purchase_stock_picking_invoice_link/i18n/hr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_stock_picking_invoice_link
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-03-02 16:30+0000\n"
"Last-Translator: Bole <[email protected]>\n"
"Language-Team: none\n"
"Language: hr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"X-Generator: Weblate 4.14.1\n"

#. module: purchase_stock_picking_invoice_link
#: model:ir.model,name:purchase_stock_picking_invoice_link.model_purchase_order_line
msgid "Purchase Order Line"
msgstr "Stavka nabave"

#. module: purchase_stock_picking_invoice_link
#: model:ir.model,name:purchase_stock_picking_invoice_link.model_stock_move
msgid "Stock Move"
msgstr "Skladišni prenos"
27 changes: 27 additions & 0 deletions purchase_stock_picking_invoice_link/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_stock_picking_invoice_link
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-11-17 09:33+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: purchase_stock_picking_invoice_link
#: model:ir.model,name:purchase_stock_picking_invoice_link.model_purchase_order_line
msgid "Purchase Order Line"
msgstr "Riga ordine di acquisto"

#. module: purchase_stock_picking_invoice_link
#: model:ir.model,name:purchase_stock_picking_invoice_link.model_stock_move
msgid "Stock Move"
msgstr "Movimento di magazzino"
27 changes: 27 additions & 0 deletions purchase_stock_picking_invoice_link/i18n/pt_BR.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_stock_picking_invoice_link
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-12-28 22:36+0000\n"
"Last-Translator: Adriano Prado <[email protected]>\n"
"Language-Team: none\n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: purchase_stock_picking_invoice_link
#: model:ir.model,name:purchase_stock_picking_invoice_link.model_purchase_order_line
msgid "Purchase Order Line"
msgstr "Item do Pedido de Compra"

#. module: purchase_stock_picking_invoice_link
#: model:ir.model,name:purchase_stock_picking_invoice_link.model_stock_move
msgid "Stock Move"
msgstr "Movimento Estoque"
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:
# * purchase_stock_picking_invoice_link
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.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: purchase_stock_picking_invoice_link
#: model:ir.model,name:purchase_stock_picking_invoice_link.model_purchase_order_line
msgid "Purchase Order Line"
msgstr ""

#. module: purchase_stock_picking_invoice_link
#: model:ir.model,name:purchase_stock_picking_invoice_link.model_stock_move
msgid "Stock Move"
msgstr ""
2 changes: 2 additions & 0 deletions purchase_stock_picking_invoice_link/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import purchase_order
from . import stock_move
65 changes: 65 additions & 0 deletions purchase_stock_picking_invoice_link/models/purchase_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Copyright 2022 Tecnativa - Carlos Roca
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from odoo import models
from odoo.tools import float_compare, float_is_zero


class PurchaseOrderLine(models.Model):
_inherit = "purchase.order.line"

def get_stock_moves_link_invoice(self):
moves_linked = self.env["stock.move"]
if self.product_id.purchase_method == "purchase":
to_invoice = self.product_qty - self.qty_invoiced
else:
to_invoice = self.qty_received - self.qty_invoiced
for stock_move in self.move_ids.sorted(
lambda m: (m.write_date, m.id), reverse=True
):
if (
stock_move.state != "done"
or stock_move.scrapped
or (
stock_move.location_id.usage != "supplier"
and (
stock_move.location_dest_id.usage != "supplier"
or not stock_move.to_refund
)
)
):
continue
if not stock_move.invoice_line_ids:
to_invoice -= (
stock_move.quantity
if not stock_move.to_refund
else -stock_move.quantity
)
moves_linked += stock_move
continue
elif float_is_zero(
to_invoice, precision_rounding=self.product_uom.rounding
):
break
to_invoice -= (
stock_move.quantity
if not stock_move.to_refund
else -stock_move.quantity
)
moves_linked += stock_move
return moves_linked

def _prepare_account_move_line(self, move=False):
vals = super()._prepare_account_move_line(move=move)
stock_moves = self.get_stock_moves_link_invoice()
# Invoice returned moves marked as to_refund
if (
float_compare(
self.product_qty - self.qty_invoiced,
0.0,
precision_rounding=self.currency_id.rounding,
)
< 0
):
stock_moves = stock_moves.filtered("to_refund")
vals["move_line_ids"] = [(4, m.id) for m in stock_moves]
return vals
Loading
Loading