diff --git a/modules/account_invoice/invoice_ict_final.fodt b/modules/account_invoice/invoice_ict_final.fodt index b207c7a..474e5b0 100644 --- a/modules/account_invoice/invoice_ict_final.fodt +++ b/modules/account_invoice/invoice_ict_final.fodt @@ -3981,7 +3981,7 @@ Net Landed Weight - <invoice.report_net_display> + <invoice.report_gross_display> <invoice.report_weight_unit_upper> @@ -3992,7 +3992,7 @@ or - <invoice.report_lbs_display> + <invoice.report_gross_lbs_display> LBS @@ -4011,10 +4011,10 @@ - Gain in Weight + Difference in Weight - + <invoice.report_weight_difference_display> <invoice.report_weight_unit_upper> @@ -4025,7 +4025,7 @@ or - + <invoice.report_weight_difference_lbs_display> LBS diff --git a/modules/purchase_trade/invoice.py b/modules/purchase_trade/invoice.py index 6c7a4b5..97fa988 100644 --- a/modules/purchase_trade/invoice.py +++ b/modules/purchase_trade/invoice.py @@ -1,7 +1,6 @@ from decimal import Decimal, ROUND_HALF_UP from datetime import date as dt_date import os -import logging from pathlib import Path from sql import Literal @@ -20,8 +19,6 @@ from trytond.modules.sale.sale import SaleReport as BaseSaleReport from trytond.modules.purchase.purchase import ( PurchaseReport as BasePurchaseReport) -logger = logging.getLogger(__name__) - class InvoiceLineLotWeight(ModelSQL, ModelView): "Invoice Line Lot Weight" @@ -929,34 +926,13 @@ class Invoice(metaclass=PoolMeta): def _get_report_weight_adjustment_totals(self): reused_lots = self._get_report_reused_lot_lines() if not reused_lots: - logger.warning( - "REPORT_WEIGHT_ADJUSTMENT_NO_REUSED_LOTS: invoice=%s " - "line_count=%s lines=%s", - getattr(self, 'id', None), - len(self._get_report_invoice_lines()), - [ - { - 'line': getattr(line, 'id', None), - 'quantity': str(getattr(line, 'quantity', None)), - 'lot': getattr(getattr(line, 'lot', None), 'id', None), - 'lot_keys': self._get_report_line_lot_keys(line), - } - for line in self._get_report_invoice_lines() - ]) return None invoice_total = Decimal(0) landed_total = Decimal(0) matched = False for data in reused_lots.values(): - lot = data['lot'] lines = data['lines'] - logger.warning( - "REPORT_WEIGHT_ADJUSTMENT_GROUP: invoice=%s lot=%s " - "line_ids=%s quantities=%s", - getattr(self, 'id', None), getattr(lot, 'id', None), - [getattr(line, 'id', None) for line in lines], - [str(getattr(line, 'quantity', None)) for line in lines]) negative_lines = [ line for line in lines if Decimal(str(getattr(line, 'quantity', 0) or 0)) < 0 @@ -966,14 +942,6 @@ class Invoice(metaclass=PoolMeta): if Decimal(str(getattr(line, 'quantity', 0) or 0)) > 0 ] if not negative_lines or not positive_lines: - logger.warning( - "REPORT_WEIGHT_ADJUSTMENT_SKIP_GROUP: invoice=%s lot=%s " - "negative=%s positive=%s", - getattr(self, 'id', None), getattr(lot, 'id', None), - [str(getattr(line, 'quantity', None)) - for line in negative_lines], - [str(getattr(line, 'quantity', None)) - for line in positive_lines]) continue invoice_values = [ @@ -982,31 +950,12 @@ class Invoice(metaclass=PoolMeta): landed_values = [ abs(self._get_report_invoice_line_quantity_from_line(line)) for line in positive_lines] - logger.warning( - "REPORT_WEIGHT_ADJUSTMENT_VALUES: invoice=%s lot=%s " - "negative_raw=%s invoice_values=%s positive_raw=%s " - "landed_values=%s", - getattr(self, 'id', None), getattr(lot, 'id', None), - [str(getattr(line, 'quantity', None)) - for line in negative_lines], - [str(value) for value in invoice_values], - [str(getattr(line, 'quantity', None)) - for line in positive_lines], - [str(value) for value in landed_values]) invoice_total += sum(invoice_values) landed_total += sum(landed_values) matched = True if not matched: - logger.warning( - "REPORT_WEIGHT_ADJUSTMENT_NO_MATCH: invoice=%s reused_lots=%s", - getattr(self, 'id', None), list(reused_lots.keys())) return None - logger.warning( - "REPORT_WEIGHT_ADJUSTMENT_RESULT: invoice=%s invoice_weight=%s " - "landed_weight=%s difference=%s", - getattr(self, 'id', None), invoice_total, landed_total, - abs(landed_total - invoice_total)) return { 'invoice': invoice_total, 'landed': landed_total, @@ -1828,9 +1777,6 @@ class Invoice(metaclass=PoolMeta): if self.lines: adjustment = self._get_report_weight_adjustment_totals() if adjustment: - logger.warning( - "REPORT_WEIGHT_ADJUSTMENT_USE_GROSS: invoice=%s value=%s", - getattr(self, 'id', None), adjustment['landed']) return adjustment['landed'] reused_gross = self._get_report_reused_lot_gross_total() if reused_gross is not None: @@ -1855,9 +1801,6 @@ class Invoice(metaclass=PoolMeta): if self.lines: adjustment = self._get_report_weight_adjustment_totals() if adjustment: - logger.warning( - "REPORT_WEIGHT_ADJUSTMENT_USE_NET: invoice=%s value=%s", - getattr(self, 'id', None), adjustment['invoice']) return adjustment['invoice'] return sum( self._get_report_invoice_line_weights(line)[0] @@ -1894,10 +1837,6 @@ class Invoice(metaclass=PoolMeta): def report_weight_difference(self): adjustment = self._get_report_weight_adjustment_totals() if adjustment: - logger.warning( - "REPORT_WEIGHT_ADJUSTMENT_USE_DIFFERENCE: invoice=%s " - "value=%s", - getattr(self, 'id', None), adjustment['difference']) return adjustment['difference'] gross = self.report_gross net = self.report_net