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] l10n_it_delivery_note_batch: Migration to 18.0 #4504

Open
wants to merge 13 commits into
base: 18.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
115 changes: 115 additions & 0 deletions l10n_it_delivery_note_batch/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
===================================================
ITA - Documento di trasporto - Prelievo raggruppato
===================================================

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

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

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

**Italiano**

Questo modulo permette la creazione di DDT a partire da gruppi di
prelievi.

**English**

This module creates delivery documents from picking groups.

**Table of contents**

.. contents::
:local:

Usage
=====

**Italiano** Da fare.

**English** TBD

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-italy/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/l10n-italy/issues/new?body=module:%20l10n_it_delivery_note_batch%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
-------

* Marco Colombo

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

- Marco Colombo <[email protected]>
- Andrea Piovesana <[email protected]>
- Francesco Apruzzese <[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.

.. |maintainer-MarcoCalcagni| image:: https://github.com/MarcoCalcagni.png?size=40px
:target: https://github.com/MarcoCalcagni
:alt: MarcoCalcagni
.. |maintainer-TheMule71| image:: https://github.com/TheMule71.png?size=40px
:target: https://github.com/TheMule71
:alt: TheMule71
.. |maintainer-Borruso| image:: https://github.com/Borruso.png?size=40px
:target: https://github.com/Borruso
:alt: Borruso
.. |maintainer-aleuffre| image:: https://github.com/aleuffre.png?size=40px
:target: https://github.com/aleuffre
:alt: aleuffre
.. |maintainer-PicchiSeba| image:: https://github.com/PicchiSeba.png?size=40px
:target: https://github.com/PicchiSeba
:alt: PicchiSeba
.. |maintainer-renda-dev| image:: https://github.com/renda-dev.png?size=40px
:target: https://github.com/renda-dev
:alt: renda-dev

Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-MarcoCalcagni| |maintainer-TheMule71| |maintainer-Borruso| |maintainer-aleuffre| |maintainer-PicchiSeba| |maintainer-renda-dev|

This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/18.0/l10n_it_delivery_note_batch>`_ 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 l10n_it_delivery_note_batch/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
32 changes: 32 additions & 0 deletions l10n_it_delivery_note_batch/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2020 Marco Colombo <[email protected]>
# @author: Marco Colombo <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

# noinspection PyStatementEffect
{
"name": "ITA - Documento di trasporto - Prelievo raggruppato",
"summary": "Crea i DDT partendo da gruppi di prelievi",
"author": "Marco Colombo, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-italy",
"version": "18.0.1.0.0",
"category": "Localization/Italy",
"license": "AGPL-3",
"maintainers": [
"MarcoCalcagni",
"TheMule71",
"Borruso",
"aleuffre",
"PicchiSeba",
"renda-dev",
],
"depends": [
"stock",
"stock_picking_batch",
"l10n_it_delivery_note",
],
"data": [
"views/stock_picking_batch_views.xml",
"views/stock_picking_views.xml",
],
"auto_install": True,
}
63 changes: 63 additions & 0 deletions l10n_it_delivery_note_batch/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_it_delivery_note_batch
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-10-15 08:41+0000\n"
"PO-Revision-Date: 2024-02-27 13:35+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: \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: l10n_it_delivery_note_batch
#: model:ir.model.fields,field_description:l10n_it_delivery_note_batch.field_stock_picking_batch__all_pickings_have_delivery_note
msgid "All Pickings Have Delivery Note"
msgstr "Tutti i prelievi hanno note di consegna"

#. module: l10n_it_delivery_note_batch
#: model:ir.model.fields,field_description:l10n_it_delivery_note_batch.field_stock_delivery_note__stock_picking_batch_id
msgid "Batch Picking"
msgstr "Prelievo raggruppato"

#. module: l10n_it_delivery_note_batch
#: model:ir.model,name:l10n_it_delivery_note_batch.model_stock_picking_batch
msgid "Batch Transfer"
msgstr "Trasferimento raggruppato"

#. module: l10n_it_delivery_note_batch
#: model_terms:ir.ui.view,arch_db:l10n_it_delivery_note_batch.stock_picking_batch_form_view
msgid "Create DNs"
msgstr "Crea DdT"

#. module: l10n_it_delivery_note_batch
#: model:ir.model,name:l10n_it_delivery_note_batch.model_stock_delivery_note
msgid "Delivery Note"
msgstr "DdT"

#. module: l10n_it_delivery_note_batch
#: model:ir.model.fields,field_description:l10n_it_delivery_note_batch.field_stock_picking_batch__delivery_note_count
msgid "Delivery Note Count"
msgstr "Conto DdT"

#. module: l10n_it_delivery_note_batch
#: model:ir.model.fields,field_description:l10n_it_delivery_note_batch.field_stock_picking_batch__delivery_note_ids
#: model_terms:ir.ui.view,arch_db:l10n_it_delivery_note_batch.stock_picking_batch_form_view
msgid "Delivery Notes"
msgstr "DdT"

#~ msgid "Display Name"
#~ msgstr "Nome visualizzato"

#~ msgid "ID"
#~ msgstr "ID"

#~ msgid "Last Modified on"
#~ msgstr "Ultima modifica il"
50 changes: 50 additions & 0 deletions l10n_it_delivery_note_batch/i18n/l10n_it_delivery_note_batch.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_it_delivery_note_batch
#
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: l10n_it_delivery_note_batch
#: model:ir.model.fields,field_description:l10n_it_delivery_note_batch.field_stock_picking_batch__all_pickings_have_delivery_note
msgid "All Pickings Have Delivery Note"
msgstr ""

#. module: l10n_it_delivery_note_batch
#: model:ir.model.fields,field_description:l10n_it_delivery_note_batch.field_stock_delivery_note__stock_picking_batch_id
msgid "Batch Picking"
msgstr ""

#. module: l10n_it_delivery_note_batch
#: model:ir.model,name:l10n_it_delivery_note_batch.model_stock_picking_batch
msgid "Batch Transfer"
msgstr ""

#. module: l10n_it_delivery_note_batch
#: model_terms:ir.ui.view,arch_db:l10n_it_delivery_note_batch.stock_picking_batch_form_view
msgid "Create DNs"
msgstr ""

#. module: l10n_it_delivery_note_batch
#: model:ir.model,name:l10n_it_delivery_note_batch.model_stock_delivery_note
msgid "Delivery Note"
msgstr ""

#. module: l10n_it_delivery_note_batch
#: model:ir.model.fields,field_description:l10n_it_delivery_note_batch.field_stock_picking_batch__delivery_note_count
msgid "Delivery Note Count"
msgstr ""

#. module: l10n_it_delivery_note_batch
#: model:ir.model.fields,field_description:l10n_it_delivery_note_batch.field_stock_picking_batch__delivery_note_ids
#: model_terms:ir.ui.view,arch_db:l10n_it_delivery_note_batch.stock_picking_batch_form_view
msgid "Delivery Notes"
msgstr ""
2 changes: 2 additions & 0 deletions l10n_it_delivery_note_batch/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import stock_delivery_note
from . import stock_picking_batch
13 changes: 13 additions & 0 deletions l10n_it_delivery_note_batch/models/stock_delivery_note.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright (c) 2020 Marco Colombo
# @author: Marco Colombo <[email protected]>

from odoo import fields, models


class StockDeliveryNote(models.Model):
_inherit = "stock.delivery.note"

stock_picking_batch_id = fields.Many2one(
"stock.picking.batch",
string="Batch Picking",
)
91 changes: 91 additions & 0 deletions l10n_it_delivery_note_batch/models/stock_picking_batch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from odoo import fields, models


class StockPickingBatch(models.Model):
_inherit = "stock.picking.batch"

delivery_note_ids = fields.One2many(
"stock.delivery.note",
"stock_picking_batch_id",
string="Delivery Notes",
copy=False,
)

delivery_note_count = fields.Integer(compute="_compute_delivery_note_count")
all_pickings_have_delivery_note = fields.Boolean(
compute="_compute_all_pickings_have_delivery_note"
)

def _compute_delivery_note_count(self):
for rec in self:
rec.delivery_note_count = len(rec.delivery_note_ids)

Check warning on line 23 in l10n_it_delivery_note_batch/models/stock_picking_batch.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_delivery_note_batch/models/stock_picking_batch.py#L23

Added line #L23 was not covered by tests

def _compute_all_pickings_have_delivery_note(self):
for rec in self:
rec.all_pickings_have_delivery_note = all(

Check warning on line 27 in l10n_it_delivery_note_batch/models/stock_picking_batch.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_delivery_note_batch/models/stock_picking_batch.py#L27

Added line #L27 was not covered by tests
p.delivery_note_id for p in rec.picking_ids
)

def create_delivery_notes(self, **kwargs):
for rec in self:
if rec.state != "done":
# TODO check state - when are we allowed to
# create draft delivery notes?
pass

Check warning on line 36 in l10n_it_delivery_note_batch/models/stock_picking_batch.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_delivery_note_batch/models/stock_picking_batch.py#L36

Added line #L36 was not covered by tests

# select only pickings that don't already have a delivery note
# TODO state check on individual pickings?
pickings = rec.mapped("picking_ids").search(

Check warning on line 40 in l10n_it_delivery_note_batch/models/stock_picking_batch.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_delivery_note_batch/models/stock_picking_batch.py#L40

Added line #L40 was not covered by tests
[("delivery_note_id", "=", False), ("batch_id", "=", rec.id)]
)

# poor man's group by - group by homogeneous pickings
todo_list = {}

Check warning on line 45 in l10n_it_delivery_note_batch/models/stock_picking_batch.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_delivery_note_batch/models/stock_picking_batch.py#L45

Added line #L45 was not covered by tests
for p in pickings:
key = tuple(p.id for p in p.get_partners())
todo_list[key] = todo_list.get(key, self.env["stock.picking"]) | p
type_id = self.env["stock.delivery.note.type"].search(

Check warning on line 49 in l10n_it_delivery_note_batch/models/stock_picking_batch.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_delivery_note_batch/models/stock_picking_batch.py#L47-L49

Added lines #L47 - L49 were not covered by tests
[("code", "=", rec.picking_type_id.code)], limit=1
)

for partner_ids, pickings in todo_list.items():
dn = self.env["stock.delivery.note"].create(

Check warning on line 54 in l10n_it_delivery_note_batch/models/stock_picking_batch.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_delivery_note_batch/models/stock_picking_batch.py#L54

Added line #L54 was not covered by tests
{
"partner_sender_id": partner_ids[0],
"partner_id": partner_ids[1],
"partner_shipping_id": partner_ids[1],
"stock_picking_batch_id": rec.id,
"type_id": type_id.id,
}
)
pickings.write({"delivery_note_id": dn.id})

Check warning on line 63 in l10n_it_delivery_note_batch/models/stock_picking_batch.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_delivery_note_batch/models/stock_picking_batch.py#L63

Added line #L63 was not covered by tests

return self.goto_delivery_notes(**kwargs)

Check warning on line 65 in l10n_it_delivery_note_batch/models/stock_picking_batch.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_delivery_note_batch/models/stock_picking_batch.py#L65

Added line #L65 was not covered by tests

def goto_delivery_notes(self, **kwargs):
delivery_notes = self.mapped("delivery_note_ids")
action = self.env["ir.actions.act_window"]._for_xml_id(

Check warning on line 69 in l10n_it_delivery_note_batch/models/stock_picking_batch.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_delivery_note_batch/models/stock_picking_batch.py#L68-L69

Added lines #L68 - L69 were not covered by tests
"l10n_it_delivery_note.stock_delivery_note_action"
)
action.update(kwargs)

Check warning on line 72 in l10n_it_delivery_note_batch/models/stock_picking_batch.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_delivery_note_batch/models/stock_picking_batch.py#L72

Added line #L72 was not covered by tests

if len(delivery_notes) > 1:
action["domain"] = [("id", "in", delivery_notes.ids)]

Check warning on line 75 in l10n_it_delivery_note_batch/models/stock_picking_batch.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_delivery_note_batch/models/stock_picking_batch.py#L75

Added line #L75 was not covered by tests

elif len(delivery_notes) == 1:
action["views"] = [

Check warning on line 78 in l10n_it_delivery_note_batch/models/stock_picking_batch.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_delivery_note_batch/models/stock_picking_batch.py#L78

Added line #L78 was not covered by tests
(
self.env.ref(
"l10n_it_delivery_note.stock_delivery_note_form_view"
).id,
"form",
)
]
action["res_id"] = delivery_notes.id

Check warning on line 86 in l10n_it_delivery_note_batch/models/stock_picking_batch.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_delivery_note_batch/models/stock_picking_batch.py#L86

Added line #L86 was not covered by tests

else:
action = {"type": "ir.actions.act_window_close"}

Check warning on line 89 in l10n_it_delivery_note_batch/models/stock_picking_batch.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_delivery_note_batch/models/stock_picking_batch.py#L89

Added line #L89 was not covered by tests

return action

Check warning on line 91 in l10n_it_delivery_note_batch/models/stock_picking_batch.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_delivery_note_batch/models/stock_picking_batch.py#L91

Added line #L91 was not covered by tests
3 changes: 3 additions & 0 deletions l10n_it_delivery_note_batch/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
3 changes: 3 additions & 0 deletions l10n_it_delivery_note_batch/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Marco Colombo \<<[email protected]>\>
- Andrea Piovesana \<<[email protected]>\>
- Francesco Apruzzese \<<[email protected]>\>
8 changes: 8 additions & 0 deletions l10n_it_delivery_note_batch/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
**Italiano**

Questo modulo permette la creazione di DDT a partire da gruppi di
prelievi.

**English**

This module creates delivery documents from picking groups.
3 changes: 3 additions & 0 deletions l10n_it_delivery_note_batch/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**Italiano** Da fare.

**English** TBD
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading