Skip to content

Commit 46172b8

Browse files
committed
[MIG] l10n_it_delivery_note: Migration to 19.0
1 parent bdbcc06 commit 46172b8

30 files changed

Lines changed: 351 additions & 276 deletions

l10n_it_delivery_note/README.rst

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ ITA - Documento di trasporto
2121
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
2222
:alt: License: AGPL-3
2323
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github
24-
:target: https://github.com/OCA/l10n-italy/tree/18.0/l10n_it_delivery_note
24+
:target: https://github.com/OCA/l10n-italy/tree/19.0/l10n_it_delivery_note
2525
:alt: OCA/l10n-italy
2626
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
27-
:target: https://translation.odoo-community.org/projects/l10n-italy-18-0/l10n-italy-18-0-l10n_it_delivery_note
27+
:target: https://translation.odoo-community.org/projects/l10n-italy-19-0/l10n-italy-19-0-l10n_it_delivery_note
2828
:alt: Translate me on Weblate
2929
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
30-
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-italy&target_branch=18.0
30+
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-italy&target_branch=19.0
3131
:alt: Try me on Runboat
3232

3333
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -48,8 +48,8 @@ installed together.
4848

4949
There are two available settings:
5050

51-
- Base (default): one picking, one DN.
52-
- Advanced: more picking in one DN.
51+
- Base (default): one picking, one DN.
52+
- Advanced: more picking in one DN.
5353

5454
**Italiano**
5555

@@ -66,8 +66,8 @@ Non è possibile avere installati contemporaneamente ``l10n_it_ddt`` e
6666

6767
Ci sono due impostazioni possibili.
6868

69-
- Base (predefinita): un prelievo, un DDT.
70-
- Avanzata: più prelievi in un DDT.
69+
- Base (predefinita): un prelievo, un DDT.
70+
- Avanzata: più prelievi in un DDT.
7171

7272
**Table of contents**
7373

@@ -100,11 +100,14 @@ To configure this module, go to:
100100
In delivery note type you can specify if the product price have to be
101101
printed in the delivery note report/slip.
102102

103-
- *Inventory → Configuration → Delivery Notes → Conditions of
104-
Transport*
105-
- *Inventory → Configuration → Delivery Notes → Appearances of Goods*
106-
- *Inventory → Configuration → Delivery Notes → Reasons of Transport*
107-
- *Inventory → Configuration → Delivery Notes → Methods of Transport*
103+
- *Inventory → Configuration → Delivery Notes → Conditions of
104+
Transport*
105+
- *Inventory → Configuration → Delivery Notes → Appearances of
106+
Goods*
107+
- *Inventory → Configuration → Delivery Notes → Reasons of
108+
Transport*
109+
- *Inventory → Configuration → Delivery Notes → Methods of
110+
Transport*
108111

109112
3. *Settings → User & Companies → Users*
110113

@@ -142,10 +145,10 @@ Funzionalità avanzata
142145

143146
Vengono attivate varie funzionalità aggiuntive:
144147

145-
- più prelievi per un DDT
146-
- selezione multipla di prelievi e generazione dei DDT
147-
- aggiunta righe nota e righe sezione descrittive.
148-
- lista dei DDT.
148+
- più prelievi per un DDT
149+
- selezione multipla di prelievi e generazione dei DDT
150+
- aggiunta righe nota e righe sezione descrittive.
151+
- lista dei DDT.
149152

150153
Il report DDT stampa in righe aggiuntive i lotti/seriali e le scadenze
151154
del prodotto.
@@ -170,7 +173,7 @@ Bug Tracker
170173
Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-italy/issues>`_.
171174
In case of trouble, please check there if your issue has already been reported.
172175
If you spotted it first, help us to smash it by providing a detailed and welcomed
173-
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_delivery_note%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
176+
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_delivery_note%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
174177

175178
Do not contact contributors directly about support or help with technical issues.
176179

@@ -187,39 +190,39 @@ Authors
187190
Contributors
188191
------------
189192

190-
- Riccardo Bellanova <r.bellanova@apuliasoftware.it>
193+
- Riccardo Bellanova <r.bellanova@apuliasoftware.it>
191194

192-
- Matteo Bilotta <mbilotta@linkeurope.it>
195+
- Matteo Bilotta <mbilotta@linkeurope.it>
193196

194-
- Giuseppe Borruso <gborruso@dinamicheaziendali.it>
197+
- Giuseppe Borruso <gborruso@dinamicheaziendali.it>
195198

196-
- Marco Calcagni <mcalcagni@dinamicheaziendali.it>
199+
- Marco Calcagni <mcalcagni@dinamicheaziendali.it>
197200

198-
- Marco Colombo <marco.colombo@gmail.com>
201+
- Marco Colombo <marco.colombo@gmail.com>
199202

200-
- Gianmarco Conte <gconte@dinamicheaziendali.it>
203+
- Gianmarco Conte <gconte@dinamicheaziendali.it>
201204

202-
- Letizia Freda <letizia.freda@netfarm.it>
205+
- Letizia Freda <letizia.freda@netfarm.it>
203206

204-
- Andrea Piovesana <andrea.m.piovesana@gmail.com>
207+
- Andrea Piovesana <andrea.m.piovesana@gmail.com>
205208

206-
- Alex Comba <alex.comba@agilebg.com>
209+
- Alex Comba <alex.comba@agilebg.com>
207210

208-
- `Ooops <https://www.ooops404.com>`__:
211+
- `Ooops <https://www.ooops404.com>`__:
209212

210-
- Giovanni Serra <giovanni@gslab.it>
211-
- Foresti Francesco <francesco.foresti@ooops404.com>
213+
- Giovanni Serra <giovanni@gslab.it>
214+
- Foresti Francesco <francesco.foresti@ooops404.com>
212215

213-
- Nextev Srl <odoo@nextev.it>
216+
- Nextev Srl <odoo@nextev.it>
214217

215-
- `PyTech-SRL <https://www.pytech.it>`__:
218+
- `PyTech-SRL <https://www.pytech.it>`__:
216219

217-
- Alessandro Uffreduzzi <alessandro.uffreduzzi@pytech.it>
218-
- Sebastiano Picchi <sebastiano.picchi@pytech.it>
220+
- Alessandro Uffreduzzi <alessandro.uffreduzzi@pytech.it>
221+
- Sebastiano Picchi <sebastiano.picchi@pytech.it>
219222

220-
- `Aion Tech <https://aiontech.company/>`__:
223+
- `Aion Tech <https://aiontech.company/>`__:
221224

222-
- Simone Rubino <simone.rubino@aion-tech.it>
225+
- Simone Rubino <simone.rubino@aion-tech.it>
223226

224227
Maintainers
225228
-----------
@@ -248,6 +251,6 @@ Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:
248251

249252
|maintainer-MarcoCalcagni| |maintainer-aleuffre| |maintainer-renda-dev|
250253

251-
This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/18.0/l10n_it_delivery_note>`_ project on GitHub.
254+
This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/19.0/l10n_it_delivery_note>`_ project on GitHub.
252255

253256
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

l10n_it_delivery_note/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"author": "Marco Calcagni, Gianmarco Conte, Link IT Europe Srl, "
1414
"Odoo Community Association (OCA)",
1515
"website": "https://github.com/OCA/l10n-italy",
16-
"version": "18.0.1.0.4",
16+
"version": "19.0.1.0.0",
1717
"category": "Localization/Italy",
1818
"license": "AGPL-3",
1919
"maintainers": ["MarcoCalcagni", "aleuffre", "renda-dev"],

l10n_it_delivery_note/controllers/portal.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
from odoo.exceptions import AccessError, MissingError
2+
from odoo.fields import Domain
23
from odoo.http import request, route
3-
from odoo.osv.expression import OR
44

55
from odoo.addons.portal.controllers.portal import CustomerPortal
66
from odoo.addons.portal.controllers.portal import pager as portal_pager
77

88

99
class DNCustomerPortal(CustomerPortal):
1010
def _get_delivery_note_domain(self):
11-
domain = [("state", "in", ["confirm", "invoiced", "done"])]
12-
return domain
11+
return Domain("state", "in", ["confirm", "invoiced", "done"])
1312

1413
def _prepare_home_portal_values(self, counters):
1514
values = super()._prepare_home_portal_values(counters)
16-
dn_count = (
17-
request.env["stock.delivery.note"].search_count(
18-
self._get_delivery_note_domain()
15+
if "dn_count" in counters:
16+
dn_count = (
17+
request.env["stock.delivery.note"].search_count(
18+
self._get_delivery_note_domain()
19+
)
20+
if request.env["stock.delivery.note"].has_access("read")
21+
else 0
1922
)
20-
if request.env["stock.delivery.note"].has_access("read")
21-
else 0
22-
)
23-
values["dn_count"] = dn_count
23+
values["dn_count"] = dn_count
2424
return values
2525

2626
def _get_delivery_notes_searchbar_sortings(self):
@@ -61,13 +61,13 @@ def _prepare_my_delivery_notes_values(
6161
domain = self._get_delivery_note_domain()
6262

6363
if date_begin and date_end:
64-
domain += [("date", ">", date_begin), ("date", "<=", date_end)]
64+
domain &= Domain([("date", ">", date_begin), ("date", "<=", date_end)])
6565

6666
if search and search_in:
6767
search_domain = []
6868
if search_in == "name":
69-
search_domain = OR([search_domain, [("name", "ilike", search)]])
70-
domain += search_domain
69+
search_domain = Domain.OR([search_domain, [("name", "ilike", search)]])
70+
domain &= Domain(search_domain)
7171

7272
pager_values = portal_pager(
7373
url=url,

l10n_it_delivery_note/mixins/delivery_mixin.py

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,10 @@ def _default_volume_uom(model):
99
return model.env.ref("uom.product_uom_litre", raise_if_not_found=False)
1010

1111

12-
def _domain_volume_uom(model):
13-
uom_category_id = model.env.ref(
14-
"uom.product_uom_categ_vol", raise_if_not_found=False
15-
)
16-
17-
return [("category_id", "=", uom_category_id.id)]
18-
19-
2012
def _default_weight_uom(model):
2113
return model.env.ref("uom.product_uom_kgm", raise_if_not_found=False)
2214

2315

24-
def _domain_weight_uom(model):
25-
uom_category_id = model.env.ref(
26-
"uom.product_uom_categ_kgm", raise_if_not_found=False
27-
)
28-
29-
return [("category_id", "=", uom_category_id.id)]
30-
31-
3216
class DeliveryData(models.AbstractModel):
3317
_name = "l10n_it_delivery_note.delivery_mixin"
3418
_description = "Common data for records to be delivered"
@@ -56,26 +40,23 @@ class DeliveryData(models.AbstractModel):
5640
delivery_volume_uom_id = fields.Many2one(
5741
"uom.uom",
5842
string="Volume of Delivery UoM",
59-
default=_default_volume_uom,
60-
domain=_domain_volume_uom,
43+
default=lambda self: self._default_volume_uom(),
6144
)
6245
delivery_volume = fields.Float(
6346
string="Volume of Delivery",
6447
)
6548
delivery_gross_weight_uom_id = fields.Many2one(
6649
"uom.uom",
6750
string="Gross Weight of Delivery UoM",
68-
default=_default_weight_uom,
69-
domain=_domain_weight_uom,
51+
default=lambda self: self._default_weight_uom(),
7052
)
7153
delivery_gross_weight = fields.Float(
7254
string="Gross Weight of Delivery",
7355
)
7456
delivery_net_weight_uom_id = fields.Many2one(
7557
"uom.uom",
7658
string="Net Weight of Delivery UoM",
77-
default=_default_weight_uom,
78-
domain=_domain_weight_uom,
59+
default=lambda self: self._default_weight_uom(),
7960
)
8061
delivery_net_weight = fields.Float(
8162
string="Net Weight of Delivery",

l10n_it_delivery_note/models/account_invoice.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
88

99
from odoo import fields, models
10+
from odoo.fields import Domain
1011

1112
from .stock_delivery_note import DATE_FORMAT, DOMAIN_INVOICE_STATUSES
1213

@@ -37,7 +38,7 @@ def goto_delivery_notes(self, **kwargs):
3738
action.update(kwargs)
3839

3940
if len(delivery_notes) > 1:
40-
action["domain"] = [("id", "in", delivery_notes.ids)]
41+
action["domain"] = Domain("id", "in", delivery_notes.ids)
4142

4243
elif len(delivery_notes) == 1:
4344
action["views"] = [
@@ -78,11 +79,11 @@ def _prepare_note_dn_value(self, sequence, delivery_note_id):
7879
return {
7980
"sequence": sequence,
8081
"display_type": "line_note",
81-
"name": self.env._("""Delivery Note "%(ddt_name)s" of %(ddt_date)s""")
82-
% {
83-
"ddt_name": delivery_note_id.name,
84-
"ddt_date": delivery_note_id.date.strftime(DATE_FORMAT),
85-
},
82+
"name": self.env._(
83+
"""Delivery Note "%(ddt_name)s" of %(ddt_date)s""",
84+
ddt_name=delivery_note_id.name,
85+
ddt_date=delivery_note_id.date.strftime(DATE_FORMAT),
86+
),
8687
"note_dn": True,
8788
"delivery_note_id": delivery_note_id.id,
8889
"quantity": 0,

l10n_it_delivery_note/models/res_config_settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def _default_virtual_locations_root(self):
2020
virtual_locations_root = fields.Many2one(
2121
"stock.location",
2222
string="Virtual locations root",
23-
default=_default_virtual_locations_root,
23+
default=lambda self: self._default_virtual_locations_root(),
2424
config_parameter="stock.location.virtual_root",
2525
)
2626

l10n_it_delivery_note/models/sale_order.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# @author: Matteo Bilotta <mbilotta@linkeurope.it>
33

44
from odoo import api, fields, models
5+
from odoo.fields import Command, Domain
56

67
from .stock_delivery_note import DOMAIN_DELIVERY_NOTE_STATES, DOMAIN_INVOICE_STATUSES
78

@@ -112,7 +113,11 @@ def _assign_delivery_notes_invoices(self, invoice_ids):
112113
if invoice_id in invoice_ids
113114
]
114115
ready_delivery_note.write(
115-
{"invoice_ids": [(4, invoice_id) for invoice_id in ready_invoice_ids]}
116+
{
117+
"invoice_ids": [
118+
Command.link(invoice_id) for invoice_id in ready_invoice_ids
119+
]
120+
}
116121
)
117122

118123
ready_delivery_notes._compute_invoice_status()
@@ -137,7 +142,7 @@ def goto_delivery_notes(self, **kwargs):
137142
action.update(kwargs)
138143

139144
if len(delivery_notes) > 1:
140-
action["domain"] = [("id", "in", delivery_notes.ids)]
145+
action["domain"] = Domain("id", "in", delivery_notes.ids)
141146

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

0 commit comments

Comments
 (0)