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

Suppose I have model_1, this model has a state Selection field, like, for example: draft, started, progress, done

This model, has a line, this line (or One2many) field, brings a product object.

On this product object, I've set these fields:

erp_common = fields.Many2one('account.account.template', string='ERP Common Account')
paper_suppl_pay_acc = fields.Many2one('account.account.template', string='Payment Account')
paper_suppl_stock_acc = fields.Many2one('account.account.template', string='Stock Account')

What I want, is, for example, I create a new record, on model_1, this record is on draft state, if on draft the product should use the erp_common selected account.account.template, now, I change the model_1 state to started, the product automatically should use (or change for what matters) the account.account.template used to paper_suppl_stock_acc.

I hope I'm explaining myself properly.

Essentially, depending on the state of model_1 the product should use one different account.account.template.

It is somehow similar to when You specify an account for purchases or sales, so depending on which object You create, it uses that specific account.account.template, but this is kind of more dynamical.

Is there some example around I should look for?

Or better, do You know a way in such I could accomplish this?

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

Why you need multiple template? you can handle everything in simple template. just display the data in your report/template based on active state.

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 7 17
3605
1
thg 10 15
3483
0
thg 10 15
3551
1
thg 3 15
4868
2
thg 3 15
5283