Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into bootstrap-plone6
Browse files Browse the repository at this point in the history
  • Loading branch information
petschki committed Mar 15, 2023
2 parents b9bcf4c + 7865f62 commit 5323fdb
Show file tree
Hide file tree
Showing 8 changed files with 296 additions and 266 deletions.
13 changes: 13 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ Changelog
- Use Decimal for shipping and article defaults.
[agitator]

- Fix availability details pop-up
[petri]

- Refactor buyable.[py|pt] for localized number output and better Decimal usage.
Also use Python expressions for performance.
[jensens]

- Use Decimal field for net price and cast to Decimal (for old values) in accessor.
[jensens]

Expand Down Expand Up @@ -52,6 +59,12 @@ Changelog
- Update version and classifiers - 2.x targets Plone 5.1/5.2 without Archetypes
[agitator]

- Italian translations
[ale-rt]

- migration: fixed an edgecase when upgrading old shop installations
[petschki]


1.0a1 (unreleased)
------------------
Expand Down
1 change: 1 addition & 0 deletions src/bda/plone/shop/browser/availability.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
class CartItemAvailability(CartItemAvailabilityBase):
details_template = ViewPageTemplateFile("availability_details.pt")

@property
def details(self):
return self.details_template(self)

Expand Down
9 changes: 4 additions & 5 deletions src/bda/plone/shop/browser/buyable.pt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ajax:bind="cart_changed"
tal:define="addable view/item_addable;
css string:cart_item_${context/UID}"
tal:attributes="ajax:target context/absolute_url;
tal:attributes="ajax:target python:context.absolute_url();
ajax:action string:buyable_controls:.${css}:replace;
class string:buyable viewlet ${css}">

Expand All @@ -18,7 +18,7 @@
 
</div>
<div class="availability_details"
tal:content="structure view/availability_details">
tal:content="structure python:view.availability_details">
deliverable until 1.1.2013
</div>
</div>
Expand Down Expand Up @@ -105,9 +105,8 @@
</div>
</tal:comment>
<span tal:condition="view/can_buy_items"
class="cart_item_uid"
style="display: none;"
tal:content="view/item_uid">12345678</span>
class="cart_item_uid"
style="display: none;">${view/item_uid}</span>

<tal:addable condition="addable">
<div class="add-to-cart-group input-group mb-2 me-2">
Expand Down
12 changes: 8 additions & 4 deletions src/bda/plone/shop/browser/buyable.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,20 @@ def currency(self):
return CURRENCY_LITERALS[currency]
return ""

def format_number_localized(self, value, quantizer=None):
formatter = self.request.locale.numbers.getFormatter('decimal')
formatter.type = Decimal
if quantizer is not None:
value = value.quantize(Decimal(quantizer))
return formatter.format(value)

@property
def item_uid(self):
return IUUID(self.context)

@property
def item_vat(self):
vat = self._item_data.vat
if vat % 2 != 0:
return Decimal(vat).quantize(Decimal("1.0"))
return Decimal(vat)
return Decimal(self._item_data.vat)

@property
def item_net_original(self):
Expand Down
3 changes: 1 addition & 2 deletions src/bda/plone/shop/i18n.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ done

# Assume i18ndude is installed with buildout
# and this script is run under src/ folder with two nested namespaces in the package name (like collective.bla)
#I18NDUDE=../../../../bin/i18ndude
I18NDUDE=../../../../../../bin/i18ndude
I18NDUDE=$(which i18ndude || ../../../../../../bin/i18ndude)

if test ! -e $I18NDUDE; then
echo "You must install i18ndude with buildout"
Expand Down
Loading

0 comments on commit 5323fdb

Please sign in to comment.