Skip to content

feat: linking supplier with an item group for filtering items#25683

Merged
rohitwaghchaure merged 6 commits into
frappe:version-13-hotfixfrom
noahjacob:supplier_item_group_link
May 21, 2021
Merged

feat: linking supplier with an item group for filtering items#25683
rohitwaghchaure merged 6 commits into
frappe:version-13-hotfixfrom
noahjacob:supplier_item_group_link

Conversation

@noahjacob

@noahjacob noahjacob commented May 12, 2021

Copy link
Copy Markdown
Contributor

Changes:

  • Created a doctype to create links between supplier and item_groups.

image

  • Updated filters for buying module if any item groups are linked to the supplier.
    item_group
    (If no item groups are linked to the supplier it does not apply the filter)

  • Added Supplier Item Group in Supplier dashboard.
    image

  • Docs

@noahjacob noahjacob changed the base branch from develop to version-13-hotfix May 17, 2021 05:31
Comment thread erpnext/controllers/queries.py Outdated
Comment thread erpnext/controllers/queries.py Outdated
Comment thread erpnext/controllers/queries.py Outdated
@rohitwaghchaure

Copy link
Copy Markdown
Collaborator

@noahjacob add supplier item group doctype in the dashboard of supplier

image

@noahjacob noahjacob force-pushed the supplier_item_group_link branch from 4eaf8b2 to ca2fb47 Compare May 18, 2021 09:31
@rohitwaghchaure

rohitwaghchaure commented May 19, 2021

Copy link
Copy Markdown
Collaborator

frappe.get_list checks whether the user has permission of Supplier Item Group or not, if the person who is creating the purchase order has not permission of the doctype Supplier Item Group then system will not allowed user to make the purchase order and throw below error.

Screenshot 2021-05-19 at 1 04 38 PM

You can use frappe.get_all instead of frappe.get_list because in this case we don't need to check permission for the doctype 'Supplier Item Group'

Comment thread erpnext/buying/doctype/supplier_item_group/supplier_item_group.json
@rohitwaghchaure rohitwaghchaure merged commit 651e934 into frappe:version-13-hotfix May 21, 2021
if not field in searchfields]
searchfields = " or ".join([field + " like %(txt)s" for field in searchfields])

if filters.get('supplier'):

@barredterra barredterra Jun 2, 2021

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@noahjacob, @rohitwaghchaure filters argument is a string containing json, when called from the frontend. The following code breaks with this PR:

frappe.call({
    method: 'erpnext.controllers.queries.item_query',
    args: {
        doctype: 'Item',
        txt: '',
        searchfield: 'name',
        start: 0,
        page_len: 99,
        filters: {
            supplier: 'Unico Plastics Inc.',
            is_sales_item: 1
        },
        as_dict: true
    },
    callback: (r) => console.log(r.message)
});

Bildschirmfoto 2021-06-02 um 17 36 03

filters string needs to be parsed to json first.

Please fix or revert this PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

already fixed via #25915 , will release in sometime

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nabinhait while it doesn't produce an error anymore, filters will still be ignored in my example.

barredterra added a commit to alyf-de/erpnext that referenced this pull request Jun 2, 2021
@frappe frappe locked as resolved and limited conversation to collaborators Mar 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants