mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[15.0][MIG] account_move_line_purchase_info: Migration to 15.0
This commit is contained in:
16
account_move_line_purchase_info/models/purchase_order.py
Normal file
16
account_move_line_purchase_info/models/purchase_order.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class PurchaseOrder(models.Model):
|
||||
_inherit = "purchase.order"
|
||||
|
||||
@api.depends("order_line.invoice_lines.move_id")
|
||||
def _compute_invoice(self):
|
||||
"""Overwritten compute to avoid show all Journal Entries with
|
||||
purchase_order_line as invoice_lines One2many would take them into account."""
|
||||
for order in self:
|
||||
invoices = order.order_line.invoice_lines.move_id.filtered(
|
||||
lambda m: m.is_invoice(include_receipts=True)
|
||||
)
|
||||
order.invoice_ids = invoices
|
||||
order.invoice_count = len(invoices)
|
||||
Reference in New Issue
Block a user