19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:30:27 +01:00
parent d1963a3c3a
commit 2d3ee4855a
7430 changed files with 2687981 additions and 2965473 deletions

View file

@ -1,9 +1,10 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models, tools
from odoo import api, fields, models, tools
from odoo.tools import formatLang
class PurchaseBillUnion(models.Model):
_name = 'purchase.bill.union'
_auto = False
@ -30,19 +31,20 @@ class PurchaseBillUnion(models.Model):
id as vendor_bill_id, NULL as purchase_order_id
FROM account_move
WHERE
move_type='in_invoice' and state = 'posted'
move_type in ('in_invoice', 'in_refund') and state = 'posted'
UNION
SELECT
-id, name, partner_ref as reference, partner_id, date_order::date as date, amount_untaxed as amount, currency_id, company_id,
NULL as vendor_bill_id, id as purchase_order_id
FROM purchase_order
WHERE
state in ('purchase', 'done') AND
state = 'purchase' AND
invoice_status in ('to invoice', 'no')
)""")
def name_get(self):
result = []
@api.depends('currency_id', 'reference', 'amount', 'purchase_order_id')
@api.depends_context('show_total_amount')
def _compute_display_name(self):
for doc in self:
name = doc.name or ''
if doc.reference:
@ -50,6 +52,5 @@ class PurchaseBillUnion(models.Model):
amount = doc.amount
if doc.purchase_order_id and doc.purchase_order_id.invoice_status == 'no':
amount = 0.0
name += ': ' + formatLang(self.env, amount, monetary=True, currency_obj=doc.currency_id)
result.append((doc.id, name))
return result
name += ': ' + formatLang(self.env, amount, currency_obj=doc.currency_id)
doc.display_name = name