From 2840c93823bd5ef145e1a827138d43ab97a8e824 Mon Sep 17 00:00:00 2001 From: Du Peng Date: Fri, 9 Sep 2022 10:43:44 +0200 Subject: [PATCH] (bug) fix invoice reference --- app/models/order.rb | 4 ++++ app/models/payment_document.rb | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/models/order.rb b/app/models/order.rb index 4bcee9766..5ea02af79 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -21,6 +21,10 @@ class Order < PaymentDocument delegate :user, to: :statistic_profile + def generate_reference(_date = DateTime.current) + self.reference = PaymentDocumentService.generate_order_number(self) + end + def footprint_children order_items end diff --git a/app/models/payment_document.rb b/app/models/payment_document.rb index 40aa03420..1f2ef946c 100644 --- a/app/models/payment_document.rb +++ b/app/models/payment_document.rb @@ -4,8 +4,8 @@ class PaymentDocument < Footprintable self.abstract_class = true - def generate_reference - self.reference = PaymentDocumentService.generate_order_number(self) + def generate_reference(date = DateTime.current) + self.reference = PaymentDocumentService.generate_reference(self, date: date) end def update_reference