跳至内容
菜单
此问题已终结

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?

形象
丢弃

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

编写者

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

相关帖文 回复 查看 活动
1
7月 17
3183
2
6月 23
3956
1
4月 22
2781
2
6月 17
22394
1
10月 15
3349