@ -0,0 +1,44 @@ |
|||
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg |
|||
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
Stock Picking From Invoice |
|||
========================== |
|||
This Module Enables To Create Stocks Picking From Customer/Supplier Invoice |
|||
|
|||
Configuration |
|||
============= |
|||
* No additional configurations needed |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
License |
|||
------- |
|||
AFFERO General Public License, Version 3 (AGPL v3). |
|||
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
|||
|
|||
Credits |
|||
------- |
|||
Developer: (V17) Mohammed Dilshad Tk, Contact: odoo@cybrosys.com |
|||
Developer: (V18) Anzil K A, Contact: odoo@cybrosys.com |
|||
Contacts |
|||
-------- |
|||
* Mail Contact : odoo@cybrosys.com |
|||
* Website : https://cybrosys.com |
|||
|
|||
Bug Tracker |
|||
----------- |
|||
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
|||
|
|||
Maintainer |
|||
========== |
|||
.. image:: https://cybrosys.com/images/logo.png |
|||
:target: https://cybrosys.com |
|||
This module is maintained by Cybrosys Technologies. |
|||
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
|||
|
|||
Further information |
|||
=================== |
|||
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Anzil K A (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
from . import models |
@ -0,0 +1,40 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Anzil K A (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
{ |
|||
'name': "Stock Picking From Invoice", |
|||
'version': '18.0.1.0.0', |
|||
'category': 'Accounting', |
|||
'summary': """Stock Picking From Customer/Supplier Invoice""", |
|||
'description': """This Module Enables To Create Stocks Picking From |
|||
Customer/Supplier Invoice""", |
|||
'author': "Cybrosys Techno Solutions", |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer ': 'Cybrosys Techno Solutions', |
|||
'website': "https://www.cybrosys.com", |
|||
'depends': ['account', 'stock', 'payment'], |
|||
'data': ['views/account_move_views.xml'], |
|||
'images': ['static/description/banner.jpg'], |
|||
'license': 'AGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
@ -0,0 +1,7 @@ |
|||
## Module <invoice_stock_move> |
|||
|
|||
#### 09.05.2025 |
|||
#### Version 18.0.1.0.0 |
|||
##### ADD |
|||
|
|||
Initial Commit for Stock Picking From Invoice |
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Anzil K A (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
from . import account_move |
|||
from . import account_move_line |
@ -0,0 +1,125 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Anzil K A (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
from odoo import api, fields, models, _ |
|||
from odoo.exceptions import UserError |
|||
|
|||
|
|||
class AccountMove(models.Model): |
|||
"""Inherits 'account move' to show stock picking in invoice""" |
|||
_inherit = 'account.move' |
|||
|
|||
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") |
|||
picking_type_id = fields.Many2one(comodel_name='stock.picking.type', |
|||
string='Picking Type', |
|||
compute='_compute_picking_type_id', |
|||
help="This will determine the picking type " |
|||
"of incoming/outgoing shipment") |
|||
@api.depends('move_type') |
|||
def _compute_picking_type_id(self): |
|||
for rec in self: |
|||
type = '' |
|||
data = self.env['stock.picking.type'].search([]) |
|||
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""" |
|||
if not self.picking_type_id: |
|||
raise UserError(_( |
|||
" Please select a picking type")) |
|||
for order in self: |
|||
if not self.invoice_picking_id: |
|||
pick = {} |
|||
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, |
|||
'move_type': 'direct' |
|||
} |
|||
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, |
|||
'move_type': 'direct' |
|||
} |
|||
picking = self.env['stock.picking'].create(pick) |
|||
self.invoice_picking_id = picking.id |
|||
self.picking_count = len(picking) |
|||
order = order.invoice_line_ids.filtered(lambda item: |
|||
item.product_id.type in |
|||
['product', 'consu']) |
|||
(order._create_stock_moves(picking)._action_confirm(). |
|||
_action_assign()) |
|||
|
|||
def action_view_picking(self): |
|||
"""Function to view moves while clicking shipment smart button""" |
|||
action = self.env.ref('stock.action_picking_tree_ready') |
|||
result = action.read()[0] |
|||
result.pop('id', None) |
|||
result['context'] = {} |
|||
result['domain'] = [('id', '=', self.invoice_picking_id.id)] |
|||
pick_ids = sum([self.invoice_picking_id.id]) |
|||
if pick_ids: |
|||
res = self.env.ref('stock.view_picking_form', False) |
|||
result['views'] = [(res and res.id or False, 'form')] |
|||
result['res_id'] = pick_ids or False |
|||
return result |
|||
|
|||
def _reverse_moves(self, default_values_list=None, cancel=False): |
|||
""" Reverse a recordset of account.move. |
|||
If cancel parameter is true, the reconcilable or liquidity lines |
|||
of each original move will be reconciled with its reverse's. |
|||
:param default_values_list: A list of default values to consider per |
|||
move. ('type' & 'reversed_entry_id' are computed in the method). |
|||
:return: An account move recordset, reverse of the current self.""" |
|||
if self.picking_type_id.code == 'outgoing': |
|||
data = self.env['stock.picking.type'].search( |
|||
[('company_id', '=', self.company_id.id), |
|||
('code', '=', 'incoming')], limit=1) |
|||
self.picking_type_id = data.id |
|||
elif self.picking_type_id.code == 'incoming': |
|||
data = self.env['stock.picking.type'].search( |
|||
[('company_id', '=', self.company_id.id), |
|||
('code', '=', 'outgoing')], limit=1) |
|||
self.picking_type_id = data.id |
|||
return super(AccountMove, self)._reverse_moves() |
@ -0,0 +1,78 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Anzil K A (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
from odoo import models |
|||
|
|||
|
|||
class AccountMoveLine(models.Model): |
|||
_inherit = 'account.move.line' |
|||
|
|||
def _create_stock_moves(self, picking): |
|||
"""Function to create stock move""" |
|||
done = self.env['stock.move'].browse() |
|||
for line in self: |
|||
price_unit = line.price_unit |
|||
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.rule'].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.rule'].search( |
|||
[('id', 'in', (2, 3))])])] or [], |
|||
'warehouse_id': picking.picking_type_id.warehouse_id.id, |
|||
} |
|||
diff_quantity = line.quantity |
|||
tmp = template.copy() |
|||
tmp.update({ |
|||
'product_uom_qty': diff_quantity, |
|||
}) |
|||
template['product_uom_qty'] = diff_quantity |
|||
done += self.env['stock.move'].create(template) |
|||
return done |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 738 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 589 B |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 565 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 967 B |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 105 KiB |
After Width: | Height: | Size: 112 KiB |
After Width: | Height: | Size: 258 KiB |
After Width: | Height: | Size: 690 KiB |
After Width: | Height: | Size: 105 KiB |