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

Hi,

Is there a way we can move analytical account and tag in the PO header instead of line. In lengthy PO same values are need to be selected for each line to avoid this if we can move in header or create custom in header and assign value to lines. Kindly share possible solution. thanks

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

Hello,

It was working perfectly in V12 but does not seem to work anymore in V13?

Any feedback?

Thanks

I just tried this at v13. It still works. Please retrace your steps and if you are having problems, create a NEW question that links to this one, sharing your steps with more detail than "does not seem to work" as it is very challenging to know what the problem is: Does the field show on the screen? Can you select an Account? Does the Analytic Account field show on the line? Does a value get populated? Does the incorrect value get populated? Is there any error? etc.

With the same setup ... the field analytic account on the order line does not populate In V13 even if it was well the case in the V12. Same DB just migrated in V13

It works in V13 if we do the update directly in the form view of the PO... If I try to do the update the context of the order line via Studio like in V12 it does not work however... Whatever it still works via the form view update.

Câu trả lời hay nhất

1. Create a new field on the Purchase Order model to store the Analytic Account Default:



2. Add this new field to the Purchase Order view:

(You would create your own view that inherits the standard view and add the new field at the position you like):

<field name="x_account_analytic_account"/>


3. Set the context for the order_line field so that it picks up the value selected in the new field:

context="{'default_account_analytic_id': x_account_analytic_account,}"


4. As soon as you Add an Item on the Purchase Order, the account_analytic_id field on the Purchase Order Line will be populated:

 


You can do the same for the analytic_tag_ids field.

Ảnh đại diện
Huỷ bỏ
Tác giả

Hi Ray Carnes,

Excellent demonstration of the point but seems I am missing something as tried on both community and enterprise but getting error when I click in the lines analytic filed as nothing getting defaulted,

Uncaught Error: NameError: name 'x_account_analytic_account' is not defined

View changes,

<field name="partner_ref"/>

<field name="x_account_analytic_account"/>

<field name="currency_id" groups="base.group_multi_currency"/>

<field name="is_shipped" invisible="1"/>

<field name="account_analytic_id" context="{'default_account_analytic_id': x_account_analytic_account,}" groups="purchase.group_analytic_accounting"/>

Few points need to clear,

1- this filed should be created under which model purchase order or purchase order line?

2 - context="{'default_account_analytic_id': x_account_analytic_account,}" << this comma should be there or should be removed?

3- the field already having one context so how to add another,

<field name="account_analytic_id" context="{'default_partner_id':parent.partner_id}" groups="purchase.group_analytic_accounting"/>

I think I am missing something may be very small change will solve the problem. I have both enterprise and community versions.

thanks

Tác giả

I was missing this "Set the context for the order_line field". thanks

Câu trả lời hay nhất

Any idea of how to do this on Odoo enterprise 16?

Thanks

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

Did you get any solution?

Câu trả lời hay nhất

Dear Mr. Sikandar

the context should be in the order_line field not in the analytic_account field the below code should be there:

<field name="order_line" attrs="{'readonly': [('state', 'in', ('done', 'cancel'))]}" context="{'default_account_analytic_id': x_account_analytic_account}">

the code has been tested and its working perfect,

thanks Mr. Ray

                         

Ảnh đại diện
Huỷ bỏ
Tác giả

True that was mistake. thanks

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 5 25
2832
2
thg 5 25
2063
3
thg 12 24
6045
1
thg 7 24
2893
1
thg 6 24
2045