Browse Source

[MIG] customer_outstanding_statement: Migration to 10.0

pull/324/head
mreficent 8 years ago
parent
commit
f509549413
  1. 2
      customer_outstanding_statement/README.rst
  2. 2
      customer_outstanding_statement/__manifest__.py
  3. 9
      customer_outstanding_statement/report/customer_outstanding_statement.py
  4. 2
      customer_outstanding_statement/static/description/index.html
  5. 5
      customer_outstanding_statement/tests/test_customer_outstanding_statement.py
  6. 2
      customer_outstanding_statement/views/statement.xml
  7. 2
      customer_outstanding_statement/wizard/customer_outstanding_statement_wizard.py
  8. 6
      customer_outstanding_statement/wizard/customer_outstanding_statement_wizard.xml

2
customer_outstanding_statement/README.rst

@ -33,7 +33,7 @@ To use this module, you need to:
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot :alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/91/9.0
:target: https://runbot.odoo-community.org/runbot/91/10.0
Bug Tracker Bug Tracker
=========== ===========

2
customer_outstanding_statement/__openerp__.py → customer_outstanding_statement/__manifest__.py

@ -5,7 +5,7 @@
{ {
'name': 'Customer Outstanding Statement', 'name': 'Customer Outstanding Statement',
'version': '9.0.1.0.0',
'version': '10.0.1.0.0',
'category': 'Accounting & Finance', 'category': 'Accounting & Finance',
'summary': 'OCA Financial Reports', 'summary': 'OCA Financial Reports',
'author': "Eficent, Odoo Community Association (OCA)", 'author': "Eficent, Odoo Community Association (OCA)",

9
customer_outstanding_statement/report/customer_outstanding_statement.py

@ -4,8 +4,8 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from datetime import datetime, timedelta from datetime import datetime, timedelta
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
from openerp import api, fields, models
from odoo.tools.misc import DEFAULT_SERVER_DATE_FORMAT
from odoo import api, fields, models
class CustomerOutstandingStatement(models.AbstractModel): class CustomerOutstandingStatement(models.AbstractModel):
@ -15,8 +15,7 @@ class CustomerOutstandingStatement(models.AbstractModel):
def _format_date_to_partner_lang(self, str_date, partner_id): def _format_date_to_partner_lang(self, str_date, partner_id):
lang_code = self.env['res.partner'].browse(partner_id).lang lang_code = self.env['res.partner'].browse(partner_id).lang
lang_id = self.env['res.lang']._lang_get(lang_code)
lang = self.env['res.lang'].browse(lang_id)
lang = self.env['res.lang']._lang_get(lang_code)
date = datetime.strptime(str_date, DEFAULT_SERVER_DATE_FORMAT).date() date = datetime.strptime(str_date, DEFAULT_SERVER_DATE_FORMAT).date()
return date.strftime(lang.date_format) return date.strftime(lang.date_format)
@ -258,7 +257,7 @@ class CustomerOutstandingStatement(models.AbstractModel):
return res return res
@api.multi @api.multi
def render_html(self, data):
def render_html(self, docids, data):
company_id = data['company_id'] company_id = data['company_id']
partner_ids = data['partner_ids'] partner_ids = data['partner_ids']
date_end = data['date_end'] date_end = data['date_end']

2
customer_outstanding_statement/static/description/index.html

@ -8,7 +8,7 @@
<img src="Outstanding_Statement.png"> <img src="Outstanding_Statement.png">
</div> </div>
</div> </div>
<div class="oe_span6">
<div class="oe_span4">
<p class="oe_mt32"><div style="text-align:justify">The outstanding statement provides details of all outstanding <p class="oe_mt32"><div style="text-align:justify">The outstanding statement provides details of all outstanding
customer receivables up to a particular date. This includes all unpaid invoices, unclaimed customer receivables up to a particular date. This includes all unpaid invoices, unclaimed
refunds and outstanding payments. The list is displayed in chronological order and is split refunds and outstanding payments. The list is displayed in chronological order and is split

5
customer_outstanding_statement/tests/test_customer_outstanding_statement.py

@ -3,7 +3,7 @@
# (http://www.eficent.com) # (http://www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from openerp.tests.common import TransactionCase
from odoo.tests.common import TransactionCase
class TestCustomerOutstandingStatement(TransactionCase): class TestCustomerOutstandingStatement(TransactionCase):
@ -60,7 +60,8 @@ class TestCustomerOutstandingStatement(TransactionCase):
) )
data = wiz_id._prepare_outstanding_statement() data = wiz_id._prepare_outstanding_statement()
report = self.statement_model.render_html(data)
docids = data['partner_ids']
report = self.statement_model.render_html(docids, data)
self.assertIsInstance(report, str, self.assertIsInstance(report, str,
"There was an error while compiling the report.") "There was an error while compiling the report.")
self.assertIn("<!DOCTYPE html>", report, self.assertIn("<!DOCTYPE html>", report,

2
customer_outstanding_statement/views/statement.xml

@ -6,7 +6,7 @@
<div class="row"> <div class="row">
<div class="col-xs-5 col-xs-offset-7"> <div class="col-xs-5 col-xs-offset-7">
<span t-field="o.name"/><br/> <span t-field="o.name"/><br/>
<span t-raw="o._address_display(None, None)[o.id].replace('\n\n', '\n').replace('\n', '&lt;br&gt;')"/>
<span t-raw="o.contact_address.replace('\n\n', '\n').replace('\n', '&lt;br&gt;')"/>
<span t-field="o.vat"/> <span t-field="o.vat"/>
</div> </div>
<h4 style="padding-left:20em"> <h4 style="padding-left:20em">

2
customer_outstanding_statement/wizard/customer_outstanding_statement_wizard.py

@ -4,7 +4,7 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from datetime import date from datetime import date
from openerp import api, fields, models
from odoo import api, fields, models
class CustomerOutstandingStatementWizard(models.TransientModel): class CustomerOutstandingStatementWizard(models.TransientModel):

6
customer_outstanding_statement/wizard/customer_outstanding_statement_wizard.xml

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<odoo>
<!-- wizard action on res.partner --> <!-- wizard action on res.partner -->
<act_window id="customer_outstanding_statement_wizard_action" <act_window id="customer_outstanding_statement_wizard_action"
name="Customer Outstanding Statement" name="Customer Outstanding Statement"
@ -45,5 +44,4 @@
</form> </form>
</field> </field>
</record> </record>
</data>
</openerp>
</odoo>
Loading…
Cancel
Save