Skip to content

Error in write method (purchase_triple_discount 16.0) #2716

Description

@Inigocampo08

Module

purchase_triple_discount

Describe the bug

In the write method of the triple_discount_mixin model, when modifying any of the discount fields (discount1, discount2, discount3), the calculated value is correctly assigned to the discount field. However, upon saving the purchase order, the values of discount2 and discount3 are reset to 0, and the calculated discount value is copied into discount1. This is not the expected behavior; the values of discount1, discount2, and discount3 should remain unchanged, and only the discount field should be updated with the calculated value.

To Reproduce

Affected versions:

  • Odoo 16.0 CE
  • purchase_triple_discount 16.0

Steps to reproduce the behavior:

  1. Create a purchase order.
  2. Add a line item with values in the discount1, discount2, and discount3 fields.
  3. Save the purchase order.
  4. Observe that:
    • The discount field is correctly calculated.
    • The values of discount2 and discount3 are reset to 0.
    • The calculated discount value is copied into discount1.

Expected behavior

  • The values of discount1, discount2, and discount3 should remain unchanged.
  • Only the discount field should be updated with the calculated value.

Additional context

  • No errors observed in the browser console.
  • The issue persists across different browsers and operating systems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions