dashboard weight updates
This commit is contained in:
parent
5e595e9f2b
commit
4ff37c175e
|
|
@ -23,12 +23,12 @@ class SamashtiDashboard(models.AbstractModel):
|
|||
# Convert local datetime to UTC
|
||||
from_local = local_tz.localize(datetime.combine(from_date_obj, time.min))
|
||||
to_local = local_tz.localize(datetime.combine(to_date_obj, time.max))
|
||||
from_utc = from_local.astimezone(pytz.UTC)
|
||||
to_utc = to_local.astimezone(pytz.UTC)
|
||||
# from_utc = from_local.astimezone(pytz.UTC)
|
||||
# to_utc = to_local.astimezone(pytz.UTC)
|
||||
|
||||
# Convert to string in Odoo datetime format
|
||||
fromDate = "'"+str(fields.Datetime.to_string(from_utc))+"'"
|
||||
toDate = "'"+str(fields.Datetime.to_string(to_utc))+"'"
|
||||
fromDate = "'"+str(fields.Datetime.to_string(from_local))+"'"
|
||||
toDate = "'"+str(fields.Datetime.to_string(to_local))+"'"
|
||||
|
||||
sql = f"""
|
||||
SELECT
|
||||
|
|
@ -159,12 +159,12 @@ class SamashtiDashboard(models.AbstractModel):
|
|||
# Convert local datetime to UTC
|
||||
from_local = local_tz.localize(datetime.combine(from_date_obj, time.min))
|
||||
to_local = local_tz.localize(datetime.combine(to_date_obj, time.max))
|
||||
from_utc = from_local.astimezone(pytz.UTC)
|
||||
to_utc = to_local.astimezone(pytz.UTC)
|
||||
# from_utc = from_local.astimezone(pytz.UTC)
|
||||
# to_utc = to_local.astimezone(pytz.UTC)
|
||||
|
||||
# Convert to string in Odoo datetime format
|
||||
from_datetime = fields.Datetime.to_string(from_utc)
|
||||
to_datetime = fields.Datetime.to_string(to_utc)
|
||||
from_datetime = fields.Datetime.to_string(from_local)
|
||||
to_datetime = fields.Datetime.to_string(to_local)
|
||||
# Search for posted invoices within the date range
|
||||
invoice_ids = self.env['account.move'].search([
|
||||
('state', '=', 'posted'),
|
||||
|
|
@ -195,7 +195,7 @@ class SamashtiDashboard(models.AbstractModel):
|
|||
|
||||
customer = order_data['partner_id'][-1] if order_data['partner_id'] else "Unknown"
|
||||
quantity = sum(order.order_line.mapped('product_uom_qty'))
|
||||
weight = f"{sum(order.order_line.mapped('bag_weight'))} kg"
|
||||
weight = sum(order.order_line.mapped('bag_weight'))
|
||||
|
||||
# Combine product tags
|
||||
product_tags = ', '.join(
|
||||
|
|
@ -246,12 +246,12 @@ class SamashtiDashboard(models.AbstractModel):
|
|||
# Convert local datetime to UTC
|
||||
from_local = local_tz.localize(datetime.combine(from_date_obj, time.min))
|
||||
to_local = local_tz.localize(datetime.combine(to_date_obj, time.max))
|
||||
from_utc = from_local.astimezone(pytz.UTC)
|
||||
to_utc = to_local.astimezone(pytz.UTC)
|
||||
# from_utc = from_local.astimezone(pytz.UTC)
|
||||
# to_utc = to_local.astimezone(pytz.UTC)
|
||||
|
||||
# Convert to string in Odoo datetime format
|
||||
fromDate = "'"+str(fields.Datetime.to_string(from_utc))+"'"
|
||||
toDate = "'"+str(fields.Datetime.to_string(to_utc))+"'"
|
||||
fromDate = "'"+str(fields.Datetime.to_string(from_local))+"'"
|
||||
toDate = "'"+str(fields.Datetime.to_string(to_local))+"'"
|
||||
|
||||
mo_ids = self.env['mrp.production'].search([
|
||||
('state', '=', 'done'),
|
||||
|
|
@ -272,6 +272,7 @@ class SamashtiDashboard(models.AbstractModel):
|
|||
'date':mo.date_start.strftime('%d-%m-%Y'),
|
||||
'tags':product_tags,
|
||||
'uom': l.uom_id.name,
|
||||
'weight': l.quantity * (l.product_id.weight or 1),
|
||||
'quantity':l.quantity,
|
||||
'value':l.value,
|
||||
'reference':l.reference
|
||||
|
|
|
|||
|
|
@ -216,6 +216,7 @@ export class ConsumptionDashboard extends Component {
|
|||
dataIndx: "uom",
|
||||
width: 80
|
||||
},
|
||||
{ title: "Weight (kgs)", dataIndx: "weight", width: 120, dataType: "float", format: "#,###.00", summary: { type: "sum_" }, align: "right"},
|
||||
{
|
||||
title: "Value (INR)",
|
||||
dataIndx: "value",
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ export class SaleDashboard extends Component {
|
|||
{ title: "Customer", dataIndx: "customer", width: 280, filter: { type: 'textbox', condition: 'contain', listeners: ['keyup'] } },
|
||||
{ title: "Tags", dataIndx: "tags", width: 100, },
|
||||
{ title: "Quantity (Bags/No's)", dataIndx: "quantity", width: 150, dataType: "float", format: "#,###.00", summary: { type: "sum_" }, align: "right" },
|
||||
{ title: "Weight (kgs)", dataIndx: "weight", width: 120 },
|
||||
{ title: "Weight (kgs)", dataIndx: "weight", width: 120, dataType: "float", format: "#,###.00", summary: { type: "sum_" }, align: "right"},
|
||||
{ title: "Production Cost (INR)", dataIndx: "cost", width: 150, dataType: "float", format: "#,###.00", summary: { type: "sum_" }, align: "right" },
|
||||
{ title: "Sale Price (INR)", dataIndx: "sale_price", width: 120, dataType: "float", format: "#,###.00", summary: { type: "sum_" }, align: "right" },
|
||||
{ title: "Margin (INR)", dataIndx: "margin", width: 120, dataType: "float", format: "#,###.00", summary: { type: "sum_" }, align: "right" },
|
||||
|
|
|
|||
Loading…
Reference in New Issue