mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
OrderChangeManager: add_position() returns a handle to the newly created position (#5557)
* OrderChangeManager: Add support for custom operations * OrderChangeManager: Add callback to AddPosition operation This is also meant as a way to fix #5548 * Refs #5557: Checkstyle fix * Refs #5557: Added tests * Refs #5557: Changes requested in the PR review * Refs #5557: Fix error in previous merge conflict * Refs #5557: PR review
This commit is contained in:
committed by
GitHub
parent
59c09e27fd
commit
8cc12fa1c7
@@ -2465,6 +2465,16 @@ class OrderChangeManagerTests(TestCase):
|
||||
assert nop.price == Decimal('12.00')
|
||||
assert nop.subevent == se1
|
||||
|
||||
@classscope(attr='o')
|
||||
def test_add_item_result_value(self):
|
||||
res_shirt = self.ocm.add_position(self.shirt, None, None, None)
|
||||
res_ticket2 = self.ocm.add_position(self.ticket2, None, None, None)
|
||||
with self.assertRaises(RuntimeError):
|
||||
_ = res_ticket2.position
|
||||
self.ocm.commit()
|
||||
assert res_shirt.position.item == self.shirt
|
||||
assert res_ticket2.position.item == self.ticket2
|
||||
|
||||
@classscope(attr='o')
|
||||
def test_add_item_with_rounding(self):
|
||||
self.order.tax_rounding_mode = "sum_by_net"
|
||||
|
||||
Reference in New Issue
Block a user