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

[ADD] sale_order_report_with_note (migrated sale_order_webkit to v8 in qweb and renamed the module) #33

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 3 additions & 8 deletions README.md
@@ -1,5 +1,5 @@
[![Build Status](https://travis-ci.org/OCA/sale-reporting.svg?branch=8.0)](https://travis-ci.org/OCA/sale-reporting)
[![Coverage Status](https://coveralls.io/repos/OCA/sale-reporting/badge.png?branch=8.0)](https://coveralls.io/r/OCA/sale-reporting?branch=8.0)
[![Build Status](https://travis-ci.org/OCA/sale-reporting.svg?branch=9.0)](https://travis-ci.org/OCA/sale-reporting)
[![Coverage Status](https://coveralls.io/repos/OCA/sale-reporting/badge.png?branch=9.0)](https://coveralls.io/r/OCA/sale-reporting?branch=9.0)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you change this to v9? this is still v8

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange this is not done in the last commit, not sure when and why it was changed.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it's weird, it was added in the very first one (dfebab3). Just revert the change ✂️


Sale Reporting
==============
Expand All @@ -8,17 +8,12 @@ This project aim to deal with modules related to manage sale report.
You'll find modules that implement various report related to sales in general.

[//]: # (addons)
Available addons
----------------
addon | version | summary
--- | --- | ---
[sale_comment_template](sale_comment_template/) | 8.0.1.4.0 | Comments texts templates on Sale documents

Unported addons
---------------
addon | version | summary
--- | --- | ---
[html_sale_product_note](html_sale_product_note/) | 1.0.1 (unported) | HTML note in product reported in sale order report
[sale_comment_template](sale_comment_template/) | 8.0.1.4.0 (unported) | Comments texts templates on Sale documents
[sale_note_flow](sale_note_flow/) | 1.0.0 (unported) | HTML note from sale order in invoice
[sale_order_proforma_webkit](sale_order_proforma_webkit/) | 1.1.1 (unported) | New webkit report
[sale_order_webkit](sale_order_webkit/) | 1.1.3 (unported) | Sales Order Report using Webkit Library
Expand Down
2 changes: 1 addition & 1 deletion sale_comment_template/__openerp__.py
Expand Up @@ -31,5 +31,5 @@
'security/ir.model.access.csv',
],
"category": "Sale",
"installable": True,
'installable': False,
"active": False, }
72 changes: 72 additions & 0 deletions sale_order_report_with_note/README.rst
@@ -0,0 +1,72 @@
.. image:: https://img.shields.io/badge/license-AGPLv3-blue.svg
:target: https://www.gnu.org/licenses/agpl.html
:alt: License: AGPL-3

===============================
Sale Order Report With Note
===============================

* This module replaces the webkit Quotation / Sale Order report by
a qweb report and adds header and footer notes on the sale order
and quotation


Installation
============

No specific installation requirements.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove not used sections.



Configuration
=============

No configuration is required.


Usage
=====

* To use this module set the header and footer notes in the Condition tab for Sale order.

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/148/8.0

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/sale-reporting/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.


Credits
=======

Images
------

* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.

Contributors
------------

* Vincent Renaville <vincent.renaville@camptocamp.com>
* Jordi Ballester Alomar <jordi.ballester@eficent.com>
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>

Maintainer
----------

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

To contribute to this module, please visit https://odoo-community.org.
9 changes: 9 additions & 0 deletions sale_order_report_with_note/__init__.py
@@ -0,0 +1,9 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2011 Camptocamp SA (http://www.camptocamp.com)
# @author Guewen Baconnier
# © 2015 Eficent Business and IT Consulting Services S.L.
# - Jordi Ballester Alomar

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One line copyrights

# © 2015 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import models
25 changes: 25 additions & 0 deletions sale_order_report_with_note/__openerp__.py
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Camptocamp SA (http://www.camptocamp.com)
# @author Guewen Baconnier Vincent Renaville
# © 2015 Eficent Business and IT Consulting Services S.L.
# - Jordi Ballester Alomar
# © 2015 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

{
'name': 'Sales Order Report with Note',
'version': '8.0.1.0.0',
'category': 'Reports/Qweb',
'license': 'AGPL-3',
"author": "Camptocamp SA,"
"Eficent, "
"Serpent CS,"
"Odoo Community Association (OCA)",
'website': "https://odoo-community.org/",
'depends': ['sale'],
'data': ['security/ir.model.access.csv',
'report/sale_report.xml',
'views/report_saleorder_qweb.xml',
'views/sale_view.xml'],
'installable': True,
}
8 changes: 8 additions & 0 deletions sale_order_report_with_note/models/__init__.py
@@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2011 Camptocamp SA (http://www.camptocamp.com)
# @author Guewen Baconnier
# © 2015 Eficent Business and IT Consulting Services S.L.
# - Jordi Ballester Alomar
# © 2015 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import sale
81 changes: 81 additions & 0 deletions sale_order_report_with_note/models/sale.py
@@ -0,0 +1,81 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Camptocamp SA (http://www.camptocamp.com)
# @author Vincent Renaville
# © 2015 Eficent Business and IT Consulting Services S.L.
# - Jordi Ballester Alomar
# © 2015 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from openerp import api, fields, models, _
from openerp.exceptions import Warning


class SaleConditionText(models.Model):
"""Sale order Textual information"""

_name = "sale.condition_text"
_description = "sale conditions"

name = fields.Char('Condition summary', required=True)
type = fields.Selection([('header', 'Top condition'),
('footer', 'Bottom condition')],
'type', required=True)
text = fields.Html('Condition', translate=True, required=True)


class SaleOrder(models.Model):
"""Adds condition to SO"""

_inherit = "sale.order"
_description = 'Sale Order'

text_condition1 = fields.Many2one('sale.condition_text', 'Header',
domain=[('type', '=', 'header')])
text_condition2 = fields.Many2one('sale.condition_text', 'Footer',
domain=[('type', '=', 'footer')])
note1 = fields.Html('Header')
note2 = fields.Html('Footer')

@api.onchange('text_condition1', 'partner_id')
def set_header(self):
if not self.partner_id:
raise Warning(_('No Customer Defined !'),
_('Before choosing condition text'
'select a customer.'))
ctx = dict(self._context)
lang = self.partner_id.lang or 'en_US'
self.with_context(ctx).write({'lang': lang})
if self.text_condition1:
self.note1 = self.text_condition1.text

@api.onchange('text_condition2', 'partner_id')
def set_footer(self):
if not self.partner_id:
raise Warning(_('No Customer Defined !'),
_('Before choosing condition text'
'select a customer.'))
ctx = dict(self._context)
lang = self.partner_id.lang or 'en_US'
self.with_context(ctx).write({'lang': lang})
if self.text_condition2:
self.note2 = self.text_condition2.text

@api.multi
def print_quotation(self):
'''
This function prints the sales order and mark it as sent,
so that we can see more easily the next step of the workflow
'''
assert len(self.ids) == 1, '''This option should only be used
for a single id at a time'''
self.signal_workflow('quotation_sent')
xml = 'sale_order_report_with_note.report_saleorder_qweb'
return self.env['report'].get_action(self, xml)


class SaleOrderLine(models.Model):
"""ADD HTML note to sale order lines"""

_inherit = "sale.order.line"

formatted_note = fields.Html('Formatted Note')
12 changes: 12 additions & 0 deletions sale_order_report_with_note/report/sale_report.xml
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<report id="sale.report_sale_order"
string="Quotation - Order"
model="sale.order"
name="sale_order_report_with_note.report_saleorder_qweb"
report_type="qweb-pdf"
menu="True"
/>
</data>
</openerp>
3 changes: 3 additions & 0 deletions sale_order_report_with_note/security/ir.model.access.csv
@@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
sale_condition_text_sale_user,sale.condition_text.sale_user,sale_order_report_with_note.model_sale_condition_text,base.group_sale_salesman,1,1,1,0
sale_condition_text_sale_manager,sale.condition_text.sale_manager,sale_order_report_with_note.model_sale_condition_text,base.group_sale_manager,1,1,1,1
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
133 changes: 133 additions & 0 deletions sale_order_report_with_note/static/src/css/so.css
@@ -0,0 +1,133 @@
.list_main_table {
border:thin solid #E3E4EA;
text-align:center;
border-collapse: collapse;
}

table.list_main_table {
margin-top: 20px;
}

.list_main_headers {
padding: 0;
}

.list_main_headers th {
border: thin solid #000000;
padding-right:3px;
padding-left:3px;
background-color: #EEEEEE;
text-align:center;
font-size:12;
font-weight:bold;
}

.list_main_table td {
padding-right:3px;
padding-left:3px;
padding-top:3px;
padding-bottom:3px;
}

.list_main_lines,
.list_main_footers {
padding: 0;
}

.list_main_footers {
padding-top: 15px;
}

.list_main_lines td,
.list_main_footers td,
.list_main_footers th {
border-style: none;
text-align:left;
font-size:12;
padding:0;
}

.list_main_footers th {
text-align:right;
}

td .total_empty_cell {
width: 77%;
}

td .total_sum_cell {
width: 13%;
}

.nobreak {
page-break-inside: avoid;
}

caption.formatted_note {
text-align:left;
border-right:thin solid #EEEEEE;
border-left:thin solid #EEEEEE;
border-top:thin solid #EEEEEE;
padding-left:10px;
font-size:11;
caption-side: bottom;
}

caption.formatted_note p {
margin: 0;
}

.main_col1 {
width: 40%;
}
td.main_col1 {
text-align:left;
}

.main_col2,
.main_col3,
.main_col4,
.main_col6 {
width: 10%;
}

.main_col5 {
width: 7%;
}

td.main_col5 {
text-align: center;
font-style:italic;
font-size: 10;
}

.main_col7 {
width: 13%;
}

.right_table {
right: 4cm;
width:"100%";
}

.std_text {
font-size:12;
}

th.date {
width: 90px;
}

td.amount, th.amount {
text-align: right;
white-space: nowrap;
}

td.date {
white-space: nowrap;
width: 90px;
}

.address .recipient .shipping .invoice {
font-size: 12px;
}