İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
8973 Görünümler

Can anybody explain me how I can access the sale.order model from my inherited account.invoice report?

What I need is especially order date...

Avatar
Vazgeç
En İyi Yanıt

As mentioned by S. LE Gal the ORM link doesn't exist between the invoice and its respective sales orders. But it does exist in the database. So, you can create a custom module that adds a new many2many field to the account.invoice model that references the sale.order model via the sale_order_invoice_rel model.

class account_invoice(osv.osv):
_inherit = "account.invoice"

_columns = {
    'sale_order_ids': fields.many2many('sale.order', 'sale_order_invoice_rel'
        , 'invoice_id', 'order_id', 'Sale Orders', readonly=True, 
        help="The sale order(s) that generated this invoice. Multiple sales '\
        'orders may have been combined for the same customer to generate one invoice."),
}
Avatar
Vazgeç
Üretici

Thank you very much! This sounds like what I have been looking for! Could you also tell me how to get further product information into account.invoice.line model? What I need is product.id, product.name and product.description separately, not joined like invoiceline.name in account.invoice.line relation.

En İyi Yanıt

Hi,

I don't think there is a link from account.invoice to sale.order, but you have the revert link : In sale.order model, you have a many2many fields named "invoice_ids" (table : sale_order_invoice_rel).

So you can request the sale_order that have linked to a defined invoice.

Regards.

Avatar
Vazgeç
Üretici

As far as I know, there is a field called 'origin' inside account.invoice model. This is the element which the invoice was created from. We always generate invoices from sale.order. What I do not know is how to come from this field to the order_date and where I have to do my changes. Only in .rml file or in report parser, too?

Hi. Yes there is the 'origin' field, but this is a char field. So, that's why I think it's more complicated to request. for exemple in my database, there is some values like "OUT/02432:SO2074, OUT/08140:SO2485".

İlgili Gönderiler Cevaplar Görünümler Aktivite
1
Ağu 21
37645
0
Mar 15
5308
3
Mar 15
4960
3
Mar 25
6652
3
Kas 24
3719