Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add net and gross purchase prices #1155

Conversation

hanneswernery
Copy link
Contributor

This is an updated and improved version of #663 for the 6.3.1.0 release

1. Why is this change necessary?

Currently the product and the payload of the order line items have a purchase price field of type float. Many users want to manage their purchase prices as net prices. Some want to use different currencies when purchasing products.
Hence the more complex PriceField with gross and net prices as well as currencies would be more suitable.

2. What does this change do, exactly?

Adds a new purchase price field of the more complex type PriceField which supports purchases prices as net and gross prices as well as purchase prices in multiple currencies (even though the code right now only uses a single purchase price in the default currency).

  • A field purchase_prices of type PriceField is added to the product definition as well as to the order line items (and some corresponding classes).
  • The old float purchase price field (and some corresponding functions) is marked as deprecated.
  • The existing LineItemPurchasePriceRule improved to handle gross or net purchase prices. Existing rules are migrated.
  • A migration is added to migrate the deprecated purchase price field to the new one.
  • An ApiConverter is added to provide the old purchase price field for the api v2 and the new field for the api v3.
  • A database trigger is added to keep the deprecated purchase price field in sync with the new one (updating either will update the other).
  • The administration product view is updated to display the new purchase price field.
  • Existing PHPUnit and Cypress e2e tests are updated and some new tests are added.

Screenshot 2020-07-06 at 09 08 10

3. Describe each step to reproduce the issue or behaviour.

4. Please link to the relevant issues (if any).

5. Checklist

  • I have written tests and verified that they fail without my change
  • I have squashed any insignificant commits
  • I have written or adjusted the documentation according to my changes
  • This change has comments for package types, values, functions, and non-obvious lines of code
  • I have read the contribution requirements and fulfil them.

@hanneswernery hanneswernery force-pushed the pickware/add-net-and-gross-purchase-prices-6.3 branch from e061fe7 to 348a4e5 Compare August 21, 2020 10:03
shopwareBot pushed a commit to shopware/administration that referenced this pull request Aug 31, 2020
shopwareBot pushed a commit to shopware/core that referenced this pull request Aug 31, 2020
@mitelg
Copy link
Member

mitelg commented Sep 1, 2020

thanks for your really awesome contribution @hanneswernery 👍 🎉 💙

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants