Initial commit: Odoo 18.0-20251222 extra-addons
This commit is contained in:
3
sale_stock_picking_note/models/__init__.py
Executable file
3
sale_stock_picking_note/models/__init__.py
Executable file
@@ -0,0 +1,3 @@
|
||||
from . import res_partner
|
||||
from . import sale_order
|
||||
from . import stock_picking
|
||||
22
sale_stock_picking_note/models/res_partner.py
Executable file
22
sale_stock_picking_note/models/res_partner.py
Executable file
@@ -0,0 +1,22 @@
|
||||
# Copyright 2023 Moduon Team S.L.
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0)
|
||||
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class Partner(models.Model):
|
||||
_inherit = "res.partner"
|
||||
|
||||
picking_note = fields.Html(
|
||||
string="Picking Internal Note",
|
||||
help="The notes will be added to the sales order and"
|
||||
"pickings but will not be printed "
|
||||
"on the delivery slip.",
|
||||
)
|
||||
picking_customer_note = fields.Text(
|
||||
string="Picking Customer Comments",
|
||||
help="The notes will be added to the sales order and"
|
||||
"pickings and will be printed on "
|
||||
"the delivery slip.",
|
||||
)
|
||||
36
sale_stock_picking_note/models/sale_order.py
Executable file
36
sale_stock_picking_note/models/sale_order.py
Executable file
@@ -0,0 +1,36 @@
|
||||
# Copyright 2018 Tecnativa - Carlos Dauden
|
||||
# Copyright 2021 Tecnativa - Víctor Martínez
|
||||
# Copyright 2023 Moduon Team S.L.
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class SaleOrder(models.Model):
|
||||
_inherit = "sale.order"
|
||||
|
||||
picking_note = fields.Html(
|
||||
string="Picking Internal Note",
|
||||
compute="_compute_picking_notes",
|
||||
store=True,
|
||||
readonly=False,
|
||||
)
|
||||
picking_customer_note = fields.Text(
|
||||
string="Picking Customer Comments",
|
||||
compute="_compute_picking_notes",
|
||||
store=True,
|
||||
readonly=False,
|
||||
)
|
||||
|
||||
@api.depends("partner_id", "partner_shipping_id")
|
||||
def _compute_picking_notes(self):
|
||||
for order in self:
|
||||
if order.state not in {"sale", "cancel"}:
|
||||
order.picking_note = (
|
||||
order.partner_shipping_id.picking_note
|
||||
or order.partner_id.picking_note
|
||||
)
|
||||
order.picking_customer_note = (
|
||||
order.partner_shipping_id.picking_customer_note
|
||||
or order.partner_id.picking_customer_note
|
||||
)
|
||||
41
sale_stock_picking_note/models/stock_picking.py
Executable file
41
sale_stock_picking_note/models/stock_picking.py
Executable file
@@ -0,0 +1,41 @@
|
||||
# Copyright 2021 Tecnativa - Víctor Martínez
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class StockPicking(models.Model):
|
||||
_inherit = "stock.picking"
|
||||
|
||||
customer_note = fields.Text(
|
||||
string="Customer Comments",
|
||||
compute="_compute_picking_notes",
|
||||
store=True,
|
||||
readonly=False,
|
||||
)
|
||||
note = fields.Html(
|
||||
compute="_compute_picking_notes",
|
||||
store=True,
|
||||
readonly=False,
|
||||
)
|
||||
|
||||
@api.depends(
|
||||
"sale_id",
|
||||
"sale_id.picking_note",
|
||||
"sale_id.picking_customer_note",
|
||||
"partner_id",
|
||||
"picking_type_id",
|
||||
)
|
||||
def _compute_picking_notes(self):
|
||||
for picking in self:
|
||||
if picking.picking_type_id.code != "incoming" and picking.state not in (
|
||||
"done",
|
||||
"cancel",
|
||||
):
|
||||
picking.note = (
|
||||
picking.sale_id.picking_note or picking.partner_id.picking_note
|
||||
)
|
||||
picking.customer_note = (
|
||||
picking.sale_id.picking_customer_note
|
||||
or picking.partner_id.picking_customer_note
|
||||
)
|
||||
Reference in New Issue
Block a user