mirror of
https://gitlab.com/sonalarora/tra_backend.git
synced 2025-12-17 10:19:09 +02:00
work on report
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -40,6 +40,7 @@
|
||||
"purchase_report/modern_report_purchasequotation.xml",
|
||||
"purchase_report/odoo_standard_report_purchaseorder.xml",
|
||||
"purchase_report/odoo_standard_report_purchasequotation.xml",
|
||||
|
||||
|
||||
"sale_report/classic_report_saleorder.xml",
|
||||
"sale_report/fency_report_saleorder.xml",
|
||||
|
||||
@@ -140,7 +140,6 @@
|
||||
<tbody>
|
||||
<tr t-foreach="o.move_lines" t-as="move">
|
||||
<td>
|
||||
<!--<t t-esc="move+1"></t>-->
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
@@ -198,7 +197,7 @@
|
||||
<tbody>
|
||||
<tr t-foreach="o.move_line_ids" t-as="move_line">
|
||||
<td>
|
||||
<t t-esc="move_line+1"></t>
|
||||
<!--<t t-esc="move_line+1"></t>-->
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
|
||||
@@ -11,9 +11,9 @@ class AccountInvoice(models.Model):
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
res = super(AccountInvoice, self).create(vals)
|
||||
order_id = self.env['sale.order'].search([('name', '=', res.origin)])
|
||||
order_id = self.env['sale.order'].search([('name', '=', res.name)])
|
||||
if not order_id:
|
||||
order_id = self.env['purchase.order'].search([('name', '=', res.origin)])
|
||||
order_id = self.env['purchase.order'].search([('name', '=', res.name)])
|
||||
if order_id and order_id.intercompany_transfer_id:
|
||||
res.intercompany_transfer_id = order_id.intercompany_transfer_id.id
|
||||
return res
|
||||
|
||||
@@ -193,11 +193,11 @@ class InterCompanyTransfer(models.Model):
|
||||
if configuration_record.auto_confirm_orders:
|
||||
for order in sale_orders:
|
||||
order.write({'origin':record.name or ''})
|
||||
order.sudo(sale_user_id).action_confirm()
|
||||
order.with_user(sale_user_id).action_confirm()
|
||||
|
||||
for order in purchase_orders:
|
||||
order.write({'origin':record.name or ''})
|
||||
order.sudo(purchase_user_id).button_confirm()
|
||||
order.with_user(purchase_user_id).button_confirm()
|
||||
|
||||
|
||||
|
||||
@@ -207,11 +207,11 @@ class InterCompanyTransfer(models.Model):
|
||||
context = {"active_model": 'sale.order', "active_ids": [order.id], "active_id": order.id, 'open_invoices':True}
|
||||
if sale_journal:
|
||||
context.update({'default_journal_id':sale_journal.id})
|
||||
payment_id = sale_advance_paymentobj.sudo(sale_user_id).create({'advance_payment_method': 'delivered'})
|
||||
result = payment_id.with_context(context).sudo(sale_user_id).create_invoices()
|
||||
payment_id = sale_advance_paymentobj.with_user(sale_user_id).create({'advance_payment_method': 'delivered'})
|
||||
result = payment_id.with_context(context).with_user(sale_user_id).create_invoices()
|
||||
result = result.get('res_id', False)
|
||||
invoice_id = invoice_obj.sudo(sale_user_id).browse(result)
|
||||
invoice_id.sudo(sale_user_id).write({'date_invoice':str(datetime.today()), 'intercompany_transfer_id':self.id})
|
||||
invoice_id = invoice_obj.with_user(sale_user_id).browse(result)
|
||||
invoice_id.with_user(sale_user_id).write({'date_invoice':str(datetime.today()), 'intercompany_transfer_id':self.id})
|
||||
|
||||
|
||||
vendor_bill_id = False
|
||||
@@ -221,26 +221,26 @@ class InterCompanyTransfer(models.Model):
|
||||
context.update({'default_journal_id':record.destination_company_id.purchase_journal.id})
|
||||
|
||||
invoice_dict = self.prepare_invoice_dict(record, purchase_partner_id, porder)
|
||||
invoice_vals = invoice_obj.sudo(purchase_user_id).with_context(context).new(invoice_dict)
|
||||
invoice_vals = invoice_obj.with_user(purchase_user_id).with_context(context).new(invoice_dict)
|
||||
invoice_vals.purchase_id = porder.id
|
||||
invoice_vals.journal_id = invoice_vals.sudo(purchase_user_id)._default_journal()
|
||||
invoice_vals.sudo(purchase_user_id).purchase_order_change()
|
||||
invoice_vals.sudo(purchase_user_id)._onchange_partner_id()
|
||||
invoice_vals.journal_id = invoice_vals.with_user(purchase_user_id)._default_journal()
|
||||
invoice_vals.with_user(purchase_user_id).purchase_order_change()
|
||||
invoice_vals.with_user(purchase_user_id)._onchange_partner_id()
|
||||
invoice_vals.date_invoice = str(datetime.today())
|
||||
invoice_vals.sudo(purchase_user_id)._onchange_payment_term_date_invoice()
|
||||
invoice_vals.sudo(purchase_user_id)._onchange_origin()
|
||||
invoice_vals.with_user(purchase_user_id)._onchange_payment_term_date_invoice()
|
||||
invoice_vals.with_user(purchase_user_id)._onchange_origin()
|
||||
invoice_vals.currency_id = record.currency_id
|
||||
|
||||
for line in invoice_vals.invoice_line_ids:
|
||||
line.quantity = line.purchase_line_id and line.purchase_line_id.product_qty or 0.0
|
||||
line.sudo(purchase_user_id)._compute_price()
|
||||
line.with_user(purchase_user_id)._compute_price()
|
||||
|
||||
vendor_bill_id = invoice_obj.sudo(purchase_user_id).with_context({'type':'in_invoice'}).create(invoice_vals._convert_to_write(invoice_vals._cache))
|
||||
vendor_bill_id.intercompany_transfer_id = self.id
|
||||
|
||||
if configuration_record.auto_validate_invoices:
|
||||
invoice_id.sudo(sale_user_id).action_invoice_open()
|
||||
vendor_bill_id.sudo(purchase_user_id).action_invoice_open()
|
||||
invoice_id.with_user(sale_user_id).action_invoice_open()
|
||||
vendor_bill_id.with_user(purchase_user_id).action_invoice_open()
|
||||
|
||||
record.write({'state':'processed', 'processed_date':datetime.today(), 'message':'ICT processed successfully by %s' % (self.env.user.name)})
|
||||
|
||||
@@ -272,6 +272,7 @@ class InterCompanyTransfer(models.Model):
|
||||
|
||||
|
||||
def create_internal_transfer(self):
|
||||
procurements = []
|
||||
picking_obj = self.env['stock.picking']
|
||||
procurementgroup_obj = self.env['procurement.group']
|
||||
stocklocation_route_obj = self.env['stock.location.route']
|
||||
@@ -282,13 +283,24 @@ class InterCompanyTransfer(models.Model):
|
||||
group_id = procurementgroup_obj.create({'name': self.name, 'partner_id': dest_wh.partner_id.id})
|
||||
self.group_id = group_id.id
|
||||
route_ids = stocklocation_route_obj.search([('supplied_wh_id', '=', dest_wh.id), ('supplier_wh_id', '=', source_wh.id)])
|
||||
print('routeuuuuuuuuuuuuuuuuuuuuuuuuu',route_ids)
|
||||
if not route_ids:
|
||||
raise ValidationError(_("No routes are found. \n Please configure warehouse routes and set in products."))
|
||||
if not self.intercompany_transferline_ids :
|
||||
raise ValidationError(_("No Products found. \n Please add products to transfer."))
|
||||
|
||||
for line in self.intercompany_transferline_ids:
|
||||
procurementgroup_obj.run(line.product_id, line.quantity, line.product_id.uom_id, dest_wh.lot_stock_id, self.name, False, values={'warehouse_id':dest_wh, 'route_ids':route_ids and route_ids[0], 'group_id':self.group_id})
|
||||
print('comppppppppppppppppp',self.source_warehouse_id.company_id)
|
||||
#values={'warehouse_id':dest_wh, 'route_ids':route_ids and route_ids[0], 'group_id':self.group_id,'product_id':line.product_id.id,'qty_rounded':line.quantity,'product_uom':line.product_id.uom_id,'location_id':dest_wh.lot_stock_id,'name':self.name,'company_id':self.source_company_id.id }
|
||||
#procurementgroup_obj.run([values])
|
||||
values={'warehouse_id':dest_wh, 'route_ids':route_ids and route_ids[0], 'group_id':self.group_id}
|
||||
#procurementgroup_obj.run(line.product_id, line.quantity, line.product_id.uom_id, dest_wh.lot_stock_id, self.name, False, values)
|
||||
procurements.append(self.env['procurement.group'].Procurement(
|
||||
line.product_id,line.quantity,line.product_id.uom_id,dest_wh.lot_stock_id,self.name,'abc',self.source_company_id,values
|
||||
|
||||
))
|
||||
procurementgroup_obj.run(procurements)
|
||||
print('lllllllllllllll',procurementgroup_obj)
|
||||
|
||||
|
||||
pickings = picking_obj.search([('group_id', '=', group_id.id)])
|
||||
@@ -317,25 +329,25 @@ class InterCompanyTransfer(models.Model):
|
||||
source_warehouse_id = record.source_warehouse_id
|
||||
intercompany_user = source_company.sudo().intercompany_user_id.id or False
|
||||
partner_id = record.destination_company_id.sudo().partner_id
|
||||
order_vals = sale_obj.sudo(intercompany_user).new({'partner_id':partner_id.id, 'warehouse_id':source_warehouse_id.id, 'pricelist_id':self.price_list_id.id})
|
||||
order_vals.sudo(intercompany_user).onchange_partner_id()
|
||||
order_vals = sale_obj.with_user(intercompany_user).new({'partner_id':partner_id.id, 'warehouse_id':source_warehouse_id.id, 'pricelist_id':self.price_list_id.id})
|
||||
order_vals.with_user(intercompany_user).onchange_partner_id()
|
||||
order_vals.warehouse_id = source_warehouse_id.id
|
||||
order_vals.sudo(intercompany_user)._onchange_company_id()
|
||||
order_vals.fiscal_position_id = partner_id.sudo(intercompany_user).property_account_position_id.id
|
||||
order_vals.with_user(intercompany_user)._onchange_company_id()
|
||||
order_vals.fiscal_position_id = partner_id.with_user(intercompany_user).property_account_position_id.id
|
||||
order_vals.pricelist_id = self.price_list_id.id
|
||||
if record.crm_team_id:
|
||||
order_vals.team_id = record.crm_team_id.id
|
||||
order_vals = order_vals.sudo(intercompany_user)
|
||||
sale_order = sale_obj.sudo(intercompany_user).create(order_vals._convert_to_write(order_vals._cache))
|
||||
order_vals = order_vals.with_user(intercompany_user)
|
||||
sale_order = sale_obj.with_user(intercompany_user).create(order_vals._convert_to_write(order_vals._cache))
|
||||
so_lines_list = []
|
||||
for line in record.intercompany_transferline_ids:
|
||||
line_vals = saleline_obj.sudo(intercompany_user).new({'order_id':sale_order.id, 'product_id':line.product_id})
|
||||
line_vals.sudo(intercompany_user).product_id_change()
|
||||
line_vals.sudo(intercompany_user).product_uom_qty = line.quantity
|
||||
line_vals = saleline_obj.with_user(intercompany_user).new({'order_id':sale_order.id, 'product_id':line.product_id})
|
||||
line_vals.with_user(intercompany_user).product_id_change()
|
||||
line_vals.with_user(intercompany_user).product_uom_qty = line.quantity
|
||||
line_vals.price_unit = line.price
|
||||
line_vals = line_vals.sudo(intercompany_user)._convert_to_write(line_vals._cache)
|
||||
line_vals = line_vals.with_user(intercompany_user)._convert_to_write(line_vals._cache)
|
||||
so_lines_list.append((0, 0, line_vals))
|
||||
sale_order.sudo(intercompany_user).write({'order_line':so_lines_list, 'intercompany_transfer_id':record.id})
|
||||
sale_order.with_user(intercompany_user).write({'order_line':so_lines_list, 'intercompany_transfer_id':record.id})
|
||||
so_list.append(sale_order)
|
||||
|
||||
return so_list
|
||||
@@ -349,22 +361,25 @@ class InterCompanyTransfer(models.Model):
|
||||
destination_company = record.destination_company_id
|
||||
intercompany_user = destination_company.sudo().intercompany_user_id.id or False
|
||||
print('intercompany_user$$$$$$$$$$$$$$$$$$$$$$',intercompany_user)
|
||||
order_vals = purchase_obj.sudo(intercompany_user).new({'currency_id':self.currency_id.id, 'partner_id':record.source_warehouse_id.sudo().company_id.partner_id.id, 'company_id':destination_company.id})
|
||||
order_vals.sudo(intercompany_user).onchange_partner_id()
|
||||
order_vals = purchase_obj.with_user(intercompany_user).new({'currency_id':self.currency_id.id, 'partner_id':record.source_warehouse_id.sudo().company_id.partner_id.id, 'company_id':destination_company.id})
|
||||
print('partner_idtest++++++++++++++++++', record.source_warehouse_id.sudo().company_id.partner_id.id)
|
||||
order_vals.with_user(intercompany_user).onchange_partner_id()
|
||||
print('order_valse+++++++++++++++', order_vals)
|
||||
order_vals.currency_id = self.currency_id.id
|
||||
order_vals.picking_type_id = self.destination_warehouse_id.sudo().in_type_id
|
||||
purchase_order_id = purchase_obj.sudo(intercompany_user).create(order_vals.sudo(intercompany_user)._convert_to_write(order_vals._cache))
|
||||
purchase_order_id = purchase_obj.with_user(intercompany_user).create(order_vals.with_user(intercompany_user)._convert_to_write(order_vals._cache))
|
||||
po_lines_list = []
|
||||
for line in record.intercompany_transferline_ids:
|
||||
line_vals = purchase_line_obj.sudo(intercompany_user).new({'order_id':purchase_order_id.id, 'product_id':line.product_id, 'currency_id':self.currency_id})
|
||||
line_vals.sudo(intercompany_user).onchange_product_id()
|
||||
line_vals = purchase_line_obj.with_user(intercompany_user).new({'order_id':purchase_order_id.id, 'product_id':line.product_id, 'currency_id':self.currency_id})
|
||||
line_vals.with_user(intercompany_user).onchange_product_id()
|
||||
line_vals.product_qty = line.quantity
|
||||
line_vals.price_unit = line.price
|
||||
line_vals.product_uom = line.product_id.uom_id
|
||||
line_vals = line_vals.sudo(intercompany_user)._convert_to_write(line_vals._cache)
|
||||
line_vals = line_vals.with_user(intercompany_user)._convert_to_write(line_vals._cache)
|
||||
po_lines_list.append((0, 0, line_vals))
|
||||
purchase_order_id.sudo(intercompany_user).write({'order_line':po_lines_list, 'intercompany_transfer_id':record.id})
|
||||
purchase_order_id.with_user(intercompany_user).write({'order_line':po_lines_list, 'intercompany_transfer_id':record.id})
|
||||
po_list.append(purchase_order_id)
|
||||
print('po_list+++++++++++++++++++++',po_list,purchase_order_id)
|
||||
|
||||
return po_list
|
||||
|
||||
@@ -381,7 +396,7 @@ class InterCompanyTransfer(models.Model):
|
||||
|
||||
def action_reverse_process(self):
|
||||
stockreturn_picking_obj = self.env['stock.return.picking']
|
||||
accountinvoice_refund_obj = self.env['account.invoice.refund']
|
||||
accountinvoice_refund_obj = self.env['account.move']
|
||||
stock_move_obj = self.env['stock.move']
|
||||
stock_picking_obj = self.env['stock.picking']
|
||||
account_invoice_obj = self.env['account.move']
|
||||
@@ -470,12 +485,12 @@ class InterCompanyTransfer(models.Model):
|
||||
for sorder in self.intercompany_transfer_id.saleorder_ids:
|
||||
for invoice in sorder.invoice_ids.filtered(lambda inv : inv.type == 'out_invoice'):
|
||||
customer_invoice_id = invoice.search([('refund_invoice_id', '=', invoice.id)], order='id desc' , limit=1)
|
||||
default_inovoice_vals = accountinvoice_refund_obj.with_context({'active_id':invoice.id}).default_get(['filter_refund', 'description', 'date_invoice', 'date'])
|
||||
default_inovoice_vals = accountinvoice_refund_obj.with_context({'active_id':invoice.id,'type':'out_refund'}).default_get(['filter_refund', 'description', 'date_invoice', 'date'])
|
||||
configuration_record = self.env.ref('intercompany_transaction_ept.intercompany_transaction_config_record')
|
||||
if configuration_record.filter_refund:
|
||||
default_inovoice_vals['filter_refund'] = configuration_record.filter_refund
|
||||
default_inovoice_vals.update({'description':'%s' % (configuration_record and configuration_record.description or ('for %s' % self.name))})
|
||||
customer_refund = accountinvoice_refund_obj.with_context({'active_id':invoice.id}).create(default_inovoice_vals)
|
||||
customer_refund = accountinvoice_refund_obj.with_context({'active_id':invoice.id,'type':'out_refund'}).create(default_inovoice_vals)
|
||||
if customer_refund.with_context({'active_ids':invoice.id}).invoice_refund():
|
||||
invoice_id = account_invoice_obj.search([('refund_invoice_id', '=', invoice.id)], order='id desc', limit=1)
|
||||
if invoice_id:
|
||||
@@ -490,12 +505,12 @@ class InterCompanyTransfer(models.Model):
|
||||
|
||||
for porder in self.intercompany_transfer_id.purchaseorder_ids:
|
||||
for vendor_invoice in porder.invoice_ids.filtered(lambda inv : inv.type == 'in_invoice'):
|
||||
default_inovoice_vals = accountinvoice_refund_obj.with_context({'active_id':vendor_invoice.id}).default_get(['filter_refund', 'description', 'date_invoice', 'date'])
|
||||
default_inovoice_vals = accountinvoice_refund_obj.with_context({'active_id':vendor_invoice.id,'type':'in_refund'}).default_get(['filter_refund', 'description', 'date_invoice', 'date'])
|
||||
configuration_record = self.env.ref('intercompany_transaction_ept.intercompany_transaction_config_record')
|
||||
if configuration_record.filter_refund:
|
||||
default_inovoice_vals['filter_refund'] = configuration_record.filter_refund
|
||||
default_inovoice_vals.update({'description':'%s' % (configuration_record and configuration_record.description or ('for %s' % self.name))})
|
||||
vendor_refund = accountinvoice_refund_obj.with_context({'active_id':vendor_invoice.id}).create(default_inovoice_vals)
|
||||
vendor_refund = accountinvoice_refund_obj.with_context({'active_id':vendor_invoice.id,'type':'in_refund'}).create(default_inovoice_vals)
|
||||
invoice_id = False
|
||||
if vendor_refund.with_context({'active_ids':vendor_invoice.id}).invoice_refund():
|
||||
invoice_id = account_invoice_obj.search([('refund_invoice_id', '=', vendor_invoice.id)], order='id desc', limit=1)
|
||||
|
||||
@@ -13,9 +13,9 @@ class SaleOrder(models.Model):
|
||||
|
||||
def _prepare_invoice(self):
|
||||
if self.intercompany_transfer_id:
|
||||
journal_id = self.env['account.invoice'].default_get(['journal_id'])['journal_id']
|
||||
journal_id = self.env['account.move'].default_get(['journal_id'])['journal_id']
|
||||
vals = super(SaleOrder, self.with_context({'journal_id':journal_id}))._prepare_invoice()
|
||||
return vals
|
||||
else:
|
||||
vals = super(SaleOrder, self)._prepare_invoice()
|
||||
return vals
|
||||
return vals
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -10,7 +10,7 @@
|
||||
'maintainer': '',
|
||||
'website': "",
|
||||
'depends': [
|
||||
'base', 'account', 'bi_professional_reports_templates'
|
||||
'base','report', 'account', 'bi_professional_reports_templates'
|
||||
],
|
||||
'data': [
|
||||
'views/invoice_report.xml',
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -10,7 +10,7 @@
|
||||
<field name="page_height">0</field>
|
||||
<field name="page_width">0</field>
|
||||
<field name="orientation">Portrait</field>
|
||||
<field name="margin_top">8</field>
|
||||
<field name="margin_top">30</field>
|
||||
<field name="margin_bottom">0</field>
|
||||
<field name="margin_left">3</field>
|
||||
<field name="margin_right">0</field>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<t t-call="web.external_layout">
|
||||
<t t-set="o" t-value="o.with_context(lang=lang)"/>
|
||||
<div class="page">
|
||||
<h2 style=" background-color: #3498DB;"><font color="#fff">Cash/Check Payment Voucher<span t-field="o.name"/></font></h2>
|
||||
<h2 style=" background-color: #3498DB;"><font color="#fff">Cash/Cheque Payment Voucher<span t-field="o.name"/></font></h2>
|
||||
<table class="table table-sm">
|
||||
<tr>
|
||||
<th style="border:1px solid;width:50%;top:2px">
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -10,7 +10,7 @@ class AccountMove(models.Model):
|
||||
|
||||
|
||||
# ==== Business fields ====
|
||||
overdue_by = fields.Float(string='Overdue By', index=True, compute='calculate_overdue_date')
|
||||
overdue_by = fields.Float(string='Overdue By', index=True)#, compute='calculate_overdue_date')
|
||||
|
||||
|
||||
def calculate_overdue_date(self):
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user