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




<notebook>                        <page string="Order Lines">                            <field name="order_line" widget="one2many_list" context="{'default_order_id': active_id}">                                <tree editable="bottom">                                    <field name="product_id"/>                                    <field name="product_uom_qty"/>                                    <field name="price_unit" attrs="{'readonly': [('product_id', '!=', False)]}" />                                    <field name="price_subtotal" readonly="1"/>                                    <field name="company_id" invisible="1"/>                                </tree>                            </field>                        </page>                    </notebook>





I want to make the price_unit field not change its contents even though the quantity and subtotal contents change, if I enter a different number in the quantity then the price_unit changes to 0. How do I do this so that after entering an item, the price_unit always shows the price of the item without changing?

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

Implement a custom module and override the fuction which updates the unit price: Refer the below code (this was tested for V15)

class SaleOrderLine(models.Model):

    _inherit = 'sale.order.line'

   @api.onchange('product_uom_qty')

    def product_uom_change(self):

        current_price_unit = self.price_unit

        super(SaleOrderLine, self).product_uom_change()

        self.price_unit = current_price_unit

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

Dear Apriliz

You can create automation action  for update price base on condition fields look at image bellow

Best Regards.

Hussein Soliman


ERP Consultant


 M: +201066516071

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

What if the implementation uses syntax coding?

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 10 24
12152
1
thg 10 24
11979
1
thg 7 25
791
0
thg 11 24
1191
2
thg 3 15
4534