bemade-addons/shipping_information_on_customer_invoice/models/account_move.py
Marc Durepos 4c5b55a7dd Fixes to purchase_customer_requisition and shipping info on cust. inv.
purchase_customer_requisition:

* Make sure to check the validity (state + dates) on purchase
  requisitions being selected for PO lines.

shipping_information_on_customer_invoice:

* Rework how the picking is selected, going through the sale lines
  related to the invoice lines instead of the non-existing picking_id
  field previously coded.
2025-02-11 14:27:50 -05:00

17 lines
533 B
Python

from odoo import api, fields, models
class AccountMove(models.Model):
_inherit = "account.move"
picking_id = fields.One2many(
comodel_name="stock.picking",
string="Pickings",
compute="_compute_picking_id",
)
@api.depends("invoice_line_ids.sale_line_ids.move_ids.picking_id")
def _compute_picking_id(self):
for move in self:
pickings = move.invoice_line_ids.mapped("sale_line_ids.move_ids.picking_id")
move.picking_id = pickings and pickings[0] or False