Skip to content

Restrict pricelist price update from product page#22

Open
JustShah wants to merge 3 commits into
add-price-list-and-price-list-itemsfrom
restrict-pricelist-price-edit-on-product
Open

Restrict pricelist price update from product page#22
JustShah wants to merge 3 commits into
add-price-list-and-price-list-itemsfrom
restrict-pricelist-price-edit-on-product

Conversation

@JustShah

@JustShah JustShah commented Apr 9, 2025

Copy link
Copy Markdown

Restrict Price Edits for Price List Prices

This pull request introduces restrictions on editing or deleting prices that are associated with a price list from product tab. It adds localization, view updates, and backend checks to prevent modifications to prices that belong to price lists, ensuring better integrity in the pricing system.

Key Features:

  1. Localization and View Updates for Price List Prices:

    • Added a new localization key for an error message indicating that a price belongs to a price list and cannot be edited or deleted.
    • Updated the master variant price table and the general price table of product tab in the admin interface:
      • Prevented editing and deleting of prices that belong to a price list.
      • Displayed a message indicating the associated price lists for prices that are part of a price list.
    • Added a hidden field is_pricelist_price to the price list item form to track whether a price belongs to a price list.
  2. Price List Price Check for Variants and Prices:

    • Implemented check_pricelist_price method in the variant API and price admin controllers to prevent users from updating prices that are associated with a price list.
    • Ensured that the system enforces the restriction on editing prices that are part of a price list at both the backend and user interface levels.
  3. New Attribute is_pricelist_price in Spree Price Model:

    • Added a boolean attribute is_pricelist_price to the Spree::Price model to identify whether a price has been created for a price list.
    • This attribute helps differentiate prices that are part of price lists from regular product prices, providing additional control and flexibility in managing pricing.

Benefits:

  • Price Integrity: Prevents accidental modification or deletion of prices that are part of a price list, ensuring that the pricing structure remains intact.
  • Improved User Interface: The admin interface now provides clear feedback when attempting to edit or delete prices associated with a price list, improving user experience and reducing errors.
  • Backend Enforcement: The addition of backend checks ensures that users cannot bypass the restrictions when interacting with the API or admin controllers.
  • Flexible Price Management: The is_pricelist_price attribute allows for easier identification and management of prices that belong to price lists.

@JustShah JustShah force-pushed the add-price-list-and-price-list-items branch 2 times, most recently from 7e0f0de to 5b84a82 Compare April 9, 2025 12:19
@JustShah JustShah force-pushed the restrict-pricelist-price-edit-on-product branch 3 times, most recently from 0394828 to aaff3a6 Compare April 9, 2025 13:15
@fthobe

fthobe commented Apr 9, 2025

Copy link
Copy Markdown

@JustShah add logic to link to pricelist

@JustShah JustShah force-pushed the add-price-list-and-price-list-items branch from 5b84a82 to a510834 Compare April 10, 2025 09:59
@JustShah JustShah force-pushed the restrict-pricelist-price-edit-on-product branch from aaff3a6 to 5920ded Compare April 10, 2025 10:02
@JustShah JustShah force-pushed the add-price-list-and-price-list-items branch from a510834 to d398f23 Compare April 10, 2025 13:26
@JustShah JustShah force-pushed the restrict-pricelist-price-edit-on-product branch from 5920ded to d98c8f2 Compare April 10, 2025 13:27
@JustShah JustShah force-pushed the add-price-list-and-price-list-items branch from d398f23 to f973070 Compare April 10, 2025 14:38
@JustShah JustShah force-pushed the restrict-pricelist-price-edit-on-product branch from d98c8f2 to fd0982d Compare April 10, 2025 14:38
@JustShah JustShah force-pushed the add-price-list-and-price-list-items branch from f973070 to 38b3f9b Compare April 11, 2025 05:07
@JustShah JustShah force-pushed the restrict-pricelist-price-edit-on-product branch from fd0982d to cb53a85 Compare April 11, 2025 05:07
@JustShah JustShah force-pushed the restrict-pricelist-price-edit-on-product branch from cb53a85 to 9a2d49a Compare April 11, 2025 10:38
@fthobe

fthobe commented Apr 11, 2025

Copy link
Copy Markdown

@JustShah looks good and fine to me

@JustShah JustShah force-pushed the add-price-list-and-price-list-items branch from 38b3f9b to 9de007a Compare April 15, 2025 06:28
This commit adds a boolean is_pricelist_price to spree price model,
which can be used to identify whether the price has been created for price lists or
the price has been created from products section.
Implemented `check_pricelist_price` in variant API and price admin controllers to prevent the user from updating prices which are associated to a price list.
- Added a new localization key for the error message indicating that a price belongs to a price list and cannot be edited or deleted.
- Updated the master variant price table and the general price table in the admin interface to:
  - Prevent editing and deleting of prices that belong to a price list.
  - Display a message indicating the associated price lists for prices that are part of a price list.
- Added hidden field for is_pricelist_price to price list item form.
@JustShah JustShah force-pushed the restrict-pricelist-price-edit-on-product branch from 9a2d49a to b422769 Compare April 15, 2025 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants