27.02.26
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from decimal import Decimal, ROUND_HALF_UP
|
||||
|
||||
from datetime import date
|
||||
|
||||
UNITS = (
|
||||
"ZERO ONE TWO THREE FOUR FIVE SIX SEVEN EIGHT NINE TEN ELEVEN TWELVE "
|
||||
@@ -8,6 +8,19 @@ UNITS = (
|
||||
|
||||
TENS = "ZERO TEN TWENTY THIRTY FORTY FIFTY SIXTY SEVENTY EIGHTY NINETY".split()
|
||||
|
||||
def format_date_en(d):
|
||||
if not d:
|
||||
return ''
|
||||
|
||||
day = d.day
|
||||
|
||||
# Gestion des suffixes ordinaux
|
||||
if 10 <= day % 100 <= 20:
|
||||
suffix = 'TH'
|
||||
else:
|
||||
suffix = {1: 'ST', 2: 'ND', 3: 'RD'}.get(day % 10, 'TH')
|
||||
|
||||
return f"{day}{suffix} {d.strftime('%B').upper()} {d.year}"
|
||||
|
||||
def _under_thousand(n):
|
||||
words = []
|
||||
|
||||
@@ -15,7 +15,7 @@ import datetime
|
||||
import logging
|
||||
import json
|
||||
from trytond.exceptions import UserWarning, UserError
|
||||
from trytond.modules.purchase_trade.numbers_to_words import quantity_to_words, amount_to_currency_words
|
||||
from trytond.modules.purchase_trade.numbers_to_words import quantity_to_words, amount_to_currency_words, format_date_en
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -287,13 +287,18 @@ class Sale(metaclass=PoolMeta):
|
||||
delivery_date = [dd.estimated_date for dd in self.lines[0].estimated_date if dd.trigger=='deldate']
|
||||
if delivery_date:
|
||||
del_date = delivery_date[0]
|
||||
if del_date:
|
||||
del_date = format_date_en(del_date)
|
||||
return del_date
|
||||
|
||||
@property
|
||||
def report_payment_date(self):
|
||||
if self.lines:
|
||||
Date = Pool().get('ir.date')
|
||||
return self.lines[0].sale.payment_term.lines[0].get_date(Date.today(),self.lines[0])
|
||||
payment_date = self.lines[0].sale.payment_term.lines[0].get_date(Date.today(),self.lines[0])
|
||||
if payment_date:
|
||||
payment_date = format_date_en(payment_date)
|
||||
return payment_date
|
||||
|
||||
@property
|
||||
def report_shipment(self):
|
||||
|
||||
Reference in New Issue
Block a user