diff --git a/invoice_stock_move/README.rst b/invoice_stock_move/README.rst new file mode 100644 index 000000000..0f8704590 --- /dev/null +++ b/invoice_stock_move/README.rst @@ -0,0 +1,17 @@ +Stock Move With Invoice v11 +=========================== +This module is developed to manage the stock picking from invoice .It helps to transfer/receive products from +customer/supplier invoice. + +Installation +============ +Just select it from available modules to install it, there is no need to extra installations. + +Configuration +============= + +Nothing to configure. + +Credits +======= +Developer: Saritha Sahadevan @ cybrosys, saritha@cybrosys.in diff --git a/invoice_stock_move/__init__.py b/invoice_stock_move/__init__.py new file mode 100644 index 000000000..4049446af --- /dev/null +++ b/invoice_stock_move/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +from . import models diff --git a/invoice_stock_move/__manifest__.py b/invoice_stock_move/__manifest__.py new file mode 100644 index 000000000..6460b6a57 --- /dev/null +++ b/invoice_stock_move/__manifest__.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +{ + 'name': "Stock Picking From Invoice", + 'version': '11.0.1.0.0', + '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', + 'website': "https://www.cybrosys.com", + 'category': 'Accounting', + 'depends': ['base', 'account', 'stock'], + 'data': ['views/invoice_stock_move_view.xml'], + 'images': ['static/description/banner.jpg'], + 'license': 'LGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/invoice_stock_move/models/__init__.py b/invoice_stock_move/models/__init__.py new file mode 100644 index 000000000..bf87c8d91 --- /dev/null +++ b/invoice_stock_move/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +from . import invoice_stock diff --git a/invoice_stock_move/models/invoice_stock.py b/invoice_stock_move/models/invoice_stock.py new file mode 100644 index 000000000..b4280a4d8 --- /dev/null +++ b/invoice_stock_move/models/invoice_stock.py @@ -0,0 +1,193 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Saritha Sahadevan() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## +from odoo.exceptions import UserError +from odoo import models, fields, api, _ + + +class InvoiceStockMove(models.Model): + _inherit = 'account.invoice' + + @api.model + def _default_picking_receive(self): + type_obj = self.env['stock.picking.type'] + company_id = self.env.context.get('company_id') or self.env.user.company_id.id + types = type_obj.search([('code', '=', 'incoming'), ('warehouse_id.company_id', '=', company_id)], limit=1) + if not types: + types = type_obj.search([('code', '=', 'incoming'), ('warehouse_id', '=', False)]) + return types[:1] + + @api.model + def _default_picking_transfer(self): + type_obj = self.env['stock.picking.type'] + company_id = self.env.context.get('company_id') or self.env.user.company_id.id + types = type_obj.search([('code', '=', 'outgoing'), ('warehouse_id.company_id', '=', company_id)], limit=1) + if not types: + types = type_obj.search([('code', '=', 'outgoing'), ('warehouse_id', '=', False)]) + return types[:4] + + picking_count = fields.Integer(string="Count") + invoice_picking_id = fields.Many2one('stock.picking', string="Picking Id") + picking_type_id = fields.Many2one('stock.picking.type', 'Picking Type', required=True, + default=_default_picking_receive, + help="This will determine picking type of incoming shipment") + picking_transfer_id = fields.Many2one('stock.picking.type', 'Deliver To', required=True, + default=_default_picking_transfer, + help="This will determine picking type of outgoing shipment") + state = fields.Selection([ + ('draft', 'Draft'), + ('proforma', 'Pro-forma'), + ('proforma2', 'Pro-forma'), + ('open', 'Open'), + ('paid', 'Paid'), + ('cancel', 'Cancelled'), + ('done', 'Received'), + ], string='Status', index=True, readonly=True, default='draft', + track_visibility='onchange', copy=False) + + @api.multi + def action_stock_receive(self): + for order in self: + if not order.invoice_line_ids: + raise UserError(_('Please create some invoice lines.')) + if not self.number: + raise UserError(_('Please Validate invoice.')) + if not self.invoice_picking_id: + pick = { + 'picking_type_id': self.picking_type_id.id, + 'partner_id': self.partner_id.id, + 'origin': self.number, + '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) + moves = order.invoice_line_ids.filtered(lambda r: r.product_id.type in ['product', 'consu'])._create_stock_moves(picking) + move_ids = moves._action_confirm() + move_ids._action_assign() + + @api.multi + def action_stock_transfer(self): + for order in self: + if not order.invoice_line_ids: + raise UserError(_('Please create some invoice lines.')) + if not self.number: + raise UserError(_('Please Validate invoice.')) + if not self.invoice_picking_id: + pick = { + 'picking_type_id': self.picking_transfer_id.id, + 'partner_id': self.partner_id.id, + 'origin': self.number, + 'location_dest_id': self.partner_id.property_stock_customer.id, + 'location_id': self.picking_transfer_id.default_location_src_id.id + } + picking = self.env['stock.picking'].create(pick) + self.invoice_picking_id = picking.id + self.picking_count = len(picking) + moves = order.invoice_line_ids.filtered(lambda r: r.product_id.type in ['product', 'consu'])._create_stock_moves_transfer(picking) + move_ids = moves._action_confirm() + move_ids._action_assign() + + @api.multi + def action_view_picking(self): + 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 + + +class SupplierInvoiceLine(models.Model): + _inherit = 'account.invoice.line' + + @api.multi + def _create_stock_moves(self, picking): + moves = self.env['stock.move'] + 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.uom_id.id, + 'location_id': line.invoice_id.partner_id.property_stock_supplier.id, + 'location_dest_id': picking.picking_type_id.default_location_dest_id.id, + 'picking_id': picking.id, + 'move_dest_id': False, + 'state': 'draft', + 'company_id': line.invoice_id.company_id.id, + 'price_unit': price_unit, + 'picking_type_id': picking.picking_type_id.id, + 'procurement_id': False, + '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({ + 'product_uom_qty': diff_quantity, + }) + template['product_uom_qty'] = diff_quantity + done += moves.create(template) + return done + + def _create_stock_moves_transfer(self, picking): + moves = self.env['stock.move'] + 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.uom_id.id, + 'location_id': picking.picking_type_id.default_location_src_id.id, + 'location_dest_id': line.invoice_id.partner_id.property_stock_customer.id, + 'picking_id': picking.id, + 'move_dest_id': False, + 'state': 'draft', + 'company_id': line.invoice_id.company_id.id, + 'price_unit': price_unit, + 'picking_type_id': picking.picking_type_id.id, + 'procurement_id': False, + '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({ + 'product_uom_qty': diff_quantity, + }) + template['product_uom_qty'] = diff_quantity + done += moves.create(template) + return done + + + diff --git a/invoice_stock_move/static/description/banner.jpg b/invoice_stock_move/static/description/banner.jpg new file mode 100644 index 000000000..5da168516 Binary files /dev/null and b/invoice_stock_move/static/description/banner.jpg differ diff --git a/invoice_stock_move/static/description/cust_warehouse.png b/invoice_stock_move/static/description/cust_warehouse.png new file mode 100644 index 000000000..c66556fb4 Binary files /dev/null and b/invoice_stock_move/static/description/cust_warehouse.png differ diff --git a/invoice_stock_move/static/description/customer_invoice.png b/invoice_stock_move/static/description/customer_invoice.png new file mode 100644 index 000000000..9118c5dd5 Binary files /dev/null and b/invoice_stock_move/static/description/customer_invoice.png differ diff --git a/invoice_stock_move/static/description/cybro_logo.png b/invoice_stock_move/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/invoice_stock_move/static/description/cybro_logo.png differ diff --git a/invoice_stock_move/static/description/icon.png b/invoice_stock_move/static/description/icon.png new file mode 100644 index 000000000..31df27645 Binary files /dev/null and b/invoice_stock_move/static/description/icon.png differ diff --git a/invoice_stock_move/static/description/index.html b/invoice_stock_move/static/description/index.html new file mode 100644 index 000000000..a736a9d68 --- /dev/null +++ b/invoice_stock_move/static/description/index.html @@ -0,0 +1,344 @@ +
+
+

