Mix box and canister labels on shared sheets

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-11 12:53:57 +03:30
parent 7b9255d31c
commit 08b234c254
5 changed files with 30 additions and 26 deletions

View File

@@ -64,6 +64,8 @@ class Order(models.Model):
def save(self, *args, **kwargs):
if not self.canister_count and self.total_weight and self.canister_weight:
self.apply_weight()
self.canister_pages = math.ceil(self.canister_count / 4) if self.canister_count else 0
self.box_pages = math.ceil(self.box_count / 4) if self.box_count else 0
# Mixed sheets: canister + box labels share pages; total in canister_pages
n = self.canister_count + self.box_count
self.canister_pages = math.ceil(n / 4) if n else 0
self.box_pages = 0
super().save(*args, **kwargs)