Browse Source

Sep 17: [FIX] Bug Fixed 'invoice_stock_move'

pull/332/head
Cybrosys Technologies 8 months ago
parent
commit
55990dfc57
  1. 2
      invoice_stock_move/__manifest__.py
  2. 5
      invoice_stock_move/doc/RELEASE_NOTES.md
  3. 43
      invoice_stock_move/models/account_move.py
  4. 2
      invoice_stock_move/views/account_move_views.xml

2
invoice_stock_move/__manifest__.py

@ -21,7 +21,7 @@
################################################################################
{
'name': "Stock Picking From Invoice",
'version': '17.0.1.0.0',
'version': '17.0.1.0.1',
'category': 'Accounting',
'summary': """Stock Picking From Customer/Supplier Invoice""",
'description': """This Module Enables To Create Stocks Picking From

5
invoice_stock_move/doc/RELEASE_NOTES.md

@ -5,3 +5,8 @@
#### ADD
Initial Commit for Stock Picking From Invoice
#### 12.09.2024
#### Version 17.0.1.0.1
#### Bugfix
-An issue was mentioned that picking type value is missing , updated the code

43
invoice_stock_move/models/account_move.py

@ -19,7 +19,7 @@
# If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
from odoo import fields, models, _
from odoo import fields, models, _, api
from odoo.exceptions import UserError
@ -27,30 +27,33 @@ class AccountMove(models.Model):
"""Inherits 'account move' to show stock picking in invoice"""
_inherit = 'account.move'
def _get_stock_type_ids(self):
"""Fetch the move types and return to 'picking_type_id' field"""
data = self.env['stock.picking.type'].search([])
if self._context.get('default_move_type') == 'out_invoice':
for line in data:
if line.code == 'outgoing':
return line
if self._context.get('default_move_type') == 'in_invoice':
for line in data:
if line.code == 'incoming':
return line
picking_count = fields.Integer(string="Count", copy=False,
help="Count of the created picking")
picking_count = fields.Integer(string="Count", copy=False, help="Count of "
"the "
"created "
"picking")
invoice_picking_id = fields.Many2one(comodel_name='stock.picking',
string="Picking Id", copy=False,
help="corresponding picking")
help="Corresponding picking")
picking_type_id = fields.Many2one(comodel_name='stock.picking.type',
string='Picking Type',
default=_get_stock_type_ids,
help="This will determine picking "
"type of incoming shipment")
compute='compute_stock_type',
help="This will determine the picking type "
"of incoming/outgoing shipment")
@api.depends('move_type')
def compute_stock_type(self):
for rec in self:
type = ''
data = self.env['stock.picking.type'].search([])
print('self._context.get', self._context.get('default_move_type'))
if self._context.get('default_move_type') == 'out_invoice':
for line in data:
if line.code == 'outgoing':
type = line
if self._context.get('default_move_type') == 'in_invoice':
for line in data:
if line.code == 'incoming':
type = line
rec.picking_type_id = type
def action_stock_move(self):
"""Function to create transfer from invoice"""

2
invoice_stock_move/views/account_move_views.xml

@ -13,7 +13,7 @@
invisible="state == 'draft' or picking_count == 1"/>
</xpath>
<xpath expr="//field[@name='invoice_date']" position="after">
<field name="picking_type_id" readonly="1"/>
<field name="picking_type_id"/>
<field name="invoice_picking_id" invisible="1"/>
</xpath>
<xpath expr="//div[@name='button_box']" position="inside">

Loading…
Cancel
Save