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

Hi Odoo community.

I have used the following code to generate a comment in the chatter whenever the price of a product, in product variants, is changed. However, I want this comment to be displayed in the chatter when changing the price of any price list. The problem is that the fixed_price field generates an error in the chatter. Could you help me?


for record in records:

  currency_symbol = record.currency_id.symbol

  if record._context.get('old_values'):

    old_vals = record._context['old_values'].get(record.id, {})

    if 'list_price' in old_vals:

      record.message_post(body="Precio de Venta cambio de %s%.2f a %s%.2f." 

                          % (currency_symbol,

                             old_vals['list_price'],

                             currency_symbol,

                             record.list_price))

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

Could you please give me the final code? 

I try to change the fifth and sixth line to what you suggest but no display has been generated.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

 the message in the chatter whenever the price_list_change_message field is set. This can be done similarly to what you did for product variant price changes.
for record in records:

​ if record.price_list_change_message: 

​record.message_post(body=record.price_list_change_message)

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 6 25
903
2
thg 4 25
1359
2
thg 4 25
1066
1
thg 2 25
1901
0
thg 1 25
1254