Browse Source

Jan 25 [UPDT] : Bug Fixed 'stock_move_invoice'

pull/254/head
AjmalCybro 2 years ago
parent
commit
0c526bd435
  1. 2
      stock_move_invoice/__manifest__.py
  2. 105
      stock_move_invoice/models/stock_picking.py

2
stock_move_invoice/__manifest__.py

@ -22,7 +22,7 @@
{ {
'name': "Invoice From Stock Picking", 'name': "Invoice From Stock Picking",
'version': '15.0.1.0.0', 'version': '15.0.1.0.1',
'summary': """In this module creating customer invoice,vendor bill, customer 'summary': """In this module creating customer invoice,vendor bill, customer
credit note and refund from stock picking""", credit note and refund from stock picking""",
'description': """In this module creating customer invoice,vendor bill, customer 'description': """In this module creating customer invoice,vendor bill, customer

105
stock_move_invoice/models/stock_picking.py

@ -60,19 +60,20 @@ class StockPicking(models.Model):
'quantity': move_ids_without_package.quantity_done, 'quantity': move_ids_without_package.quantity_done,
}) })
invoice_line_list.append(vals) invoice_line_list.append(vals)
invoice = picking_id.env['account.move'].create({
'move_type': 'out_invoice', invoice = picking_id.env['account.move'].create({
'invoice_origin': picking_id.name, 'move_type': 'out_invoice',
'invoice_user_id': current_user, 'invoice_origin': picking_id.name,
'narration': picking_id.name, 'invoice_user_id': current_user,
'partner_id': picking_id.partner_id.id, 'narration': picking_id.name,
'currency_id': picking_id.env.user.company_id.currency_id.id, 'partner_id': picking_id.partner_id.id,
'journal_id': int(customer_journal_id), 'currency_id': picking_id.env.user.company_id.currency_id.id,
'payment_reference': picking_id.name, 'journal_id': int(customer_journal_id),
'picking_id': picking_id.id, 'payment_reference': picking_id.name,
'invoice_line_ids': invoice_line_list 'picking_id': picking_id.id,
}) 'invoice_line_ids': invoice_line_list
return invoice })
return invoice
def create_bill(self): def create_bill(self):
"""This is the function for creating vendor bill """This is the function for creating vendor bill
@ -96,19 +97,19 @@ class StockPicking(models.Model):
'quantity': move_ids_without_package.quantity_done, 'quantity': move_ids_without_package.quantity_done,
}) })
invoice_line_list.append(vals) invoice_line_list.append(vals)
invoice = picking_id.env['account.move'].create({ invoice = picking_id.env['account.move'].create({
'move_type': 'in_invoice', 'move_type': 'in_invoice',
'invoice_origin': picking_id.name, 'invoice_origin': picking_id.name,
'invoice_user_id': current_user, 'invoice_user_id': current_user,
'narration': picking_id.name, 'narration': picking_id.name,
'partner_id': picking_id.partner_id.id, 'partner_id': picking_id.partner_id.id,
'currency_id': picking_id.env.user.company_id.currency_id.id, 'currency_id': picking_id.env.user.company_id.currency_id.id,
'journal_id': int(vendor_journal_id), 'journal_id': int(vendor_journal_id),
'payment_reference': picking_id.name, 'payment_reference': picking_id.name,
'picking_id': picking_id.id, 'picking_id': picking_id.id,
'invoice_line_ids': invoice_line_list 'invoice_line_ids': invoice_line_list
}) })
return invoice return invoice
def create_customer_credit(self): def create_customer_credit(self):
"""This is the function for creating customer credit note """This is the function for creating customer credit note
@ -132,19 +133,19 @@ class StockPicking(models.Model):
'quantity': move_ids_without_package.quantity_done, 'quantity': move_ids_without_package.quantity_done,
}) })
invoice_line_list.append(vals) invoice_line_list.append(vals)
invoice = picking_id.env['account.move'].create({ invoice = picking_id.env['account.move'].create({
'move_type': 'out_refund', 'move_type': 'out_refund',
'invoice_origin': picking_id.name, 'invoice_origin': picking_id.name,
'invoice_user_id': current_user, 'invoice_user_id': current_user,
'narration': picking_id.name, 'narration': picking_id.name,
'partner_id': picking_id.partner_id.id, 'partner_id': picking_id.partner_id.id,
'currency_id': picking_id.env.user.company_id.currency_id.id, 'currency_id': picking_id.env.user.company_id.currency_id.id,
'journal_id': int(customer_journal_id), 'journal_id': int(customer_journal_id),
'payment_reference': picking_id.name, 'payment_reference': picking_id.name,
'picking_id': picking_id.id, 'picking_id': picking_id.id,
'invoice_line_ids': invoice_line_list 'invoice_line_ids': invoice_line_list
}) })
return invoice return invoice
def create_vendor_credit(self): def create_vendor_credit(self):
"""This is the function for creating refund """This is the function for creating refund
@ -168,19 +169,19 @@ class StockPicking(models.Model):
'quantity': move_ids_without_package.quantity_done, 'quantity': move_ids_without_package.quantity_done,
}) })
invoice_line_list.append(vals) invoice_line_list.append(vals)
invoice = picking_id.env['account.move'].create({ invoice = picking_id.env['account.move'].create({
'move_type': 'in_refund', 'move_type': 'in_refund',
'invoice_origin': picking_id.name, 'invoice_origin': picking_id.name,
'invoice_user_id': current_user, 'invoice_user_id': current_user,
'narration': picking_id.name, 'narration': picking_id.name,
'partner_id': picking_id.partner_id.id, 'partner_id': picking_id.partner_id.id,
'currency_id': picking_id.env.user.company_id.currency_id.id, 'currency_id': picking_id.env.user.company_id.currency_id.id,
'journal_id': int(vendor_journal_id), 'journal_id': int(vendor_journal_id),
'payment_reference': picking_id.name, 'payment_reference': picking_id.name,
'picking_id': picking_id.id, 'picking_id': picking_id.id,
'invoice_line_ids': invoice_line_list 'invoice_line_ids': invoice_line_list
}) })
return invoice return invoice
def action_open_picking_invoice(self): def action_open_picking_invoice(self):
"""This is the function of the smart button which redirect to the """This is the function of the smart button which redirect to the

Loading…
Cancel
Save