Browse Source

[FIX] Bug Fixed 'invoice_stock_move'

pull/135/head
Ajmal JK 6 years ago
parent
commit
bd69b71157
  1. 2
      invoice_stock_move/__manifest__.py
  2. 6
      invoice_stock_move/doc/RELEASE_NOTES.md
  3. 79
      invoice_stock_move/models/invoice_stock.py

2
invoice_stock_move/__manifest__.py

@ -21,7 +21,7 @@
#############################################################################
{
'name': "Stock Picking From Invoice",
'version': '13.0.1.1.1',
'version': '13.0.1.1.2',
'summary': """Stock Picking From Customer/Supplier Invoice""",
'description': """This Module Enables To Create Stocks Picking From Customer/Supplier Invoice""",
'author': "Cybrosys Techno Solutions",

6
invoice_stock_move/doc/RELEASE_NOTES.md

@ -11,3 +11,9 @@ Initial Commit
#### FIX
Delivery and Receipts Bug fixed.
#### 30.01.2020
#### Version 13.0.1.1.2
#### FIX
Bug fixed.

79
invoice_stock_move/models/invoice_stock.py

@ -58,18 +58,24 @@ class InvoiceStockMove(models.Model):
def action_stock_move(self):
for order in self:
if not self.picking_type_id.default_location_dest_id:
raise UserError(_(
" Please set Default Destination Location"))
if not self.invoice_picking_id:
pick = {
'picking_type_id': self.picking_type_id.id,
'partner_id': self.partner_id.id,
'origin': self.name,
'location_dest_id': self.picking_type_id.default_location_dest_id.id,
'location_id': self.partner_id.property_stock_supplier.id
}
if self.picking_type_id.code =='outgoing':
pick = {
'picking_type_id': self.picking_type_id.id,
'partner_id': self.partner_id.id,
'origin': self.name,
'location_dest_id': self.partner_id.property_stock_customer.id,
'location_id': self.picking_type_id.default_location_src_id.id
}
if self.picking_type_id.code =='incoming':
pick = {
'picking_type_id': self.picking_type_id.id,
'partner_id': self.partner_id.id,
'origin': self.name,
'location_dest_id': self.picking_type_id.default_location_dest_id.id,
'location_id': self.partner_id.property_stock_supplier.id
}
picking = self.env['stock.picking'].create(pick)
self.invoice_picking_id = picking.id
self.picking_count = len(picking)
@ -92,7 +98,7 @@ class InvoiceStockMove(models.Model):
return result
def action_post(self):
if not self.picking_type_id:
if not self.picking_type_id :
raise UserError(_(
" Please select a picking type"))
res = super(InvoiceStockMove, self).action_post()
@ -107,7 +113,6 @@ class InvoiceStockMove(models.Model):
('type' & 'reversed_entry_id' are computed in the method).
:return: An account.move recordset, reverse of the current self.
'''
print("Reverse moves", self.picking_type_id)
if self.picking_type_id.code == 'outgoing':
data = self.env['stock.picking.type'].search([('company_id', '=', self.company_id.id),('code', '=', 'incoming')], limit=1)
@ -127,22 +132,38 @@ class SupplierInvoiceLine(models.Model):
done = self.env['stock.move'].browse()
for line in self:
price_unit = line.price_unit
template = {
'name': line.name or '',
'product_id': line.product_id.id,
'product_uom': line.product_uom_id.id,
'location_id': line.move_id.partner_id.property_stock_supplier.id,
'location_dest_id': picking.picking_type_id.default_location_dest_id.id,
'picking_id': picking.id,
'state': 'draft',
'company_id': line.move_id.company_id.id,
'price_unit': price_unit,
'picking_type_id': picking.picking_type_id.id,
'route_ids': 1 and [
(6, 0, [x.id for x in self.env['stock.location.route'].search([('id', 'in', (2, 3))])])] or [],
'warehouse_id': picking.picking_type_id.warehouse_id.id,
}
print(template['route_ids'], "two")
if picking.picking_type_id.code =='outgoing':
template = {
'name': line.name or '',
'product_id': line.product_id.id,
'product_uom': line.product_uom_id.id,
'location_id': picking.picking_type_id.default_location_src_id.id,
'location_dest_id': line.move_id.partner_id.property_stock_customer.id,
'picking_id': picking.id,
'state': 'draft',
'company_id': line.move_id.company_id.id,
'price_unit': price_unit,
'picking_type_id': picking.picking_type_id.id,
'route_ids': 1 and [
(6, 0, [x.id for x in self.env['stock.location.route'].search([('id', 'in', (2, 3))])])] or [],
'warehouse_id': picking.picking_type_id.warehouse_id.id,
}
if picking.picking_type_id.code == 'incoming':
template = {
'name': line.name or '',
'product_id': line.product_id.id,
'product_uom': line.product_uom_id.id,
'location_id': line.move_id.partner_id.property_stock_supplier.id,
'location_dest_id': picking.picking_type_id.default_location_dest_id.id,
'picking_id': picking.id,
'state': 'draft',
'company_id': line.move_id.company_id.id,
'price_unit': price_unit,
'picking_type_id': picking.picking_type_id.id,
'route_ids': 1 and [
(6, 0, [x.id for x in self.env['stock.location.route'].search([('id', 'in', (2, 3))])])] or [],
'warehouse_id': picking.picking_type_id.warehouse_id.id,
}
diff_quantity = line.quantity
tmp = template.copy()
tmp.update({

Loading…
Cancel
Save