Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2840 Visualizzazioni

What I need is to automatically write some quantities to a specific journal, read'em and write them on debit or credit fields, depending on the situation.

But, the whole point is, that I need to do this:

1.- Without creating invoices

2.- Depending on the state of class/table

3.- Without adding the function to any field, so as soon as it changes state, the quantites are written into the journal.

Ive tried this method, but I think this doesn't works because it should be on a computed Float or Integer field:

@api.multi
@api.depends('order_lines', 'order_lines.product_id', 'contract_work')
def accounting_scenarios(self):
    for record in self:
        if record.state == awaitingraw:
            record.product_id.printer_wip_account.debit = record.contract_work.total_
        elif record.state == work_in_progress:
            record.partner.transp_account.debit = record.contract_work.total_

So, it basically does nothing.

I need a behaviour like, when a purchase or sale is done, the debit or credit fieds are updated with the invoices generated. BUT in this case, the invoice isn't necessary, I just need to read, and copy some field (computed or not), and then "paste" this on the aforementioned fields of the selected journal.

I hope I've explained myself.

Any ideas?

Avatar
Abbandona

If you want this change to occur when sale state is changed to done, then override lock button function in sale.order.

Autore

lock button on sale.order? don't remember one called like that, let me check, but this is another class though, nothing to do with sales

Post correlati Risposte Visualizzazioni Attività
1
lug 17
3272
2
giu 23
4115
1
apr 22
2905
2
giu 17
22543
1
ott 15
3418