Browse Source

Jan 17: [FIX] Bug Fixed 'product_multi_uom_pos'

pull/309/head
Cybrosys Technologies 3 months ago
parent
commit
c0b0f5fb1c
  1. 2
      product_multi_uom_pos/__manifest__.py
  2. 6
      product_multi_uom_pos/doc/RELEASE_NOTES.md
  3. 13
      product_multi_uom_pos/models/report_sale_details.py

2
product_multi_uom_pos/__manifest__.py

@ -21,7 +21,7 @@
############################################################################# #############################################################################
{ {
'name': "POS Product Multiple UOM", 'name': "POS Product Multiple UOM",
'version': '17.0.1.0.3', 'version': '17.0.1.0.4',
'category': 'Point of Sale', 'category': 'Point of Sale',
'summary': """A module to manage multiple UoM in POS""", 'summary': """A module to manage multiple UoM in POS""",
'description': """Using this app, you can change unit of measure of 'description': """Using this app, you can change unit of measure of

6
product_multi_uom_pos/doc/RELEASE_NOTES.md

@ -31,3 +31,9 @@
#### Version 17.0.1.0.3 #### Version 17.0.1.0.3
##### Update ##### Update
- Solved the issue occurred during the refund ,made changes in orderline - Solved the issue occurred during the refund ,made changes in orderline
#### 13.01.2025
#### Version 17.0.1.0.4
##### BUG FIX
- Solved the issue sale details report

13
product_multi_uom_pos/models/report_sale_details.py

@ -221,6 +221,7 @@ class ReportSaleDetails(models.AbstractModel):
products = [] products = []
refund_products = [] refund_products = []
for category_name, product_list in products_sold.items(): for category_name, product_list in products_sold.items():
print("product_list.items()",product_list.items())
category_dictionnary = { category_dictionnary = {
'name': category_name, 'name': category_name,
'products': sorted([{ 'products': sorted([{
@ -235,6 +236,7 @@ class ReportSaleDetails(models.AbstractModel):
'base_amount': base_amount, 'base_amount': base_amount,
} for (product, price_unit, discount, uom), (qty, product_total, base_amount, uom) in product_list.items()], key=lambda l: l['product_name']), } for (product, price_unit, discount, uom), (qty, product_total, base_amount, uom) in product_list.items()], key=lambda l: l['product_name']),
} }
products.append(category_dictionnary) products.append(category_dictionnary)
products = sorted(products, key=lambda l: str(l['name'])) products = sorted(products, key=lambda l: str(l['name']))
@ -248,10 +250,10 @@ class ReportSaleDetails(models.AbstractModel):
'quantity': qty, 'quantity': qty,
'price_unit': price_unit, 'price_unit': price_unit,
'discount': discount, 'discount': discount,
'uom': product.uom_id.name, 'uom': uom,
'total_paid': product_total, 'total_paid': product_total,
'base_amount': base_amount, 'base_amount': base_amount,
} for (product, price_unit, discount), (qty, product_total, base_amount) in product_list.items()], key=lambda l: l['product_name']), } for (product, price_unit, discount,uom), (qty, product_total, base_amount,uom) in product_list.items()], key=lambda l: l['product_name']),
} }
refund_products.append(category_dictionnary) refund_products.append(category_dictionnary)
refund_products = sorted(refund_products, key=lambda l: str(l['name'])) refund_products = sorted(refund_products, key=lambda l: str(l['name']))
@ -291,6 +293,8 @@ class ReportSaleDetails(models.AbstractModel):
'invoices': session._get_invoice_total_list(), 'invoices': session._get_invoice_total_list(),
}) })
invoiceTotal += session._get_total_invoice() invoiceTotal += session._get_total_invoice()
print('refund_info',refund_products)
print('products_info',products)
return { return {
'opening_note': sessions[0].opening_notes if len(sessions) == 1 else False, 'opening_note': sessions[0].opening_notes if len(sessions) == 1 else False,
@ -329,33 +333,28 @@ class ReportSaleDetails(models.AbstractModel):
for key1 in keys1: for key1 in keys1:
products.setdefault(key1, {}) products.setdefault(key1, {})
products[key1].setdefault(key2, [0.0, 0.0, 0.0, line.uom_id.name]) # Add UOM to the product data products[key1].setdefault(key2, [0.0, 0.0, 0.0, line.uom_id.name]) # Add UOM to the product data
# Add quantities and amounts # Add quantities and amounts
products[key1][key2][0] += line.qty products[key1][key2][0] += line.qty
products[key1][key2][1] += line.currency_id.round( products[key1][key2][1] += line.currency_id.round(
line.price_unit * line.qty * (100 - line.discount) / 100.0) line.price_unit * line.qty * (100 - line.discount) / 100.0)
products[key1][key2][2] += line.price_subtotal products[key1][key2][2] += line.price_subtotal
# UOM is already stored in [3] (as line.uom_id.name) # UOM is already stored in [3] (as line.uom_id.name)
# Calculate taxes if applicable # Calculate taxes if applicable
if line.tax_ids_after_fiscal_position: if line.tax_ids_after_fiscal_position:
line_taxes = line.tax_ids_after_fiscal_position.sudo().compute_all( line_taxes = line.tax_ids_after_fiscal_position.sudo().compute_all(
line.price_unit * (1 - (line.discount or 0.0) / 100.0), currency, line.qty, line.price_unit * (1 - (line.discount or 0.0) / 100.0), currency, line.qty,
product=line.product_id, partner=line.order_id.partner_id or False product=line.product_id, partner=line.order_id.partner_id or False
) )
# Store tax amounts and base amounts # Store tax amounts and base amounts
base_amounts = {} base_amounts = {}
for tax in line_taxes['taxes']: for tax in line_taxes['taxes']:
taxes.setdefault(tax['id'], {'name': tax['name'], 'tax_amount': 0.0, 'base_amount': 0.0}) taxes.setdefault(tax['id'], {'name': tax['name'], 'tax_amount': 0.0, 'base_amount': 0.0})
taxes[tax['id']]['tax_amount'] += tax['amount'] taxes[tax['id']]['tax_amount'] += tax['amount']
base_amounts[tax['id']] = tax['base'] base_amounts[tax['id']] = tax['base']
# Add base amounts to taxes # Add base amounts to taxes
for tax_id, base_amount in base_amounts.items(): for tax_id, base_amount in base_amounts.items():
taxes[tax_id]['base_amount'] += base_amount taxes[tax_id]['base_amount'] += base_amount
else: else:
taxes.setdefault(0, {'name': _('No Taxes'), 'tax_amount': 0.0, 'base_amount': 0.0}) taxes.setdefault(0, {'name': _('No Taxes'), 'tax_amount': 0.0, 'base_amount': 0.0})
taxes[0]['base_amount'] += line.price_subtotal_incl taxes[0]['base_amount'] += line.price_subtotal_incl
return products, taxes return products, taxes
Loading…
Cancel
Save