+
Hello,
+New sale order '%s' + Created with Discount by '%s' + need your approval on it.
+To Approve, Cancel Order, + Click on the Following + Link: + + Click Me +
+Thank You.
""" % (self.name, + self.env.user.name, + url) + mail_values = { + 'subject': "'%s' Discount Approval Request" % (self.name), + 'body_html': mail_body, + 'email_to': user.partner_id.email, + 'model': 'sale.order', + } + mail_id = self.env['mail.mail'].sudo().create(mail_values) + mail_id.sudo().send() + self.state = 'waiting_for_approval' + for line in self.order_line: + if line.product_id.is_pack: + for record in line.product_id.pack_products_ids: + dest_loc = self.env.ref( + 'stock.stock_location_customers').id + self.env['stock.move'].create({ + 'name': record.product_id.name, + 'product_id': record.product_id.id, + 'product_uom_qty': + record.quantity * line.product_uom_qty, + 'product_uom': record.product_id.uom_id.id, + 'picking_id': self.picking_ids[0].id, + 'location_id': + self.picking_ids.picking_type_id.default_location_src_id.id, + 'location_dest_id': dest_loc, + }) + return res + + @api.model + def create(self, vals): + """Method for generating sequence for quotation """ + res = super(SaleOrder, self).create(vals) + seq_val = self.env.ref( + 'all_in_one_sales_kit.seq_quotation').id + res.quotation_ref = self.env['ir.sequence'].browse( + seq_val).next_by_id() + return res + + def action_waiting_approval(self): + """Method for approving the sale order discount""" + self.approval_user_id = self.env.user.id + self.state = 'sale' + + def action_print_invoice(self): + """Method to print invoice""" + data = self.invoice_ids + return self.env.ref('account.account_invoices').report_action(data) + + @api.model + def get_data(self): + """To get data to the sales dashboard.""" + domain = [('user_id', '=', self.env.user.id)] + quotation = self.env['sale.order'].search( + domain + [('state', '=', 'draft')]) + my_sale_order_templates = self.env['sale.order'].search( + domain + [('state', '=', 'sale')]) + quotation_sent = self.env['sale.order'].search( + domain + [('state', '=', 'sent')]) + quotation_cancel = self.env['sale.order'].search( + domain + [('state', '=', 'cancel')]) + customers = self.env['res.partner'].search([]) + to_invoice = self.env['sale.order'].search( + domain + [('invoice_status', '=', 'to invoice')]) + products = self.env['product.template'].search([]) + return { + 'quotation': len(quotation), + 'my_sale_order_templates': len(my_sale_order_templates), + 'quotation_sent': len(quotation_sent), + 'quotation_cancel': len(quotation_cancel), + 'customers': len(customers), + 'products': len(products), + 'to_invoice': len(to_invoice), + } + + @api.model + def get_value(self, start_date, end_date): + """It is to pass values according to start and end date to the + dashboard.""" + domain = [('user_id', '=', self.env.user.id), + ('date_order', '>=', start_date), + ('date_order', '<=', end_date)] + if start_date and end_date: + quotation = self.env['sale.order'].search( + domain + [('state', '=', 'draft')]) + my_sale_order_templates = self.env['sale.order'].search( + domain + [('state', '=', 'sale')]) + quotation_sent = self.env['sale.order'].search( + domain + [('state', '=', 'sent')]) + quotation_cancel = self.env['sale.order'].search( + domain + [('state', '=', 'cancel')]) + customers = self.env['res.partner'].search([]) + products = self.env['product.template'].search([]) + to_invoice = self.env['sale.order'].search( + domain + [('invoice_status', '=', 'to invoice')]) + elif start_date: + quotation = self.env['sale.order'].search( + domain + [('state', '=', 'draft')]) + my_sale_order_templates = self.env['sale.order'].search( + domain + [('state', '=', 'sale')]) + quotation_sent = self.env['sale.order'].search( + domain + [('state', '=', 'sent')]) + quotation_cancel = self.env['sale.order'].search( + domain + [('state', '=', 'cancel')]) + customers = self.env['res.partner'].search([]) + products = self.env['product.template'].search([]) + to_invoice = self.env['sale.order'].search( + domain + [('invoice_status', '=', 'to invoice')]) + elif end_date: + quotation = self.env['sale.order'].search( + domain + [('state', '=', 'draft')]) + my_sale_order_templates = self.env['sale.order'].search( + domain + [('state', '=', 'sale')]) + quotation_sent = self.env['sale.order'].search( + domain + [('state', '=', 'sent')]) + quotation_cancel = self.env['sale.order'].search( + domain + [('state', '=', 'cancel')]) + customers = self.env['res.partner'].search([]) + products = self.env['product.template'].search([]) + to_invoice = self.env['sale.order'].search( + domain + [('invoice_status', '=', 'to invoice')]) + return { + 'quotation': len(quotation), + 'my_sale_order_templates': len(my_sale_order_templates), + 'quotation_sent': len(quotation_sent), + 'quotation_cancel': len(quotation_cancel), + 'customers': len(customers), + 'products': len(products), + 'to_invoice': len(to_invoice), + } + + @api.model + def get_lead_customer(self): + """Returns customer data to the graph of dashboard""" + lead_template = {} + sale = {} + partner_id = self.env['res.partner'].sudo().search([]) + vals = self.env['sale.order'].sudo().search([ + ]).mapped('partner_id').ids + for record in partner_id: + if record.id in vals: + record.ref = vals.count(record.id) + sale.update({record: vals.count(record.id)}) + sort = dict( + sorted(sale.items(), key=lambda item: item[1], reverse=True)) + out = dict(itertools.islice(sort.items(), 10)) + for count in out: + lead_template[count.name] = out[count] + return { + 'lead_templates': lead_template, + } + + @api.model + def get_lead_product(self): + """Returns product data to the graph of dashboard""" + lead_template = {} + sale = {} + product_id = self.env['product.template'].search([]) + for record in product_id: + sale.update({record: record.sales_count}) + sort = dict( + sorted(sale.items(), key=lambda item: item[1], reverse=True)) + out = dict(itertools.islice(sort.items(), 10)) + for product in out: + lead_template[product.name] = out[product] + return { + 'lead_templates': lead_template, + } + + @api.model + def get_lead_order(self): + """Returns lead sale order data to the graph of dashboard""" + lead_template = {} + sale = {} + order_id = self.env['sale.order'].search([('state', '=', 'sale')]) + for record in order_id: + sale.update({record: record.amount_total}) + sort = dict( + sorted(sale.items(), key=lambda item: item[1], reverse=True)) + out = dict(itertools.islice(sort.items(), 10)) + for order in out: + lead_template[order.name] = out[order] + return { + 'lead_templates': lead_template, + } + + @api.model + def get_my_monthly_comparison(self): + """Returns my monthly sale count data to the graph of dashboard""" + lead_template = {} + sales_order = self.env['sale.order'].search( + [('user_id', '=', self.env.user.id)]) + list = [rec.date_order.month for rec in sales_order] + for i in range(1, 13): + count = list.count(i) + lead_template.update({ + i: count + }) + return { + 'lead_templates': lead_template, + } + + @api.model + def get_sales_team(self): + """Returns sales team data to the graph of dashboard""" + lead_template = {} + sale = {} + sales_team = self.env['crm.team'].search([]) + for record in sales_team: + total = sum(self.env['sale.order'].search( + [('state', '=', 'sale'), + ('team_id', '=', record.id)]).mapped('amount_total')) + sale.update({record: total}) + sort = dict( + sorted(sale.items(), key=lambda item: item[1], reverse=True)) + out = dict(itertools.islice(sort.items(), 10)) + for team in out: + lead_template[team.name] = out[team] + return { + 'lead_templates': lead_template, + } + + @api.model + def get_least_sold(self): + """Returns least sold product data to the graph of dashboard""" + lead_template = {} + sale = {} + product_id = self.env['product.template'].search([]) + for record in product_id: + if record.sales_count != 0: + sale.update({record: record.sales_count}) + sort = dict( + sorted(sale.items(), key=lambda item: item[1], reverse=False)) + out = dict(itertools.islice(sort.items(), 10)) + for product in out: + lead_template[product.name] = out[product] + return { + 'lead_templates': lead_template, + } diff --git a/all_in_one_sales_kit/models/sale_order_line.py b/all_in_one_sales_kit/models/sale_order_line.py new file mode 100644 index 000000000..f4c9c0584 --- /dev/null +++ b/all_in_one_sales_kit/models/sale_order_line.py @@ -0,0 +1,201 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(Order Number | +Order Date | +Invoice Number | +Invoice Date | +Amount Invoiced | +Amount Paid | +Amount Due | +
---|---|---|---|---|---|---|
+ + | ++ + | ++ + | ++ + | +
+
+ |
+
+
+ |
+
+
+ |
+
+ Total invoiced
+ |
+
+ Total paid:
+ |
+
+ Total due:
+ |
+
Sale | +Date Order | +Customer | +Sales Person + | +Total Qty | +Amount Total | +||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+ + | ++ + | ++ + | ++ + | ++ + | ++ + | +||||||||||||||||||||||||||||||
+ | + | + | + | Grand Total | ++ |
Sale | +Date Order | +Customer | +Company | +Sales Person | +Product Name | +Product Code | +Quantity | +Price Subtotal | +Amount Total | +||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+ + | ++ + | ++ + | ++ + | ++ + | ++ + | ++ + | ++ + | ++ + | ++ + | +
Product | +Category | +Product Code + | +Quantity | +Amount Total | +|||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+ + | ++ + | ++ + | ++ + | ++ + | +
Category | +Qty | +Amount Total | +|||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+ + | ++ + | ++ + | +
Sales Person | +Total Order | +Total Qty | +Total Amount | +|||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+ + | ++ + | ++ + | ++ + | +
State | +Total Count | +Quantity | +Amount | +||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+ |
+ + + | ++ + | ++ + | +
Order | +Date | +Product | +Quantity | +Cost | +Sale Price | +Profit | +Margin(%) | +
---|---|---|---|---|---|---|---|
+ + | ++ + | ++ + | ++ + | +
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+ Total cost
+ |
+
+ Total Price:
+ |
+
+ Total Profit:
+ |
+
+ Total margin:
+ |
+
Order | +Date | +Customer | +Quantity | +Cost | +Sale Price | +Profit | +Margin(%) | +
---|---|---|---|---|---|---|---|
+ + | ++ + | ++ + | ++ + | +
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+ Total cost
+ |
+
+ Total Price:
+ |
+
+ Total Profit:
+ |
+
+ Total margin:
+ |
+
Order | +Date | +Customer | +Product | +Quantity | +Cost | +Sale Price | +Profit | +Margin(%) | +
---|---|---|---|---|---|---|---|---|
+ + | ++ + | ++ + | ++ + | ++ + | +
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+ Total cost
+ |
+
+ Total Price:
+ |
+
+ Total Profit:
+ |
+
+ Total margin:
+ |
+
Order | +Date | +Customer | +Product | +Quantity | +Cost | +Sale Price | +Profit | +Margin(%) | +
---|---|---|---|---|---|---|---|---|
+ + | ++ + | ++ + | ++ + | ++ + | +
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+ Total cost
+ |
+
+ Total Price:
+ |
+
+ Total Profit:
+ |
+
+ Total margin:
+ |
+
Order Number | +Order Date | +Sales Person | +Sales Amount | +Amount Paid | +Balance | +
---|---|---|---|---|---|
+ + | ++ + | ++ + | +
+
+ |
+
+
+ |
+
+
+ |
+
+ Total Amount
+ |
+
+ Total Paid:
+ |
+
+ Total Balance:
+ |
+
Order | +Date | +Product | +Quantity | +price | +Discount(%) | +Tax(%) | +Subtotal | +
---|---|---|---|---|---|---|---|
+ + | ++ + | ++ + | +
+
+ |
+
+
+ |
+
+
+ |
+ + + | +
+
+ |
+
+ Total Quantity
+ |
+
+ Total Price:
+ |
+
+ Total Discount:
+ |
+
+ Subtotal
+ |
+
Order | +Date | +Product | +Quantity | +UOM | +Price | +Tax(%) | +Subtotal | +Total | +
---|---|---|---|---|---|---|---|---|
+ + | ++ + | ++ + | +
+
+ |
+ + + | +
+
+ |
+ + + | +
+
+ |
+
+
+ |
+
+ Total Quantity
+ |
+
+ Total Price:
+ |
+
+ Total Subtotal:
+ |
+
+ Total Total:
+ |
+
Product | +Quantity | +
---|---|
+ + | ++ + | +
Order Number | +Order Date | +Untaxed Total | +Total | +
---|---|---|---|
+ + | ++ + | +
+
+ |
+ |
+
+ Total Amount
+
+ |
+
+ This Module Combines A Variety Of Sales Features.
+ ++ To filter the tile values, choose a start date and an end + date.
+ + + + + ++ Go to settings -> Enable Show product image in report under + product catalog to print image in the send report. + We can add product image in order line in sale order. We can + view these images on the quotation send to customer also. +
+ + + + + ++ Different sale analysis reports are available. +
+ + + + + ++ Go to products -> Product Pack.We can create new product + packages here. While creating one 'is a pack will be enabled' + also a new page to add products under this pack is + available.From there itself pack price and pack quantity will + be known.While creating a new quotation we can add the product + pack using the button 'Add product pack'. +
+ + + + + ++ Go to settings -> Enable Sale Document Approve to make + salesperson's signature to confirm sale order.Only after adding + sales person's signature confirm button will become visible. +
+ + + + + ++ Two new buttons are available to know previous sales rate of a + product and customer product report for a product selected from + the order line. +
+ + + + + ++ Different sale orders versions can be created using the 'create + version' button,and they can be viewed from the smart tab + 'version'.If one of the versions are confirmed the remaining + will automatically move to cancelled state. +
+ + + + + ++ Go to users -> Enable Create custom fields in sale,Go to + sale->configuration -> create fields a wizard to daa features + of new field is shown fill the requirements and apply 'create' + to create custom fields in sale order form view. +
+ + + + + ++ Quotation sequence is generated while creating a new + quotation.Also in the order lines different warehouses can be + chosen for different products and delivery orders for multiple + warehouses are created separately. +
+ + + + + ++ Orders -> Quotation line views , this will show all the + quotation lines with product image.Orders -> Order line + views , this will show all the order lines with product image. +
+ + + + + ++ Go to users -> Select Sale order discount approval as Discount + approval manager,Go under Discount control enable discount + control , set discount limit in percentage.While confirming a + sale order if the discount is greater than allowed discount + limit then the order moves to waiting for approval state and + the discount approval manager can decide whether to choose or + cancel the order. +
+ + + + + ++ Go to settings -> Choose the grounds on which the stock + restriction should be implemented.While confirming the sale + order if the restriction enabled prevails then error message is + shown.By selecting Add to catalog , we are directed to the + product view and using add quotation button the products are + added to the current sale order lines. +
+ + + + + ++ Orders -> Customer -> sales smart tab we can get sales analysis + of that customer in pivot view also.Select a sale order -> + Action -> archive by using this we can archive a sale order and + using unarchive option under it, we can unarchive the archived + sale orders.In the filters option we can filter archived sale + orders.Products -> General information we can enter the + product's barcode,and we just need to scan the barcode of the + product to enter the product to sale order line. +
+ + + + + ++ Easily procure + and + sell your products
++ Easy + configuration + and convivial experience
++ A platform for + educational management
++ Plan, track and + schedule your operations
++ Mobile + friendly, + awe-inspiring product pages
++ Keep track of + services and invoice
++ Run your bar or + restaurant methodically
++ An + all-inclusive + hotel management application
+Order | +Date Order | +Customer | +Sales Representative | +Total Qty | +Amount Total | +Note | +
---|---|---|---|---|---|---|
+
+
+
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
Order | +Date Order | +Customer | +Sales Representative | +Product Code | +Product Name | +Price unit | +Qty | +Price Subtotal | +
---|---|---|---|---|---|---|---|---|
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+
+ |
+
+
+ |
+
Category | +Product Code | +Product Name | +Qty | +Amount Total | +
---|---|---|---|---|
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
Category | +Qty | +Amount Total | +
---|---|---|
+
+
+ |
+
+
+ |
+
+
+ |
+
Sales Representative | +Total Order | +Total Qty | +Total Amount | +
---|---|---|---|
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
State | +Total Count | +Quantity | +Amount | +
---|---|---|---|
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+ There is no product pack to show...! +
+