@ -0,0 +1,51 @@ |
|||||
|
.. image:: https://img.shields.io/badge/license-LGPL--3-blue.svg |
||||
|
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html |
||||
|
:alt: License: LGPL-3 |
||||
|
|
||||
|
Invoice Or Bill For Selected Order Lines |
||||
|
======================================== |
||||
|
We can create invoice for the selected products from order line. Also we can use this feature in the case of bills. |
||||
|
We can also create the invoice or bill for remaining products by selecting the products. |
||||
|
|
||||
|
Configuration |
||||
|
============= |
||||
|
None. |
||||
|
|
||||
|
Company |
||||
|
------- |
||||
|
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
||||
|
|
||||
|
License |
||||
|
------- |
||||
|
General Public License, Version 3 (LGPL v3). |
||||
|
(http://www.gnu.org/licenses/lgpl-3.0-standalone.html) |
||||
|
|
||||
|
Credits |
||||
|
------- |
||||
|
Developers: (V16) - Saneen K , Arjun S |
||||
|
(V17) - Mufeeda Shirin |
||||
|
(V18) - Ashwin T |
||||
|
|
||||
|
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) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Cybrosys Techno Solutions (odoo@cybrosys.com) |
||||
|
# |
||||
|
# This program is free software: you can modify |
||||
|
# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) as |
||||
|
# published by the Free Software Foundation, either version 3 of the |
||||
|
# License, or (at your option) any later version. |
||||
|
# |
||||
|
# 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 for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
from . import models |
@ -0,0 +1,45 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Cybrosys Techno Solutions (odoo@cybrosys.com) |
||||
|
# |
||||
|
# This program is free software: you can modify |
||||
|
# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) as |
||||
|
# published by the Free Software Foundation, either version 3 of the |
||||
|
# License, or (at your option) any later version. |
||||
|
# |
||||
|
# 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 for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
{ |
||||
|
'name': "Invoice Or Bill For Selected Order Lines", |
||||
|
'version': '18.0.1.0.0', |
||||
|
'category': 'Accounting,Purchase,Sales', |
||||
|
'summary': 'Can use only selected products to invoice as well as bills.', |
||||
|
'description': 'We can create invoice for the selected products from order ' |
||||
|
'line.Also we can use this feature in the case of bills. We ' |
||||
|
'can also create the invoice or bill for remaining products' |
||||
|
' by selecting the products.', |
||||
|
'author': 'Cybrosys Techno Solutions', |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'maintainer': 'Cybrosys Techno Solutions', |
||||
|
'website': 'https://www.cybrosys.com', |
||||
|
'depends': ['sale_management', 'purchase', 'stock'], |
||||
|
'data': [ |
||||
|
'views/purchase_order_views.xml', |
||||
|
'views/sale_order_views.xml', |
||||
|
], |
||||
|
'images': ['static/description/banner.png'], |
||||
|
'license': 'LGPL-3', |
||||
|
'installable': True, |
||||
|
'application': False, |
||||
|
'auto_install': False, |
||||
|
} |
@ -0,0 +1,6 @@ |
|||||
|
## Module <invoice_bill_selected_orderlines> |
||||
|
|
||||
|
#### 04.10.2024 |
||||
|
#### Version 18.0.1.0.0 |
||||
|
#### ADD |
||||
|
- Initial commit for Invoice Or Bill For Selected Order Lines |
@ -0,0 +1,23 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Cybrosys Techno Solutions (odoo@cybrosys.com) |
||||
|
# |
||||
|
# This program is free software: you can modify |
||||
|
# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) as |
||||
|
# published by the Free Software Foundation, either version 3 of the |
||||
|
# License, or (at your option) any later version. |
||||
|
# |
||||
|
# 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 for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
from . import purchase_order |
||||
|
from . import sale_order |
@ -0,0 +1,158 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
""" |
||||
|
Can use only selected products to invoice as well as bills. |
||||
|
""" |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Cybrosys Techno Solutions (odoo@cybrosys.com) |
||||
|
# |
||||
|
# This program is free software: you can modify |
||||
|
# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) as |
||||
|
# published by the Free Software Foundation, either version 3 of the |
||||
|
# License, or (at your option) any later version. |
||||
|
# |
||||
|
# 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 for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
from odoo import fields, models, _ |
||||
|
from odoo.exceptions import UserError |
||||
|
from odoo.tools import float_is_zero, groupby |
||||
|
|
||||
|
|
||||
|
class PurchaseOrderLine(models.Model): |
||||
|
"""Inherits the purchase order line""" |
||||
|
_inherit = 'purchase.order.line' |
||||
|
|
||||
|
is_product_select = fields.Boolean(string="Select", |
||||
|
help="To select Products from Order " |
||||
|
"lines", |
||||
|
copy=False) |
||||
|
|
||||
|
|
||||
|
class PurchaseOrder(models.Model): |
||||
|
"""Inherits the purchase order""" |
||||
|
_inherit = 'purchase.order' |
||||
|
|
||||
|
def action_select_all(self): |
||||
|
"""Select all the products from the sale order line for invoice""" |
||||
|
self.order_line.filtered(lambda rec: rec.qty_to_invoice > 0).write( |
||||
|
{'is_product_select': True}) |
||||
|
|
||||
|
def action_deselect_all(self): |
||||
|
"""Deselect all the products from the sale order line for invoice""" |
||||
|
self.order_line.filtered(lambda rec: rec.qty_to_invoice > 0).write( |
||||
|
{'is_product_select': False}) |
||||
|
|
||||
|
def action_create_invoice(self): |
||||
|
"""Create the invoice associated to the PO and Update the invoiceable |
||||
|
lines on the basis of selected lines""" |
||||
|
if self.order_line.filtered( |
||||
|
lambda selected: selected.is_product_select): |
||||
|
# 1) Prepare invoice vals and clean-up the section lines |
||||
|
invoice_vals_list = [] |
||||
|
sequence = 10 |
||||
|
for order in self: |
||||
|
if order.invoice_status != 'to invoice': |
||||
|
continue |
||||
|
order = order.with_company(order.company_id) |
||||
|
pending_section = None |
||||
|
# Invoice values. |
||||
|
invoice_vals = order._prepare_invoice() |
||||
|
# Invoice line values (keep only necessary sections). |
||||
|
for line in order.order_line.filtered(lambda line_select: |
||||
|
(line_select.is_product_select) or True not in |
||||
|
self.order_line.mapped( |
||||
|
'is_product_select') or |
||||
|
line_select.display_type == 'line_section'): |
||||
|
if line.display_type == 'line_section': |
||||
|
pending_section = line |
||||
|
continue |
||||
|
if not float_is_zero(line.qty_to_invoice, |
||||
|
precision_digits=self.env[ |
||||
|
'decimal.precision'].precision_get( |
||||
|
'Product Unit of Measure')): |
||||
|
if pending_section: |
||||
|
line_vals = pending_section._prepare_account_move_line() |
||||
|
line_vals.update({'sequence': sequence}) |
||||
|
invoice_vals['invoice_line_ids'].append( |
||||
|
(0, 0, line_vals)) |
||||
|
sequence += 1 |
||||
|
pending_section = None |
||||
|
line_vals = line._prepare_account_move_line() |
||||
|
line_vals.update({'sequence': sequence}) |
||||
|
invoice_vals['invoice_line_ids'].append( |
||||
|
(0, 0, line_vals)) |
||||
|
sequence += 1 |
||||
|
invoice_vals_list.append(invoice_vals) |
||||
|
if not invoice_vals_list: |
||||
|
raise UserError( |
||||
|
_('There is no invoiceable line. If a product has a' |
||||
|
' control policy based on received quantity, ' |
||||
|
'please make sure that a quantity has been ' |
||||
|
'received.')) |
||||
|
# 2) group by (company_id, partner_id, currency_id) for batch creation |
||||
|
new_invoice_vals_list = [] |
||||
|
for grouping_keys, invoices in groupby( |
||||
|
invoice_vals_list, |
||||
|
key=lambda x: (x.get('company_id'), x.get( |
||||
|
'partner_id'), x.get('currency_id'))): |
||||
|
ref_invoice_vals = self.get_ref_invoice_vals(invoices=invoices) |
||||
|
new_invoice_vals_list.append(ref_invoice_vals) |
||||
|
invoice_vals_list = new_invoice_vals_list |
||||
|
# 3) Create invoices. |
||||
|
moves = self.env['account.move'] |
||||
|
if invoice_vals_list[0].get('invoice_line_ids'): |
||||
|
for vals in invoice_vals_list: |
||||
|
moves |= self.env['account.move'].with_context( |
||||
|
default_move_type='in_invoice').with_company( |
||||
|
vals['company_id']).create( |
||||
|
vals) |
||||
|
# 4) Some moves might actually be refunds: convert them if the |
||||
|
# total amount is negative |
||||
|
# We do this after the moves have been created since we need |
||||
|
# taxes, |
||||
|
# etc. to know if the total |
||||
|
# is actually negative or not |
||||
|
moves.filtered( |
||||
|
lambda m: m.currency_id.round(m.amount_total) < 0) \ |
||||
|
.action_switch_move_type() |
||||
|
return self.action_view_invoice(moves) |
||||
|
raise UserError( |
||||
|
_('There is no invoiceable line. Please make sure ' |
||||
|
'that a order line is selected')) |
||||
|
raise UserError(_('There is no invoiceable line. Please make sure ' |
||||
|
'that a order line is selected')) |
||||
|
|
||||
|
def get_ref_invoice_vals(self, invoices): |
||||
|
""" |
||||
|
This is the method get_ref_invoice_vals which will return the invoice |
||||
|
vals to the method |
||||
|
""" |
||||
|
origins = set() |
||||
|
payment_refs = set() |
||||
|
refs = set() |
||||
|
ref_invoice_vals = {} |
||||
|
for invoice_vals in invoices: |
||||
|
if not ref_invoice_vals: |
||||
|
ref_invoice_vals = invoice_vals |
||||
|
else: |
||||
|
ref_invoice_vals['invoice_line_ids'] += invoice_vals[ |
||||
|
'invoice_line_ids'] |
||||
|
origins.add(invoice_vals['invoice_origin']) |
||||
|
payment_refs.add(invoice_vals['payment_reference']) |
||||
|
refs.add(invoice_vals['ref']) |
||||
|
ref_invoice_vals.update({ |
||||
|
'ref': ', '.join(refs)[:2000], |
||||
|
'invoice_origin': ', '.join(origins), |
||||
|
'payment_reference': len( |
||||
|
payment_refs) == 1 and payment_refs.pop() or False, |
||||
|
}) |
||||
|
return ref_invoice_vals |
@ -0,0 +1,97 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
""" |
||||
|
Can use only selected products to invoice as well as bills. |
||||
|
""" |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
||||
|
# Author: Cybrosys Techno Solutions (odoo@cybrosys.com) |
||||
|
# |
||||
|
# This program is free software: you can modify |
||||
|
# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) as |
||||
|
# published by the Free Software Foundation, either version 3 of the |
||||
|
# License, or (at your option) any later version. |
||||
|
# |
||||
|
# 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 for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
from odoo import fields, models, _ |
||||
|
from odoo.exceptions import UserError |
||||
|
from odoo.tools import float_is_zero |
||||
|
|
||||
|
|
||||
|
class SaleOrderLine(models.Model): |
||||
|
"""Inherits the sale order line for adding the boolean field""" |
||||
|
_inherit = 'sale.order.line' |
||||
|
|
||||
|
is_product_select = fields.Boolean(string="Select", |
||||
|
help="To Select products from order line", |
||||
|
copy=False) |
||||
|
|
||||
|
|
||||
|
class SaleOrder(models.Model): |
||||
|
"""Inherits the sale order for selecting products""" |
||||
|
_inherit = 'sale.order' |
||||
|
|
||||
|
is_qty_to_invoice = fields.Boolean(string="Is Qty To Invoice", |
||||
|
help="Is any pending qty to invoice", |
||||
|
compute='_compute_is_qty_to_to_invoice') |
||||
|
|
||||
|
def _compute_is_qty_to_to_invoice(self): |
||||
|
"""Function to hide the select/deselect button when nothing to |
||||
|
invoice""" |
||||
|
if self.invoice_status == 'no': |
||||
|
self.is_qty_to_invoice = True |
||||
|
elif False in self.order_line.mapped('is_product_select'): |
||||
|
self.is_qty_to_invoice = False |
||||
|
else: |
||||
|
self.is_qty_to_invoice = True |
||||
|
|
||||
|
def action_select_all(self): |
||||
|
"""Select all the products from the sale order line for invoice""" |
||||
|
self.order_line.filtered(lambda rec: rec.qty_to_invoice > 0).write( |
||||
|
{'is_product_select': True}) |
||||
|
|
||||
|
def action_deselect_all(self): |
||||
|
""" Deselect all the products from the sale order line for invoice""" |
||||
|
self.order_line.filtered(lambda rec: rec.qty_to_invoice > 0).write( |
||||
|
{'is_product_select': False}) |
||||
|
|
||||
|
def _get_invoiceable_lines(self, line_section='line_section'): |
||||
|
"""Return the invoice-able lines for order `self` and Update the |
||||
|
invoiceable lines on the basis of selected lines""" |
||||
|
if self.order_line.filtered( |
||||
|
lambda line: line.is_product_select): |
||||
|
down_payment_line_ids = [] |
||||
|
invoiceable_line_ids = [] |
||||
|
precision = self.env['decimal.precision'].precision_get( |
||||
|
'Product Unit of Measure') |
||||
|
selected_lines = [] |
||||
|
for line in self.order_line.filtered(lambda line_select: ( |
||||
|
line_select.is_product_select or line_select.is_downpayment) or |
||||
|
True not in self.order_line.mapped( |
||||
|
'is_product_select') or line_select.display_type == 'line_section' or line_select.display_type == 'line_note'): |
||||
|
selected_lines.append(line) |
||||
|
if line.display_type == line_section: |
||||
|
# Add the section to the invoiceable lines |
||||
|
invoiceable_line_ids.append(line.id) |
||||
|
elif line.display_type == 'line_note': |
||||
|
# Add the note to the invoiceable lines |
||||
|
invoiceable_line_ids.append(line.id) |
||||
|
elif float_is_zero(line.qty_to_invoice, |
||||
|
precision_digits=precision): |
||||
|
continue |
||||
|
else: |
||||
|
invoiceable_line_ids.append(line.id) |
||||
|
# Add the down payment lines to the invoiceable lines, at the end |
||||
|
invoiceable_line_ids += down_payment_line_ids |
||||
|
return self.env['sale.order.line'].browse(invoiceable_line_ids) |
||||
|
raise UserError(_('There is no invoiceable line. Please make sure ' |
||||
|
'that a order line is selected')) |
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: 309 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: 183 KiB |
After Width: | Height: | Size: 201 KiB |
After Width: | Height: | Size: 162 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 195 KiB |
After Width: | Height: | Size: 176 KiB |
After Width: | Height: | Size: 119 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 89 KiB |
After Width: | Height: | Size: 8.5 KiB |
@ -0,0 +1,23 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<!--Add field for selecting products--> |
||||
|
<record id="purchase_order_form" model="ir.ui.view"> |
||||
|
<field name="name">purchase.order.view.inherit.list.invoice.or.bill.for.selected.order.lines</field> |
||||
|
<field name="inherit_id" ref="purchase.purchase_order_form"/> |
||||
|
<field name="model">purchase.order</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//field[@name='order_line']/list/field[@name='product_id']" position="before"> |
||||
|
<field name="qty_to_invoice" invisible="1"/> |
||||
|
<field name="is_product_select" nolabel="1" invisible=" qty_to_invoice == 0 "/> |
||||
|
</xpath> |
||||
|
<xpath expr="//field[@name='order_line']" position="before"> |
||||
|
<div style="display: flex; flex-direction: row; margin: 10px;"> |
||||
|
<button name="action_select_all" class="btn btn-primary mx-2" string="Select All" type="object" |
||||
|
invisible=" invoice_status != 'to invoice'"/> |
||||
|
<button name="action_deselect_all" class="oe_highlight" string="Deselect All" type="object" |
||||
|
invisible=" invoice_status != 'to invoice'"/> |
||||
|
</div> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
</odoo> |
@ -0,0 +1,23 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<!--Add field for selecting products--> |
||||
|
<record id="view_order_form" model="ir.ui.view"> |
||||
|
<field name="name">sale.order.view.inherit.tree.invoice.or.bill.for.selected.order.lines</field> |
||||
|
<field name="inherit_id" ref="sale.view_order_form"/> |
||||
|
<field name="model">sale.order</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//field[@name='order_line']/list/field[@name='product_template_id']" position="before"> |
||||
|
<field name="is_product_select" nolabel="1" invisible=" qty_to_invoice == 0"/> |
||||
|
</xpath> |
||||
|
<xpath expr="//field[@name='order_line']" position="before"> |
||||
|
<div style="display: flex; flex-direction: row; margin: 10px;" invisible="state in ('draft','sent')"> |
||||
|
<field name="is_qty_to_invoice" invisible="1"/> |
||||
|
<button name="action_select_all" class="btn btn-primary mx-2" string="Select All" type="object" |
||||
|
invisible=" is_qty_to_invoice "/> |
||||
|
<button name="action_deselect_all" class="oe_highlight" string="Deselect All" type="object" |
||||
|
invisible=" is_qty_to_invoice "/> |
||||
|
</div> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
</odoo> |