Skip to content

Default income account duplicated in Item #48231

@barredterra

Description

@barredterra

Information about bug

We always write the income account to item defaults. This duplicates the company's default income account across all items and makes it hard to change the default later on.

Introduced here: #13918

Replicate:

  • Set Default Income Account in Company

  • Create a new sales Item

  • Create a Sales Invoice for this item -> Income Account is fetched from Company and copied into Item (item_defaults > Default Income Account)

    def set_default_income_account_for_item(obj):
    for d in obj.get("items"):
    if d.item_code:
    if getattr(d, "income_account", None):
    set_item_default(d.item_code, obj.company, "income_account", d.income_account)

  • Change Default Income Account in Company -> Default Income Account in Item still has the old value

Problem: If we want to change the Default Income Account, we have to do this for every item. This can become quite tedious when we have many items.

Possible solution: Keep Default Income Account in Item empty by default, fall back to using Default Income Account from Company. Or copy the income account to Item only if it's different from the Company's default.

Module

accounts

Version

v14 / v15 / develop

Installation method

None

Relevant log output / Stack trace / Full Error Message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions