Browse Source

Jul 19 : [UPDT] Updated 'stock_move_invoice'

pull/266/head
AjmalCybro 2 years ago
parent
commit
d1c35f0930
  1. 12
      stock_move_invoice/README.rst
  2. 4
      stock_move_invoice/__manifest__.py
  3. 7
      stock_move_invoice/doc/RELEASE_NOTES.md
  4. 4
      stock_move_invoice/models/account_move.py
  5. 17
      stock_move_invoice/models/res_config_settings.py
  6. 256
      stock_move_invoice/models/stock_picking.py
  7. BIN
      stock_move_invoice/static/description/assets/screenshots/demo6.png
  8. BIN
      stock_move_invoice/static/description/assets/screenshots/demo7.png
  9. BIN
      stock_move_invoice/static/description/assets/screenshots/demo8.png
  10. 21
      stock_move_invoice/static/description/index.html
  11. 2
      stock_move_invoice/views/account_move_inherited.xml
  12. 16
      stock_move_invoice/views/res_config_settings_inherited.xml
  13. 17
      stock_move_invoice/views/stock_picking_inherited.xml
  14. 7
      stock_move_invoice/wizard/__init__.py
  15. 12
      stock_move_invoice/wizard/picking_invoice_wizard.py
  16. 11
      stock_move_invoice/wizard/picking_invoice_wizard.xml

12
stock_move_invoice/README.rst

@ -1,3 +1,6 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://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
@ -20,8 +23,8 @@ Credits
-------
* Developer:
V13 Sayooj A O
V14 Minhaj T
V15 Tintuk Tomin
V14 Minhaj T
V15 Tintuk Tomin
Contacts
--------
@ -33,9 +36,12 @@ Bugs are tracked on GitHub Issues. In case of trouble, please check there if you
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 https://www.cybrosys.com
For support and more information, please visit `Our Website <https://cybrosys.com/>`__
Further information
===================

4
stock_move_invoice/__manifest__.py

@ -3,7 +3,7 @@
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2021-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Copyright (C) 2020-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Sayooj A O(<https://www.cybrosys.com>)
#
# You can modify it under the terms of the GNU AFFERO
@ -43,5 +43,5 @@
'images': ['static/description/banner.png'],
'installable': True,
'application': True,
'sequence':1
'sequence': 1
}

7
stock_move_invoice/doc/RELEASE_NOTES.md

@ -3,4 +3,9 @@
#### 06.11.2020
#### Version 16.0.1.0.0
##### ADD
- Initial commit
- Initial commit for Invoice From Stock Picking
#### 19.07.2023
#### Version 16.0.1.0.0
##### UPDATE
- Update for Invoice From Stock Picking

4
stock_move_invoice/models/account_move.py

@ -19,10 +19,12 @@
# If not, see <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import api, fields, models
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')
transfer_ids = fields.Many2many('stock.picking', string='Transfers')

17
stock_move_invoice/models/res_config_settings.py

@ -23,8 +23,17 @@ 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')
vendor_journal_id = fields.Many2one('account.journal', string='Vendor Journal',
config_parameter='stock_move_invoice.vendor_journal_id')
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')

256
stock_move_invoice/models/stock_picking.py

@ -24,15 +24,20 @@ from odoo.exceptions import UserError
class StockPicking(models.Model):
"""Inheriting model stock.picking"""
_inherit = 'stock.picking'
invoice_count = fields.Integer(string='Invoices', compute='_compute_invoice_count')
invoice_count = fields.Integer(string='Invoices',
compute='_compute_invoice_count')
operation_code = fields.Selection(related='picking_type_id.code')
is_return = fields.Boolean()
def _compute_invoice_count(self):
"""This compute function used to count the number of invoice for the picking"""
"""This compute function used to count the number of invoice for
the picking"""
for picking_id in self:
move_ids = picking_id.env['account.move'].search([('invoice_origin', '=', picking_id.name)])
move_ids = picking_id.env['account.move'].search(
[('transfer_ids', 'in', picking_id.id)])
if move_ids:
self.invoice_count = len(move_ids)
else:
@ -44,19 +49,31 @@ class StockPicking(models.Model):
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
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"))
raise UserError(
_("Please configure the journal from settings"))
invoice_line_list = []
for move_ids_without_package in picking_id.move_ids_without_package:
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])],
'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_done,
})
invoice_line_list.append(vals)
@ -66,11 +83,13 @@ class StockPicking(models.Model):
'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,
'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
'invoice_line_ids': invoice_line_list,
'transfer_ids': self
})
return invoice
@ -80,19 +99,29 @@ class StockPicking(models.Model):
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(
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."))
raise UserError(
_("Please configure the journal from the settings."))
invoice_line_list = []
for move_ids_without_package in picking_id.move_ids_without_package:
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])],
'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_done,
})
invoice_line_list.append(vals)
@ -102,11 +131,13 @@ class StockPicking(models.Model):
'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,
'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
'invoice_line_ids': invoice_line_list,
'transfer_ids': self
})
return invoice
@ -116,19 +147,29 @@ class StockPicking(models.Model):
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
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"))
raise UserError(
_("Please configure the journal from settings"))
invoice_line_list = []
for move_ids_without_package in picking_id.move_ids_without_package:
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])],
'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_done,
})
invoice_line_list.append(vals)
@ -138,11 +179,13 @@ class StockPicking(models.Model):
'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,
'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
'invoice_line_ids': invoice_line_list,
'transfer_ids': self
})
return invoice
@ -152,19 +195,28 @@ class StockPicking(models.Model):
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(
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."))
raise UserError(
_("Please configure the journal from the settings."))
invoice_line_list = []
for move_ids_without_package in picking_id.move_ids_without_package:
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])],
'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_done,
})
invoice_line_list.append(vals)
@ -174,11 +226,13 @@ class StockPicking(models.Model):
'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,
'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
'invoice_line_ids': invoice_line_list,
'transfer_ids': self
})
return invoice
@ -190,18 +244,134 @@ class StockPicking(models.Model):
'type': 'ir.actions.act_window',
'view_mode': 'tree,form',
'res_model': 'account.move',
'domain': [('invoice_origin', '=', self.name)],
'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_done,
})
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_done,
})
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"))
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()
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

BIN
stock_move_invoice/static/description/assets/screenshots/demo6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 KiB

BIN
stock_move_invoice/static/description/assets/screenshots/demo7.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 KiB

BIN
stock_move_invoice/static/description/assets/screenshots/demo8.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

21
stock_move_invoice/static/description/index.html

@ -161,6 +161,27 @@
<img src="assets/screenshots/demo2.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">Create invoice/bill for multiple transfer with same customer
</h3>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">select multiple transfer with same transfer type and with same partner from the tree view. It will create a single invoice/bill with all the products.</p>
<img src="assets/screenshots/demo6.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">Create invoice/bill for multiple transfer with different customer
</h3>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">select multiple transfer with same transfer type and with different partner from the tree view. It will create a single invoice/bill for each transfer.</p>
<img src="assets/screenshots/demo7.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">User error for different type transfer
</h3>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">It shows a user error for the selection of different type transfer.</p>
<img src="assets/screenshots/demo8.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">invoice/bill smart button
</h3>

2
stock_move_invoice/views/account_move_inherited.xml

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<data>
<!-- inheriting account form view-->
<record id="account_move_form_view_inherited" model="ir.ui.view">
<field name="name">account.move.form.view.inherited</field>
<field name="model">account.move</field>
@ -8,6 +9,7 @@
<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>

16
stock_move_invoice/views/res_config_settings_inherited.xml

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- inheriting the res.config.settings view to add journals fields-->
<record id="res_config_settings_invoice_modification" model="ir.ui.view">
<field name="name">res.config.settings.invoice.modification</field>
<field name="model">res.config.settings</field>
@ -9,25 +10,30 @@
<xpath expr="//div[@data-key='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="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."
<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
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"
<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"
<label string="Purchase Journal"
for="vendor_journal_id"
class="col-lg-3 o_light_label"/>
<field name="vendor_journal_id"
domain="[('type', '=', 'purchase')]"/>

17
stock_move_invoice/views/stock_picking_inherited.xml

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<data>
<!-- inheriting stock.picking form view to add invoice/bill button-->
<record id="stock_picking_form_view_inherited" model="ir.ui.view">
<field name="name">stock.picking.form.view.inherited</field>
<field name="model">stock.picking</field>
@ -17,7 +18,8 @@
<field name="invoice_count" widget="statinfo"/>
</button>
</xpath>
<xpath expr="//button[@name='action_toggle_is_locked']" position="after">
<xpath expr="//button[@name='action_toggle_is_locked']"
position="after">
<button name="create_invoice" class="oe_highlight"
string="Create Invoice" type="object"
attrs="{'invisible': ['|','|','|',('invoice_count','!=', 0),('state','!=','done'),('operation_code','=','incoming'),('is_return','=',True)]}"/>
@ -34,4 +36,17 @@
</field>
</record>
</data>
<!-- 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>

7
stock_move_invoice/wizard/__init__.py

@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
###################################################################################
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2019-TODAY Cybrosys Technologies (<https://www.cybrosys.com>).
# Copyright (C) 2020-TODAY Cybrosys Technologies (<https://www.cybrosys.com>)
# Author: SAYOOJ A O (<https://www.cybrosys.com>)
#
# This program is free software: you can modify
@ -19,8 +19,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
###################################################################################
###############################################################################
from . import picking_invoice_wizard

12
stock_move_invoice/wizard/picking_invoice_wizard.py

@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
###################################################################################
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2020-TODAY Cybrosys Technologies (<https://www.cybrosys.com>).
# Copyright (C) 2020-TODAY Cybrosys Technologies (<https://www.cybrosys.com>)
# Author: SAYOOJ A O (<https://www.cybrosys.com>)
#
# This program is free software: you can modify
@ -19,16 +19,18 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
###################################################################################
###############################################################################
from odoo import models
class PickingInvoiceWizard(models.TransientModel):
"""model for picking invoice wizard"""
_name = 'picking.invoice.wizard'
_description = "Create Invoice from picking"
_description = "Picking Invoice Wizard"
def picking_multi_invoice(self):
"""Fucntion 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)

11
stock_move_invoice/wizard/picking_invoice_wizard.xml

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_picking_invoice_wizard" model="ir.ui.view">
<field name="name">view.picking.invoice.wizard</field>
<!-- view for picking invoice wizard-->
<record id="picking_invoice_wizard_view_form" model="ir.ui.view">
<field name="name">picking.invoice.wizard.view.form</field>
<field name="model">picking.invoice.wizard</field>
<field name="arch" type="xml">
<form string="Generate Invoice For Multiple Picking">
@ -9,8 +10,10 @@
<span>Invoice will generate for selected picking</span>
</group>
<footer>
<button name="picking_multi_invoice" string="Create Invoice" type="object" class="oe_highlight"/>
<button string="Cancel" class="btn btn-default" special="cancel"/>
<button name="picking_multi_invoice" string="Create Invoice"
type="object" class="oe_highlight"/>
<button string="Cancel" class="btn btn-default"
special="cancel"/>
</footer>
</form>
</field>

Loading…
Cancel
Save