@ -0,0 +1,48 @@ |
|||||
|
.. 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 |
||||
|
|
||||
|
Invoice From Stock Picking |
||||
|
========================== |
||||
|
* Enables the option for creating invoice from stock picking |
||||
|
|
||||
|
Configuration |
||||
|
============= |
||||
|
* No additional configurations needed |
||||
|
|
||||
|
Company |
||||
|
------- |
||||
|
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
||||
|
|
||||
|
License |
||||
|
------- |
||||
|
General Public License, Version 3 (AGPL v3). |
||||
|
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
||||
|
|
||||
|
Credits |
||||
|
------- |
||||
|
* Developer: (V17) Mruthul Raj, |
||||
|
(V18) Ranjith R, |
||||
|
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,23 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.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 |
||||
|
from . import wizard |
@ -0,0 +1,45 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.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': "Invoice From Stock Picking", |
||||
|
'version': '18.0.1.0.0', |
||||
|
'category': 'Extra Tools', |
||||
|
'summary': """Create invoice for stock picking""", |
||||
|
'description': """In this module creating customer invoice,vendor bill, |
||||
|
customer credit note and refund from stock picking""", |
||||
|
'author': 'Cybrosys Techno Solutions', |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'maintainer': 'Cybrosys Techno Solutions', |
||||
|
'website': "https://www.cybrosys.com", |
||||
|
'depends': ['stock', 'account'], |
||||
|
'data': [ |
||||
|
'views/account_move_views.xml', |
||||
|
'views/stock_picking_views.xml', |
||||
|
'views/res_config_settings_views.xml', |
||||
|
'wizard/picking_invoice_views.xml', |
||||
|
], |
||||
|
'images': ['static/description/banner.jpg'], |
||||
|
'license': "AGPL-3", |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
'application': False, |
||||
|
} |
@ -0,0 +1,6 @@ |
|||||
|
## Module <stock_move_invoice> |
||||
|
|
||||
|
#### 17.01.2025 |
||||
|
#### Version 18.0.1.0.0 |
||||
|
##### ADD |
||||
|
- Initial Commit for Invoice From Stock Picking |
@ -0,0 +1,25 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.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 res_config_settings |
||||
|
from . import stock_picking |
||||
|
from . import stock_return_picking |
@ -0,0 +1,34 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.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 fields, models |
||||
|
|
||||
|
|
||||
|
class AccountMove(models.Model): |
||||
|
"""Inheriting the model account.move""" |
||||
|
_inherit = 'account.move' |
||||
|
|
||||
|
picking_id = fields.Many2one('stock.picking', string='Picking', |
||||
|
help='Related picking for this accounting ' |
||||
|
'entry') |
||||
|
transfer_ids = fields.Many2many('stock.picking', string='Transfers', |
||||
|
help='Related transfers for this accounting' |
||||
|
' entry') |
@ -0,0 +1,39 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.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 fields, models |
||||
|
|
||||
|
|
||||
|
class Settings(models.TransientModel): |
||||
|
"""Inheriting model res.config.settings to add journal fields""" |
||||
|
_inherit = 'res.config.settings' |
||||
|
|
||||
|
customer_journal_id = fields.Many2one('account.journal', |
||||
|
string='Customer Journal', |
||||
|
config_parameter= |
||||
|
'stock_move_invoice.' |
||||
|
'customer_journal_id', |
||||
|
help='To add customer journal') |
||||
|
vendor_journal_id = fields.Many2one('account.journal', |
||||
|
string='Vendor Journal', |
||||
|
config_parameter= |
||||
|
'stock_move_invoice.vendor_journal_id', |
||||
|
help='To add vendor journal') |
@ -0,0 +1,370 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.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 fields, models, _ |
||||
|
from odoo.exceptions import UserError |
||||
|
|
||||
|
|
||||
|
class StockPicking(models.Model): |
||||
|
_inherit = 'stock.picking' |
||||
|
|
||||
|
invoice_count = fields.Integer(string='Invoices', |
||||
|
compute='_compute_invoice_count', |
||||
|
help='The number of associated invoices for ' |
||||
|
'this picking.') |
||||
|
operation_code = fields.Selection(related='picking_type_id.code', |
||||
|
string='Operation Code', |
||||
|
help='The code related to the operation ' |
||||
|
'of this picking.') |
||||
|
is_return = fields.Boolean(string='Return', |
||||
|
help='Indicates whether this picking is a ' |
||||
|
'return.') |
||||
|
|
||||
|
def _compute_invoice_count(self): |
||||
|
"""This computes function used to count the number of invoice for |
||||
|
the picking""" |
||||
|
for picking_id in self: |
||||
|
move_ids = picking_id.env['account.move'].search( |
||||
|
[('transfer_ids', 'in', picking_id.id)]) |
||||
|
if move_ids: |
||||
|
self.invoice_count = len(move_ids) |
||||
|
else: |
||||
|
self.invoice_count = 0 |
||||
|
|
||||
|
def action_create_invoice(self): |
||||
|
"""This is the function for creating customer invoice |
||||
|
from the picking""" |
||||
|
for picking_id in self: |
||||
|
current_user = self.env.uid |
||||
|
if picking_id.picking_type_id.code == 'outgoing': |
||||
|
customer_journal_id = \ |
||||
|
picking_id.env['ir.config_parameter'].sudo(). \ |
||||
|
get_param('stock_move_invoice.customer_journal_id') or \ |
||||
|
False |
||||
|
if not customer_journal_id: |
||||
|
raise UserError( |
||||
|
_("Please configure the journal from settings")) |
||||
|
invoice_line_list = [] |
||||
|
for move_ids_without_package in picking_id. \ |
||||
|
move_ids_without_package: |
||||
|
vals = (0, 0, { |
||||
|
'name': move_ids_without_package.description_picking, |
||||
|
'product_id': move_ids_without_package.product_id.id, |
||||
|
'price_unit': |
||||
|
move_ids_without_package.product_id.lst_price, |
||||
|
'account_id': |
||||
|
move_ids_without_package.product_id. |
||||
|
property_account_income_id.id if |
||||
|
move_ids_without_package. |
||||
|
product_id.property_account_income_id |
||||
|
else move_ids_without_package. |
||||
|
product_id.categ_id. |
||||
|
property_account_income_categ_id.id, |
||||
|
'tax_ids': [(6, 0, [ |
||||
|
picking_id.company_id.account_sale_tax_id.id])], |
||||
|
'quantity': move_ids_without_package.quantity, |
||||
|
}) |
||||
|
invoice_line_list.append(vals) |
||||
|
invoice = picking_id.env['account.move'].create({ |
||||
|
'move_type': 'out_invoice', |
||||
|
'invoice_origin': picking_id.name, |
||||
|
'invoice_user_id': current_user, |
||||
|
'narration': picking_id.name, |
||||
|
'partner_id': picking_id.partner_id.id, |
||||
|
'currency_id': |
||||
|
picking_id.env.user.company_id.currency_id.id, |
||||
|
'journal_id': int(customer_journal_id), |
||||
|
'payment_reference': picking_id.name, |
||||
|
'picking_id': picking_id.id, |
||||
|
'invoice_line_ids': invoice_line_list, |
||||
|
'transfer_ids': self |
||||
|
}) |
||||
|
return invoice |
||||
|
|
||||
|
def action_create_bill(self): |
||||
|
"""This is the function for creating vendor bill |
||||
|
from the picking""" |
||||
|
for picking_id in self: |
||||
|
current_user = self.env.uid |
||||
|
if picking_id.picking_type_id.code == 'incoming': |
||||
|
vendor_journal_id = picking_id.env[ |
||||
|
'ir.config_parameter'].sudo().get_param( |
||||
|
'stock_move_invoice.vendor_journal_id') or False |
||||
|
if not vendor_journal_id: |
||||
|
raise UserError( |
||||
|
_("Please configure the journal from the settings.")) |
||||
|
invoice_line_list = [] |
||||
|
for move_ids_without_package in picking_id. \ |
||||
|
move_ids_without_package: |
||||
|
vals = (0, 0, { |
||||
|
'name': move_ids_without_package.description_picking, |
||||
|
'product_id': move_ids_without_package.product_id.id, |
||||
|
'price_unit': |
||||
|
move_ids_without_package.product_id.lst_price, |
||||
|
'account_id': |
||||
|
move_ids_without_package.product_id. |
||||
|
property_account_income_id.id if |
||||
|
move_ids_without_package.product_id. |
||||
|
property_account_income_id |
||||
|
else move_ids_without_package.product_id.categ_id. |
||||
|
property_account_income_categ_id.id, |
||||
|
'tax_ids': [(6, 0, [ |
||||
|
picking_id.company_id.account_purchase_tax_id.id])], |
||||
|
'quantity': move_ids_without_package.quantity, |
||||
|
}) |
||||
|
invoice_line_list.append(vals) |
||||
|
invoice = picking_id.env['account.move'].create({ |
||||
|
'move_type': 'in_invoice', |
||||
|
'invoice_origin': picking_id.name, |
||||
|
'invoice_user_id': current_user, |
||||
|
'narration': picking_id.name, |
||||
|
'partner_id': picking_id.partner_id.id, |
||||
|
'currency_id': |
||||
|
picking_id.env.user.company_id.currency_id.id, |
||||
|
'journal_id': int(vendor_journal_id), |
||||
|
'payment_reference': picking_id.name, |
||||
|
'picking_id': picking_id.id, |
||||
|
'invoice_line_ids': invoice_line_list, |
||||
|
'transfer_ids': self |
||||
|
}) |
||||
|
return invoice |
||||
|
|
||||
|
def action_create_customer_credit(self): |
||||
|
"""This is the function for creating customer credit note |
||||
|
from the picking""" |
||||
|
for picking_id in self: |
||||
|
current_user = picking_id.env.uid |
||||
|
if picking_id.picking_type_id.code == 'incoming': |
||||
|
customer_journal_id = \ |
||||
|
picking_id.env['ir.config_parameter'].sudo(). \ |
||||
|
get_param('stock_move_invoice.customer_journal_id') or \ |
||||
|
False |
||||
|
if not customer_journal_id: |
||||
|
raise UserError( |
||||
|
_("Please configure the journal from settings")) |
||||
|
invoice_line_list = [] |
||||
|
for move_ids_without_package in picking_id. \ |
||||
|
move_ids_without_package: |
||||
|
vals = (0, 0, { |
||||
|
'name': move_ids_without_package.description_picking, |
||||
|
'product_id': move_ids_without_package.product_id.id, |
||||
|
'price_unit': |
||||
|
move_ids_without_package.product_id.lst_price, |
||||
|
'account_id': move_ids_without_package.product_id. |
||||
|
property_account_income_id.id if |
||||
|
move_ids_without_package.product_id. |
||||
|
property_account_income_id |
||||
|
else move_ids_without_package.product_id.categ_id. |
||||
|
property_account_income_categ_id.id, |
||||
|
'tax_ids': [(6, 0, [ |
||||
|
picking_id.company_id.account_sale_tax_id.id])], |
||||
|
'quantity': move_ids_without_package.quantity, |
||||
|
}) |
||||
|
invoice_line_list.append(vals) |
||||
|
invoice = picking_id.env['account.move'].create({ |
||||
|
'move_type': 'out_refund', |
||||
|
'invoice_origin': picking_id.name, |
||||
|
'invoice_user_id': current_user, |
||||
|
'narration': picking_id.name, |
||||
|
'partner_id': picking_id.partner_id.id, |
||||
|
'currency_id': |
||||
|
picking_id.env.user.company_id.currency_id.id, |
||||
|
'journal_id': int(customer_journal_id), |
||||
|
'payment_reference': picking_id.name, |
||||
|
'picking_id': picking_id.id, |
||||
|
'invoice_line_ids': invoice_line_list, |
||||
|
'transfer_ids': self |
||||
|
}) |
||||
|
return invoice |
||||
|
|
||||
|
def action_create_vendor_credit(self): |
||||
|
"""This is the function for creating refund |
||||
|
from the picking""" |
||||
|
for picking_id in self: |
||||
|
current_user = self.env.uid |
||||
|
if picking_id.picking_type_id.code == 'outgoing': |
||||
|
vendor_journal_id = picking_id.env[ |
||||
|
'ir.config_parameter'].sudo().get_param( |
||||
|
'stock_move_invoice.vendor_journal_id') or False |
||||
|
if not vendor_journal_id: |
||||
|
raise UserError( |
||||
|
_("Please configure the journal from the settings.")) |
||||
|
invoice_line_list = [] |
||||
|
for move_ids_without_package in picking_id. \ |
||||
|
move_ids_without_package: |
||||
|
vals = (0, 0, { |
||||
|
'name': move_ids_without_package.description_picking, |
||||
|
'product_id': move_ids_without_package.product_id.id, |
||||
|
'price_unit': |
||||
|
move_ids_without_package.product_id.lst_price, |
||||
|
'account_id': move_ids_without_package.product_id. |
||||
|
property_account_income_id.id if |
||||
|
move_ids_without_package.product_id. |
||||
|
property_account_income_id |
||||
|
else move_ids_without_package.product_id.categ_id. |
||||
|
property_account_income_categ_id.id, |
||||
|
'tax_ids': [(6, 0, [ |
||||
|
picking_id.company_id.account_purchase_tax_id.id])], |
||||
|
'quantity': move_ids_without_package.quantity, |
||||
|
}) |
||||
|
invoice_line_list.append(vals) |
||||
|
invoice = picking_id.env['account.move'].create({ |
||||
|
'move_type': 'in_refund', |
||||
|
'invoice_origin': picking_id.name, |
||||
|
'invoice_user_id': current_user, |
||||
|
'narration': picking_id.name, |
||||
|
'partner_id': picking_id.partner_id.id, |
||||
|
'currency_id': |
||||
|
picking_id.env.user.company_id.currency_id.id, |
||||
|
'journal_id': int(vendor_journal_id), |
||||
|
'payment_reference': picking_id.name, |
||||
|
'picking_id': picking_id.id, |
||||
|
'invoice_line_ids': invoice_line_list, |
||||
|
'transfer_ids': self |
||||
|
}) |
||||
|
return invoice |
||||
|
|
||||
|
def action_open_picking_invoice(self): |
||||
|
"""This is the function of the smart button which redirect to the |
||||
|
invoice related to the current picking""" |
||||
|
return { |
||||
|
'name': 'Invoices', |
||||
|
'type': 'ir.actions.act_window', |
||||
|
'view_mode': 'list,form', |
||||
|
'res_model': 'account.move', |
||||
|
'domain': [('transfer_ids', 'in', self.id)], |
||||
|
'context': {'create': False}, |
||||
|
'target': 'current' |
||||
|
} |
||||
|
|
||||
|
def action_create_multi_invoice_for_multi_transfer(self): |
||||
|
"""This is the function for creating customer invoice |
||||
|
from the picking""" |
||||
|
picking_type = list(self.picking_type_id) |
||||
|
if all(first == picking_type[0] for first in picking_type): |
||||
|
if self.picking_type_id.code == 'outgoing': |
||||
|
partner = list(self.partner_id) |
||||
|
if all(first == partner[0] for first in partner): |
||||
|
partner_id = self.partner_id |
||||
|
invoice_line_list = [] |
||||
|
customer_journal_id = \ |
||||
|
self.env['ir.config_parameter'].sudo(). \ |
||||
|
get_param('stock_move_invoice.customer_journal_id') \ |
||||
|
or False |
||||
|
if not customer_journal_id: |
||||
|
raise UserError( |
||||
|
_("Please configure the journal from settings")) |
||||
|
for picking_id in self: |
||||
|
for move_ids_without_package in picking_id. \ |
||||
|
move_ids_without_package: |
||||
|
vals = (0, 0, { |
||||
|
'name': |
||||
|
move_ids_without_package.description_picking |
||||
|
, |
||||
|
'product_id': |
||||
|
move_ids_without_package.product_id.id, |
||||
|
'price_unit': move_ids_without_package. |
||||
|
product_id.lst_price, |
||||
|
'account_id': move_ids_without_package. |
||||
|
product_id.property_account_income_id.id if |
||||
|
move_ids_without_package.product_id. |
||||
|
property_account_income_id |
||||
|
else move_ids_without_package. |
||||
|
product_id.categ_id. |
||||
|
property_account_income_categ_id.id, |
||||
|
'tax_ids': [(6, 0, [picking_id.company_id. |
||||
|
account_purchase_tax_id.id])], |
||||
|
'quantity': |
||||
|
move_ids_without_package.quantity, |
||||
|
}) |
||||
|
invoice_line_list.append(vals) |
||||
|
invoice = self.env['account.move'].create({ |
||||
|
'move_type': 'out_invoice', |
||||
|
'invoice_origin': picking_id.name, |
||||
|
'invoice_user_id': self.env.uid, |
||||
|
'narration': picking_id.name, |
||||
|
'partner_id': partner_id.id, |
||||
|
'currency_id': |
||||
|
picking_id.env.user.company_id.currency_id.id, |
||||
|
'journal_id': int(customer_journal_id), |
||||
|
'payment_reference': picking_id.name, |
||||
|
'invoice_line_ids': invoice_line_list, |
||||
|
'transfer_ids': self |
||||
|
}) |
||||
|
else: |
||||
|
for picking_id in self: |
||||
|
picking_id.create_invoice() |
||||
|
elif self.picking_type_id.code == 'incoming': |
||||
|
partner = list(self.partner_id) |
||||
|
if all(first == partner[0] for first in partner): |
||||
|
partner_id = self.partner_id |
||||
|
bill_line_list = [] |
||||
|
vendor_journal_id = \ |
||||
|
self.env['ir.config_parameter'].sudo(). \ |
||||
|
get_param('stock_move_invoice.vendor_journal_id') \ |
||||
|
or False |
||||
|
if not vendor_journal_id: |
||||
|
raise UserError(_("Please configure the journal from " |
||||
|
"the settings.")) |
||||
|
for picking_id in self: |
||||
|
for move_ids_without_package in picking_id. \ |
||||
|
move_ids_without_package: |
||||
|
vals = (0, 0, { |
||||
|
'name': |
||||
|
move_ids_without_package.description_picking |
||||
|
, |
||||
|
'product_id': |
||||
|
move_ids_without_package.product_id.id, |
||||
|
'price_unit': move_ids_without_package. |
||||
|
product_id.lst_price, |
||||
|
'account_id': move_ids_without_package. |
||||
|
product_id.property_account_income_id.id if |
||||
|
move_ids_without_package.product_id. |
||||
|
property_account_income_id |
||||
|
else move_ids_without_package. |
||||
|
product_id.categ_id. |
||||
|
property_account_income_categ_id.id, |
||||
|
'tax_ids': [(6, 0, [picking_id.company_id. |
||||
|
account_purchase_tax_id.id])], |
||||
|
'quantity': |
||||
|
move_ids_without_package.quantity, |
||||
|
}) |
||||
|
bill_line_list.append(vals) |
||||
|
invoice = self.env['account.move'].create({ |
||||
|
'move_type': 'in_invoice', |
||||
|
'invoice_origin': picking_id.name, |
||||
|
'invoice_user_id': self.env.uid, |
||||
|
'narration': picking_id.name, |
||||
|
'partner_id': partner_id.id, |
||||
|
'currency_id': |
||||
|
picking_id.env.user.company_id.currency_id.id, |
||||
|
'journal_id': int(vendor_journal_id), |
||||
|
'payment_reference': picking_id.name, |
||||
|
'picking_id': picking_id.id, |
||||
|
'invoice_line_ids': bill_line_list, |
||||
|
'transfer_ids': self |
||||
|
}) |
||||
|
else: |
||||
|
for picking_id in self: |
||||
|
picking_id.create_bill() |
||||
|
else: |
||||
|
raise UserError( |
||||
|
_("Please select single type transfer")) |
@ -0,0 +1,34 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.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 StockReturnInvoicePicking(models.TransientModel): |
||||
|
_inherit = 'stock.return.picking' |
||||
|
|
||||
|
def _create_returns(self): |
||||
|
"""in this function the picking is marked as return""" |
||||
|
new_picking, pick_type_id = \ |
||||
|
super(StockReturnInvoicePicking, self)._create_returns() |
||||
|
picking = self.env['stock.picking'].browse(new_picking) |
||||
|
picking.write({'is_return': True}) |
||||
|
return new_picking, pick_type_id |
|
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
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: 767 KiB |
After Width: | Height: | Size: 138 KiB |
After Width: | Height: | Size: 760 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 697 KiB |
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 150 KiB |
After Width: | Height: | Size: 177 KiB |
After Width: | Height: | Size: 346 KiB |
After Width: | Height: | Size: 268 KiB |
After Width: | Height: | Size: 177 KiB |
After Width: | Height: | Size: 159 KiB |
After Width: | Height: | Size: 389 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 733 KiB |
After Width: | Height: | Size: 42 KiB |
@ -0,0 +1,15 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<!--Inheriting account form view--> |
||||
|
<record id="view_move_form" model="ir.ui.view"> |
||||
|
<field name="name">account.move.view.form</field> |
||||
|
<field name="model">account.move</field> |
||||
|
<field name="inherit_id" ref="account.view_move_form"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//field[@name='ref']" position="after"> |
||||
|
<field name="picking_id"/> |
||||
|
<field name="transfer_ids" widget="many2many_tags"/> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
</odoo> |
@ -0,0 +1,48 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<!--Inheriting the res.config.settings view to add journals fields--> |
||||
|
<record id="res_config_settings_view_form" model="ir.ui.view"> |
||||
|
<field name="name">res.config.settings.view.form</field> |
||||
|
<field name="model">res.config.settings</field> |
||||
|
<field name="priority" eval="10"/> |
||||
|
<field name="inherit_id" ref="account.res_config_settings_view_form"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//app[@name='account']" position="inside"> |
||||
|
<h2>Invoice From Stock Picking</h2> |
||||
|
<div class="row mt16 o_settings_container"> |
||||
|
<div class="col-12 col-lg-6 o_setting_box" |
||||
|
title="These taxes are set in any new product created."> |
||||
|
<div class="o_setting_left_pane"/> |
||||
|
<div class="o_setting_right_pane"> |
||||
|
<span class="o_form_label">Journals</span> |
||||
|
<span class="fa fa-lg fa-building-o" |
||||
|
title="Values set here are company-specific." |
||||
|
aria-label="Values set here are company-specific." |
||||
|
role="img"/> |
||||
|
<div class="text-muted"> |
||||
|
Journals which should apply for the invoice |
||||
|
creation from stock picking |
||||
|
</div> |
||||
|
<div class="content-group"> |
||||
|
<div class="row mt16"> |
||||
|
<label string="Sales Journal" |
||||
|
for="customer_journal_id" |
||||
|
class="col-lg-3 o_light_label"/> |
||||
|
<field name="customer_journal_id" |
||||
|
domain="[('type', '=', 'sale')]"/> |
||||
|
</div> |
||||
|
<div class="row"> |
||||
|
<label string="Purchase Journal" |
||||
|
for="vendor_journal_id" |
||||
|
class="col-lg-3 o_light_label"/> |
||||
|
<field name="vendor_journal_id" |
||||
|
domain="[('type', '=', 'purchase')]"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
</odoo> |
@ -0,0 +1,49 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<!--Inheriting stock.picking form view to add invoice/bill button--> |
||||
|
<record id="view_picking_form" model="ir.ui.view"> |
||||
|
<field name="name">stock.picking.view.form</field> |
||||
|
<field name="model">stock.picking</field> |
||||
|
<field name="inherit_id" ref="stock.view_picking_form"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//field[@name='picking_type_id']" position="after"> |
||||
|
<field name="operation_code" invisible="1"/> |
||||
|
<field name="is_return" invisible="1"/> |
||||
|
</xpath> |
||||
|
<xpath expr="//div[@name='button_box']" position="inside"> |
||||
|
<button name="action_open_picking_invoice" type="object" |
||||
|
class="oe_stat_button" icon="fa-file-text" |
||||
|
invisible="invoice_count == 0"> |
||||
|
<field name="invoice_count" widget="statinfo"/> |
||||
|
</button> |
||||
|
</xpath> |
||||
|
<xpath expr="//button[@name='action_cancel']" |
||||
|
position="after"> |
||||
|
<button name="action_create_invoice" class="oe_highlight" |
||||
|
string="Create Invoice" type="object" |
||||
|
invisible="invoice_count != 0 or state != 'done' or operation_code == 'incoming' or is_return == True"/> |
||||
|
<button name="action_create_bill" class="oe_highlight" |
||||
|
string="Create Bill" type="object" |
||||
|
invisible="invoice_count != 0 or state != 'done' or operation_code == 'outgoing' or is_return == True"/> |
||||
|
<button name="action_create_customer_credit" class="oe_highlight" |
||||
|
string="Create Credit Note" type="object" |
||||
|
invisible="invoice_count != 0 or state != 'done' or operation_code == 'outgoing' or is_return == False"/> |
||||
|
<button name="action_create_vendor_credit" class="oe_highlight" |
||||
|
string="Create Vendor Credit" type="object" |
||||
|
invisible="invoice_count != 0 or state != 'done' or operation_code == 'incoming' or is_return == False"/> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
<!-- add invoice/bill create menu in tree view action--> |
||||
|
<record id="action_create_invoice_for_multi_transfer" |
||||
|
model="ir.actions.server"> |
||||
|
<field name="name">Create Invoice/Bill</field> |
||||
|
<field name="model_id" ref="stock.model_stock_picking"/> |
||||
|
<field name="binding_model_id" ref="stock.model_stock_picking"/> |
||||
|
<field name="state">code</field> |
||||
|
<field name="code"> |
||||
|
if records: |
||||
|
action = records.action_create_multi_invoice_for_multi_transfer() |
||||
|
</field> |
||||
|
</record> |
||||
|
</odoo> |
@ -0,0 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.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 picking_invoice |
@ -0,0 +1,45 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Cybrosys Techno Solutions(<https://www.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 PickingInvoice(models.TransientModel): |
||||
|
"""model for picking invoice wizard""" |
||||
|
_name = 'picking.invoice' |
||||
|
_description = "Picking Invoice" |
||||
|
|
||||
|
def action_picking_multi_invoice(self): |
||||
|
"""Function to create multiple invoice for multiple |
||||
|
picking from wizard""" |
||||
|
active_ids = self._context.get('active_ids') |
||||
|
picking_ids = self.env['stock.picking'].browse(active_ids) |
||||
|
picking_id = picking_ids.filtered( |
||||
|
lambda x: x.state == 'done' and x.invoice_count == 0) |
||||
|
for picking in picking_id: |
||||
|
if picking.picking_type_id.code == 'incoming' and not picking.is_return: |
||||
|
picking.create_bill() |
||||
|
if picking.picking_type_id.code == 'outgoing' and not picking.is_return: |
||||
|
picking.create_invoice() |
||||
|
if picking.picking_type_id.code == 'incoming' and picking.is_return: |
||||
|
picking.create_vendor_credit() |
||||
|
if picking.picking_type_id.code == 'outgoing' and picking.is_return: |
||||
|
picking.create_customer_credit() |