+ Stock Picking From Invoice +

+

+ This Module Enables To Stock Pickings From Customer/Supplier Invoice. +

+
+ Cybrosys Technologies +
+ +
+ cybrosys technologies
+
+
+
+
+
+

+ Overview +

+

+ Currently in Odoo , We cannot transfer stocks directly from customer/supplier invoice. + We need to depend sales module or purchase module to transfer or receive goods. + This module enable to transfer stocks from invoices without depending sales and purchase module. +

+
+ +
+
+
+

+ Features +

+

+ + Stock Picking From Customer Invoice. +

+

+ + Stock Picking From Supplier Invoice. +

+ +
+
+
+
+

+ Screenshots +

+

+ + Transfer Button in Customer invoice +

+
+ +
+

+ + On clicking Transfer Button, Stock Is Moved To Customer Inventory. +

+
+ +
+

+ + Receive Button in Vendor Bill. +

+
+ +
+

+ + >On clicking Receive Button, Stock Is Moved To Our Inventory. +

+
+ +
+ +
+
+
+
+

+ Our Services +

+
+ + + +
+ +
+ + + +
+

+ + Odoo Support +

+ +
+ +
+
+
+
+
+

+ Our Industries +

+
+ +
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Manufacturing +

+

+ Plan, track and schedule your operations. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Restaurant +

+

+ Run your bar or restaurant methodical. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + POS +

+

+ Easy configuring and convivial selling. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + E-commerce & Website +

+

+ Mobile friendly, awe-inspiring product pages. +

+
+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Hotel Management +

+

+ An all-inclusive hotel management application. +

+
+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Education +

+

+ A Collaborative platform for educational management. +

+
+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Service Management +

+

+ Keep track of services and invoice accordingly. +

+
+
+
+
+
+
+ +
\ No newline at end of file diff --git a/invoice_stock_move/static/description/supp_warehouse.png b/invoice_stock_move/static/description/supp_warehouse.png new file mode 100644 index 000000000..ec28fc57d Binary files /dev/null and b/invoice_stock_move/static/description/supp_warehouse.png differ diff --git a/invoice_stock_move/static/description/supplier_invoice.png b/invoice_stock_move/static/description/supplier_invoice.png new file mode 100644 index 000000000..3a27e73a3 Binary files /dev/null and b/invoice_stock_move/static/description/supplier_invoice.png differ diff --git a/invoice_stock_move/views/invoice_stock_move_view.xml b/invoice_stock_move/views/invoice_stock_move_view.xml new file mode 100644 index 000000000..1cbe89d6e --- /dev/null +++ b/invoice_stock_move/views/invoice_stock_move_view.xml @@ -0,0 +1,56 @@ + + + + + Move Name + account.invoice + + + + + + + + + + + Move Name + account.invoice + + + + + + + + + + \ No newline at end of file