Skip to content
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
Show file tree
Hide file tree
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 Aug 12, 2016
01b2d0c
[REF] : sale_report_hide_price module
JayVora-SerpentCS Aug 12, 2016
733879c
[REF]
JayVora-SerpentCS Dec 16, 2016
7112f38
PEP8 fixes
JayVora-SerpentCS Dec 28, 2016
7e67e22
fixed hide price module
JayVora-SerpentCS Jan 10, 2017
eda8033
[IMP/ADD]Fixed Travis.
hpatelserpentcs May 6, 2017
48524ae
[IMP/ADD]Added Test Case.
hpatelserpentcs May 10, 2017
152dc00
[IMP/ADD]Added partner_credit_limit module.
hpatelserpentcs May 11, 2017
2ec6158
[FIX]Travis Fixed.
hpatelserpentcs May 11, 2017
febef98
added banners
hda May 30, 2017
962ec32
fixed summary
hda Aug 3, 2017
9f9b122
[ADD] Migrated sale_report_hide_price module in v11.
sudhir-serpentcs Nov 3, 2017
e066b7a
[IMP]made improvements, fix travis errors
Arpit-SerpentCS Jan 25, 2018
248ee08
[IMP] add solve travis error
Arpit-SerpentCS Jan 25, 2018
1a5956b
[IMP]made improvemnts in sale report hide and base model
Arpit-SerpentCS Jan 29, 2018
4b75233
[ADD]improvements in js files and added redme.rst file
Arpit-SerpentCS Jan 29, 2018
ff78935
[IMP]removed encoding utf-8 from py files
Arpit-SerpentCS Jan 29, 2018
6f89ce7
[IMP]remove description key in manifest file and improvements in js file
Arpit-SerpentCS Jan 30, 2018
431e771
[IMP] improvements in manifest file
Arpit-SerpentCS Jan 30, 2018
5b27076
[FIX]Fixed travis error and added README.rst file.
shobhapadasalagi Feb 15, 2018
eaab41f
[IMP]Improved License file year.
shobhapadasalagi Feb 20, 2018
7830db8
[IMP]solve travis
Arpit-SerpentCS Mar 13, 2018
121ba47
[IMP]improved index for sale_report_hide_price
NishaGajjar-SerpentCS May 8, 2018
209b82d
[12.0][MIG] Migrated sale_report_hide_price
Chanakya-SerpentCS Dec 24, 2018
e07dc9e
[MIG] Migrated the module in v13.
HarshK-SerpentCS Oct 7, 2019
a6ce7e3
[MIG] Migrated the module in v13.
HarshK-SerpentCS Oct 8, 2019
6d6e4c2
[IMP][13.0] Improved code.
mohil24 Apr 22, 2020
b94470c
[13.0][IMP] sale_report_hide_price : Fixed the travis issue.
RiddhiChavda22 Jun 24, 2020
d41c3f4
[MIG] Migrated the module in v14.
Chandresh-SerpentCS Nov 10, 2020
6ee98cc
[IMP] sale_report_hide_price:improve the comments
pragati-patel98 Dec 10, 2020
820133b
[IMP] sale_report_hide_price : improve the code
pragati-patel98 Dec 11, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions sale_report_hide_price/LICENSE/LICENSE
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/>.
24 changes: 24 additions & 0 deletions sale_report_hide_price/README.rst
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]>
4 changes: 4 additions & 0 deletions sale_report_hide_price/__init__.py
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
20 changes: 20 additions & 0 deletions sale_report_hide_price/__manifest__.py
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,
}
3 changes: 3 additions & 0 deletions sale_report_hide_price/models/__init__.py
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
21 changes: 21 additions & 0 deletions sale_report_hide_price/models/sale.py
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.",
)

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).

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.

Binary file added sale_report_hide_price/static/description/fb.jpg
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.
Binary file added sale_report_hide_price/static/description/in.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
274 changes: 274 additions & 0 deletions sale_report_hide_price/static/description/index.html

Large diffs are not rendered by default.

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.
3 changes: 3 additions & 0 deletions sale_report_hide_price/tests/__init__.py
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
62 changes: 62 additions & 0 deletions sale_report_hide_price/tests/test_sale.py
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()
],
}
)
103 changes: 103 additions & 0 deletions sale_report_hide_price/views/preview_sale_order.xml
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 &gt; 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>&amp;nbsp;<span>on</span>&amp;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>
85 changes: 85 additions & 0 deletions sale_report_hide_price/views/report_saleorder.xml
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>
16 changes: 16 additions & 0 deletions sale_report_hide_price/views/sale_view.xml
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>