-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[14.0] [MIG] sale_report_hide_price: Module migrated in v14. #516
Merged
JayVora-SerpentCS
merged 31 commits into
JayVora-SerpentCS:14.0
from
Chandresh-SerpentCS:14.0_MIG_sale_report_hide_price
Dec 11, 2020
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
97b7137
[ADD] : sale_report_hide_price module
JayVora-SerpentCS 01b2d0c
[REF] : sale_report_hide_price module
JayVora-SerpentCS 733879c
[REF]
JayVora-SerpentCS 7112f38
PEP8 fixes
JayVora-SerpentCS 7e67e22
fixed hide price module
JayVora-SerpentCS eda8033
[IMP/ADD]Fixed Travis.
hpatelserpentcs 48524ae
[IMP/ADD]Added Test Case.
hpatelserpentcs 152dc00
[IMP/ADD]Added partner_credit_limit module.
hpatelserpentcs 2ec6158
[FIX]Travis Fixed.
hpatelserpentcs febef98
added banners
hda 962ec32
fixed summary
hda 9f9b122
[ADD] Migrated sale_report_hide_price module in v11.
sudhir-serpentcs e066b7a
[IMP]made improvements, fix travis errors
Arpit-SerpentCS 248ee08
[IMP] add solve travis error
Arpit-SerpentCS 1a5956b
[IMP]made improvemnts in sale report hide and base model
Arpit-SerpentCS 4b75233
[ADD]improvements in js files and added redme.rst file
Arpit-SerpentCS ff78935
[IMP]removed encoding utf-8 from py files
Arpit-SerpentCS 6f89ce7
[IMP]remove description key in manifest file and improvements in js file
Arpit-SerpentCS 431e771
[IMP] improvements in manifest file
Arpit-SerpentCS 5b27076
[FIX]Fixed travis error and added README.rst file.
shobhapadasalagi eaab41f
[IMP]Improved License file year.
shobhapadasalagi 7830db8
[IMP]solve travis
Arpit-SerpentCS 121ba47
[IMP]improved index for sale_report_hide_price
NishaGajjar-SerpentCS 209b82d
[12.0][MIG] Migrated sale_report_hide_price
Chanakya-SerpentCS e07dc9e
[MIG] Migrated the module in v13.
HarshK-SerpentCS a6ce7e3
[MIG] Migrated the module in v13.
HarshK-SerpentCS 6d6e4c2
[IMP][13.0] Improved code.
mohil24 b94470c
[13.0][IMP] sale_report_hide_price : Fixed the travis issue.
RiddhiChavda22 d41c3f4
[MIG] Migrated the module in v14.
Chandresh-SerpentCS 6ee98cc
[IMP] sale_report_hide_price:improve the comments
pragati-patel98 820133b
[IMP] sale_report_hide_price : improve the code
pragati-patel98 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
OpenERP, Open Source Management Solution | ||
Copyright (C) 2004-2010 OpenERP SA (<http://www.openerp.com>) | ||
Copyright (C) 2020-Today Serpent Consulting Services Pvt. Ltd. (<http://www.serpentcs.com>). | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License 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 Affero General Public License for more details. | ||
|
||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
====================== | ||
Sale Report Hide Price | ||
====================== | ||
|
||
* This module is to hide Price / Discount in Sales Order Report. | ||
* It would give you 2 additional fields on Sales Order / Quotation Show Price and Show Discount | ||
* Based on the choices on the fields, the relevant fields would be shown in the report. | ||
* When both checkboxes (Show Price and Show discount) are check then it will show price,unit price and discount in sale order report. | ||
* When Show Price is checked then it will show Unit Price and Price in sales order report. | ||
* When Show Discount is checked then it will show discount in sales order report. | ||
|
||
Usage | ||
===== | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Serpent Consulting Services Pvt. Ltd. <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# © 2016 Serpent Consulting Services Pvt. Ltd. <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# See LICENSE file for full copyright and licensing details. | ||
|
||
{ | ||
"name": "Hide Price and Discount in Quotation Report", | ||
"author": "Serpent Consulting Services Pvt. Ltd.", | ||
"maintainer": "Serpent Consulting Services Pvt. Ltd.", | ||
"category": "Sales Management", | ||
"website": "http://www.serpentcs.com", | ||
"version": "14.0.1.0.1", | ||
"license": "AGPL-3", | ||
"summary": "Hide price/discount in Sale Order Report", | ||
"depends": ["sale"], | ||
"images": ["static/description/icon.png"], | ||
"data": [ | ||
"views/sale_view.xml", | ||
"views/report_saleorder.xml", | ||
"views/preview_sale_order.xml", | ||
], | ||
"installable": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# See LICENSE file for full copyright and licensing details. | ||
|
||
from . import sale |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# See LICENSE file for full copyright and licensing details. | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class SaleOrder(models.Model): | ||
_inherit = "sale.order" | ||
|
||
show_price = fields.Boolean( | ||
"Show Price", | ||
groups="account.group_account_manager", | ||
help="If checked, you can see the price in " | ||
"report of" | ||
"Sales Order / Quotation.", | ||
) | ||
show_discount = fields.Boolean( | ||
"Show Discount", | ||
groups="account.group_account_manager", | ||
help="If checked, you can see the discount" | ||
" in report of Sales Order/Quotation.", | ||
) | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# See LICENSE file for full copyright and licensing details. | ||
|
||
from . import test_sale |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# See LICENSE file for full copyright and licensing details. | ||
|
||
from odoo.tests import common | ||
|
||
|
||
class SaleOrderTest(common.TransactionCase): | ||
def setup(self): | ||
return super(SaleOrderTest, self).setup() | ||
|
||
def test_saleorder_action(self): | ||
self.sale_order = self.env["sale.order"] | ||
self.partner = self.env.ref("base.res_partner_2") | ||
service_delivery = self.env['product.product'].create({ | ||
'name': 'Cost-plus Contract', | ||
'categ_id': self.env.ref('product.product_category_5').id, | ||
'standard_price': 200.0, | ||
'list_price': 180.0, | ||
'type': 'service', | ||
'uom_id': self.env.ref('uom.product_uom_unit').id, | ||
'uom_po_id': self.env.ref('uom.product_uom_unit').id, | ||
'default_code': 'SERV_DEL', | ||
'invoice_policy': 'delivery', | ||
}) | ||
service_order_01 = self.env['product.product'].create({ | ||
'name': 'Remodeling Service', | ||
'categ_id': self.env.ref('product.product_category_3').id, | ||
'standard_price': 40.0, | ||
'list_price': 90.0, | ||
'type': 'service', | ||
'uom_id': self.env.ref('uom.product_uom_hour').id, | ||
'uom_po_id': self.env.ref('uom.product_uom_hour').id, | ||
'description': 'Example of product to invoice on order', | ||
'default_code': 'PRE-PAID', | ||
'invoice_policy': 'order', | ||
}) | ||
|
||
self.products = { | ||
"serv_order": service_order_01, | ||
"serv_deli": service_delivery, | ||
} | ||
|
||
self.order_idA = self.sale_order.create( | ||
{ | ||
"partner_id": self.partner.id, | ||
"show_price": True, | ||
"show_discount": True, | ||
"order_line": [ | ||
( | ||
0, | ||
0, | ||
{ | ||
"name": p.name, | ||
"product_id": p.id, | ||
"product_uom_qty": 2, | ||
"product_uom": p.uom_id.id, | ||
"price_unit": p.list_price, | ||
}, | ||
) | ||
for (_, p) in self.products.items() | ||
], | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<template id="preview_sale_sale_orderument" inherit_id="sale.sale_order_portal_content"> | ||
<td t-if="display_discount" position="replace"> | ||
<t t-if="sale_order.show_discount"> | ||
<td t-if="display_discount" t-attf-class="text-right {{ 'd-none d-sm-table-cell' if report_type == 'html' else '' }}"> | ||
<strong t-if="line.discount > 0" class="text-info"> | ||
<t t-esc="((line.discount % 1) and '%s' or '%d') % line.discount"/>% | ||
</strong> | ||
</td> | ||
</t> | ||
<t t-if="not sale_order.show_discount"> | ||
<td t-if="display_discount" class="text-right">-N.A.-</td> | ||
</t> | ||
</td> | ||
<xpath expr="//table[@id='sales_order_table']/tbody/t[2]/tr/t/td[3]" position="replace"> | ||
<t t-if="sale_order.show_price"> | ||
<td t-attf-class="text-right {{ 'd-none d-sm-table-cell' if report_type == 'html' else '' }}"> | ||
<div t-field="line.price_unit"/> | ||
</td> | ||
</t> | ||
<t t-if="not sale_order.show_price"> | ||
<td class="text-right">-N.A.-</td> | ||
</t> | ||
</xpath> | ||
<xpath expr="//table[@id='sales_order_table']/tbody/t[2]/tr/t/td[hasclass('text-right')][2]" position="replace"> | ||
<t t-if="sale_order.show_price"> | ||
<td class="text-right"> | ||
<span class="oe_order_line_price_subtotal" t-field="line.price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/> | ||
<span class="oe_order_line_price_total" t-field="line.price_total" groups="account.group_show_line_subtotals_tax_included"/> | ||
</td> | ||
</t> | ||
<t t-if="not sale_order.show_price"> | ||
<td class="text-right" groups="account.group_show_line_subtotals_tax_excluded">-N.A.-</td> | ||
</t> | ||
</xpath> | ||
<xpath expr="//div[@name='total']" position="replace"> | ||
<div t-attf-class="#{'col-4' if report_type != 'html' else 'col-sm-7 col-md-5'} ml-auto"> | ||
<table class="table table-sm"> | ||
<tr class="border-black" style="border-bottom:1px solid #dddddd;"> | ||
<td><strong>Total Without Taxes</strong></td> | ||
<t t-if="sale_order.show_price"> | ||
<td class="text-right"> | ||
<span | ||
data-id="total_untaxed" | ||
t-field="sale_order.amount_untaxed" | ||
t-options='{"widget": "monetary","display_currency": sale_order.pricelist_id.currency_id}' | ||
/> | ||
</td> | ||
</t> | ||
<t t-if="not sale_order.show_price"> | ||
<td class="text-right">-N.A.-</td> | ||
</t> | ||
</tr> | ||
<t t-foreach="sale_order.amount_by_group" t-as="amount_by_group"> | ||
<tr style="border-bottom:1px solid #dddddd;"> | ||
<t t-if="amount_by_group[3] == 1 and sale_order.amount_untaxed == amount_by_group[2]"> | ||
<t t-if="sale_order.show_price"> | ||
<td> | ||
<span t-esc="amount_by_group[0]"/> | ||
<span>&nbsp;<span>on</span>&nbsp;<t t-esc="amount_by_group[2]" t-options='{"widget": "monetary", "display_currency": sale_order.pricelist_id.currency_id}'/></span> | ||
</td> | ||
<td class="text-right"> | ||
<span t-esc="amount_by_group[1]" | ||
t-options='{"widget": "monetary", "display_currency": sale_order.pricelist_id.currency_id}'/> | ||
</td> | ||
</t> | ||
<t t-if="not sale_order.show_price"> | ||
<td class="text-right">-N.A.-</td> | ||
</t> | ||
</t> | ||
<t t-else =""> | ||
<td> | ||
<span t-esc="amount_by_group[0]"/> | ||
</td> | ||
<t t-if="sale_order.show_price"> | ||
<td class="text-right"> | ||
<span t-esc="amount_by_group[1]" | ||
t-options='{"widget": "monetary", "display_currency": sale_order.pricelist_id.currency_id}'/> | ||
</td> | ||
</t> | ||
<t t-if="not sale_order.show_price"> | ||
<td class="text-right">-N.A.-</td> | ||
</t> | ||
</t> | ||
</tr> | ||
</t> | ||
<tr class="border-black"> | ||
<td><strong>Total</strong></td> | ||
<t t-if="sale_order.show_price"> | ||
<td class="text-right"> | ||
<span data-id="total_amount" t-field="sale_order.amount_total" t-options='{"widget": "monetary", "display_currency": sale_order.pricelist_id.currency_id}'/> | ||
</td> | ||
</t> | ||
<t t-if="not sale_order.show_price"> | ||
<td class="text-right">-N.A.-</td> | ||
</t> | ||
</tr> | ||
</table> | ||
</div> | ||
</xpath> | ||
</template> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
|
||
<template id="report_sale_document_inherits" inherit_id="sale.report_saleorder_document"> | ||
<!-- Discount fields hides from sale quotation report if show and hide price from Quotation --> | ||
<td t-if="display_discount" position="replace"> | ||
<t t-if="doc.show_discount"> | ||
<td t-if="display_discount" class="text-right" groups="product.group_discount_per_so_line"> | ||
<span t-field="line.discount" /> | ||
</td> | ||
</t> | ||
<t t-if="not doc.show_discount"> | ||
<td t-if="display_discount" class="text-right" groups="product.group_discount_per_so_line">-N.A.-</td> | ||
</t> | ||
</td> | ||
<xpath expr="//table[hasclass('table-sm')]/tbody/t[2]/tr/t/td[3]" position="replace"> | ||
<t t-if="doc.show_price"> | ||
<td class="text-right"> | ||
<span t-field="line.price_unit" /> | ||
</td> | ||
</t> | ||
<t t-if="not doc.show_price"> | ||
<td class="text-right">-N.A.-</td> | ||
</t> | ||
</xpath> | ||
<xpath expr="//table[hasclass('table-sm')]/tbody/t[2]/tr/t/td[last()]" position="replace"> | ||
<t t-if="doc.show_price"> | ||
<td class="text-right" groups="account.group_show_line_subtotals_tax_excluded"> | ||
<span t-field="line.price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/> | ||
<span t-field="line.price_total" groups="account.group_show_line_subtotals_tax_included"/> | ||
</td> | ||
</t> | ||
<t t-if="not doc.show_price"> | ||
<td class="text-right" groups="account.group_show_line_subtotals_tax_excluded">-N.A.-</td> | ||
</t> | ||
</xpath> | ||
<xpath expr="//div[@name='total']" position="replace"> | ||
<div class="row" name="total"> | ||
<div t-attf-class="#{'col-4' if report_type != 'html' else 'col-sm-7 col-md-5'} ml-auto"> | ||
<table class="table table-sm"> | ||
<tr class="border-black"> | ||
<td><strong>Total Without Taxes</strong></td> | ||
<t t-if="doc.show_price"> | ||
<td class="text-right"> | ||
<span t-field="doc.amount_untaxed" | ||
t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/> | ||
</td> | ||
</t> | ||
<t t-if="not doc.show_price"> | ||
<td class="text-right">-N.A.-</td> | ||
</t> | ||
</tr> | ||
<t t-foreach="doc.amount_by_group" t-as="amount_by_group"> | ||
<tr> | ||
<td><span t-esc="amount_by_group[0] or 'Taxes'"/></td> | ||
<t t-if="doc.show_price"> | ||
<td class="text-right"> | ||
<span t-esc="amount_by_group[1]" | ||
t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/> | ||
</td> | ||
</t> | ||
<t t-if="not doc.show_price"> | ||
<td class="text-right">-N.A.-</td> | ||
</t> | ||
</tr> | ||
</t> | ||
<tr class="border-black"> | ||
<td><strong>Total</strong></td> | ||
<t t-if="doc.show_price"> | ||
<td class="text-right"> | ||
<span t-field="doc.amount_total" | ||
t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}' /> | ||
</td> | ||
</t> | ||
<t t-if="not doc.show_price"> | ||
<td class="text-right">-N.A.-</td> | ||
</t> | ||
</tr> | ||
</table> | ||
</div> | ||
</div> | ||
</xpath> | ||
</template> | ||
|
||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<odoo> | ||
|
||
<record id="view_order_form_inherit" model="ir.ui.view"> | ||
<field name="name">view.order.form.inherit</field> | ||
<field name="model">sale.order</field> | ||
<field name="inherit_id" ref="sale.view_order_form"/> | ||
<field name="arch" type="xml"> | ||
<field name="payment_term_id" position="after"> | ||
<field name="show_price"/> | ||
<field name="show_discount"/> | ||
</field> | ||
</field> | ||
</record> | ||
|
||
</odoo> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ForamSerpentCS We should have this feature linked with Security groups.
These fields should be seen by ACCOUNT Manager (or top account group).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we may, If we can have security groups for it, then we can manage this feature directly applying field security in template.