Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2755 Lượt xem

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?

Ảnh đại diện
Huỷ bỏ

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

Tác giả

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 7 17
3166
2
thg 6 23
3929
1
thg 4 22
2757
2
thg 6 17
22358
1
thg 10 15
3333