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

[MIG] l10n_ch_payment_slip: Migration to 11.0 #373

Merged
merged 28 commits into from
Oct 16, 2018

Conversation

yvaucher
Copy link
Member

@yvaucher yvaucher commented Nov 17, 2017

Update headers
Port code to python3
Update README
Fix tests with correct report render calls
Adapt code to report module split

TODO:

  • fixing tests
  • v11 + tests -> moved in another module
  • put bvr parameters on res.confing.settings
  • edit README.rst to explain the difference with Odoo official addon.

@yvaucher yvaucher mentioned this pull request Nov 17, 2017
4 tasks
Copy link
Contributor

@grindtildeath grindtildeath left a comment

Choose a reason for hiding this comment

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

https://github.com/OCA/l10n-switzerland/pull/373/files#diff-788bc5e9535f52e4fdb14b3cf5d6a2e2R15

odoo.report doesn't exist in v11, so it crashes if submodule is in addons_path

2017-11-20 16:18:15,761 1 ERROR ? werkzeug: Error on request:
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/werkzeug/serving.py", line 193, in run_wsgi
    execute(self.server.app)
  File "/usr/local/lib/python3.5/dist-packages/werkzeug/serving.py", line 181, in execute
    application_iter = app(environ, start_response)
  File "/opt/odoo/src/odoo/service/server.py", line 251, in app
    return self.app(e, s)
  File "/opt/odoo/src/odoo/service/wsgi_server.py", line 166, in application
    return application_unproxied(environ, start_response)
  File "/opt/odoo/src/odoo/service/wsgi_server.py", line 154, in application_unproxied
    result = handler(environ, start_response)
  File "/opt/odoo/src/odoo/http.py", line 1297, in __call__
    self.load_addons()
  File "/opt/odoo/src/odoo/http.py", line 1319, in load_addons
    m = __import__('odoo.addons.' + module)
  File "/opt/odoo/src/odoo/modules/module.py", line 82, in load_module
    exec(open(modfile, 'rb').read(), new_mod.__dict__)
  File "<string>", line 1, in <module>
    
  File "/opt/odoo/external-src/l10n-switzerland/l10n_ch_payment_slip/models/__init__.py", line 2, in <module>
    from . import payment_slip
  File "/opt/odoo/external-src/l10n-switzerland/l10n_ch_payment_slip/models/payment_slip.py", line 15, in <module>
    from odoo.report import report_sxw
ImportError: No module named 'odoo.report'

@yvaucher yvaucher force-pushed the 11.0-mig-l10n_ch_payment_slip branch from 76a6d17 to 8d847b1 Compare November 27, 2017 17:05
@yvaucher yvaucher force-pushed the 11.0-mig-l10n_ch_payment_slip branch from cb767fa to 992605b Compare December 1, 2017 20:40
@pedrobaeza pedrobaeza mentioned this pull request Dec 20, 2017
21 tasks
Copy link
Contributor

@simahawk simahawk left a comment

Choose a reason for hiding this comment

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

LGTM, just nitpicking non-blocking comments ;)

@@ -1,32 +1,28 @@
# -*- coding: utf-8 -*-
# © 2012-2016 Camptocamp SA
# Copyright 2012-2016 Camptocamp SA
Copy link
Contributor

Choose a reason for hiding this comment

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

2012-2018, same for other py files

Copy link
Member Author

Choose a reason for hiding this comment

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

When significant changes were made in py files I updated it already (was in 2017 BTW)

# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields


class ResCompany(models.Model):
"""override company in order to add bvr vertical and
"""override company in order to add ISR vertical and
Copy link
Contributor

Choose a reason for hiding this comment

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

"""Add ISR vertical and Horizontal print delta."""

@@ -24,8 +23,8 @@ class AccountMoveLine(models.Model):


class AccountInvoice(models.Model):
"""Inherit account.invoice in order to add bvr
printing functionnalites. BVR is a Swiss payment vector"""
"""Inherit account.invoice in order to add ISR
Copy link
Contributor

Choose a reason for hiding this comment

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

"""Add ISR (Swiss payment vector) printing features."""

@api.multi
def _generate_one_slip_per_page_from_invoice_pdf(self, report_name=None):
"""Generate payment slip PDF(s) from report model.
If there is many pdf they are merged in memory or on
Copy link
Contributor

Choose a reason for hiding this comment

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

blank line after 1st one.

@api.multi
def _generate_one_slip_per_page_from_invoice_pdf(self, report_name=None):
"""Generate payment slip PDF(s) from report model.
If there is many pdf they are merged in memory or on
Copy link
Contributor

Choose a reason for hiding this comment

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

"If there are many PDF..."

Copy link
Contributor

@grindtildeath grindtildeath left a comment

Choose a reason for hiding this comment

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

Maybe we need this commit ?
266e82d

Also I think we should add a dependency on contacts because that's where the res.bank and res.partner.bank menus are defined, and we need these to configure the module properly.

Moreover I get an error when I try to print ISR :



Odoo Server Error

Traceback (most recent call last):
  File "/opt/odoo/src/addons/web/controllers/main.py", line 77, in wrap
    return f(*args, **kwargs)
  File "/opt/odoo/src/addons/web/controllers/main.py", line 1527, in index
    action["report_name"], report_ids, report_data, context])
  File "/opt/odoo/src/odoo/http.py", line 115, in dispatch_rpc
    result = dispatch(method, params)
UnboundLocalError: local variable 'dispatch' referenced before assignment

@@ -2,25 +2,25 @@
<openerp>
<data>
<record model="ir.ui.view" id="company_form_view">
<field name="name">res.company.form.inherit.bvr</field>
<field name="name">res.company.form.inherit.isr</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form"/>
Copy link
Contributor

@grindtildeath grindtildeath Feb 1, 2018

Choose a reason for hiding this comment

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

IMO would be nice to move these settings from the company from view to res.config.settings

Edit : Didn't see you todo ;)

'base',
'account',
'report',
'account_invoicing',
'l10n_ch_base_bank',
'base_transaction_id', # OCA/bank-statement-reconcile
Copy link
Contributor

Choose a reason for hiding this comment

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

OCA/account-reconcile

self.report1slip_from_inv = self.env.ref(
'l10n_ch_payment_slip.one_slip_per_page_from_invoice',
)

def make_bank(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be great to have these records as demo data as it's impossible to test functionally without it.

Copy link

@tschanzt tschanzt left a comment

Choose a reason for hiding this comment

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

👍 if you get travis to run.

isr_delta_horz = fields.Float(
'ISR Horz. Delta (inch)',
oldname='bvr_delta_horz',
help='horiz. delta in inch 1.2 will print the ISR 1.2 inch lefter,'
Copy link

Choose a reason for hiding this comment

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

lefter sounds weird. to the left?

@yvaucher
Copy link
Member Author

I'll close this PR as odoo is now managing the payment slip officially again.

If the official module lacks features we can still create other modules. On the other hand it might not be the right time to make lot of changes as the QR invoices will replace this.

@yvaucher yvaucher closed this Apr 19, 2018
@yvaucher yvaucher reopened this Jun 22, 2018
@yvaucher
Copy link
Member Author

Reopened as official module is currently not providing all required features. (alignment on printout, reconciliation based on BVR reference)

@TDu TDu force-pushed the 11.0-mig-l10n_ch_payment_slip branch 2 times, most recently from 717f064 to 0ab85d3 Compare June 25, 2018 13:32
@grindtildeath
Copy link
Contributor

@TDu Can you please integrate the content of this PR as well ? #411

@TDu TDu force-pushed the 11.0-mig-l10n_ch_payment_slip branch from 0ab85d3 to 5ca48fc Compare June 25, 2018 13:43
@TDu
Copy link
Member

TDu commented Jun 25, 2018

@grindtildeath It has been merged in 10.0, are you asking to add it to 11.0 ?

@TDu TDu force-pushed the 11.0-mig-l10n_ch_payment_slip branch 2 times, most recently from 36eaeb6 to f5ad651 Compare June 25, 2018 15:21
@TDu
Copy link
Member

TDu commented Jun 26, 2018

@grindtildeath Will look at it when I get a green Travis.

@TDu TDu force-pushed the 11.0-mig-l10n_ch_payment_slip branch 3 times, most recently from 3e6b0af to 76157af Compare June 26, 2018 11:55
@TDu
Copy link
Member

TDu commented Jun 26, 2018

@grindtildeath Unfortunately it is not straightforward to incorporate your PR in 11.0. Some methods have moved or been dropped, could you have a look at it ?

@TDu TDu force-pushed the 11.0-mig-l10n_ch_payment_slip branch from 3f0a284 to 7996134 Compare June 26, 2018 15:43
@grindtildeath
Copy link
Contributor

@TDu I cherry-picked and tried to fix but there's a few things not working yet, can you please check it as you already did most of the migration ? Thx
yvaucher#2

@yvaucher yvaucher force-pushed the 11.0-mig-l10n_ch_payment_slip branch 3 times, most recently from 534ec4a to d963f6e Compare August 21, 2018 08:14
@yvaucher yvaucher force-pushed the 11.0-mig-l10n_ch_payment_slip branch from d963f6e to 0f48cf7 Compare August 21, 2018 13:22
p-tombez and others added 4 commits August 23, 2018 17:32
Remove the button "Print ISR" on invoices to avoid confusion with Odoo base
implementation and rename the one from this module for user consistency
@BT-ojossen
Copy link
Contributor

hi, what's the state here? when will this be merged?

@yvaucher
Copy link
Member Author

@BT-ojossen this is in a ready state, but for the unit tests which are still red. Thus to answer your question, it will be merged when the tests are fixed.


_name = 'bvr.batch.print.wizard'
_name = 'isr.batch.print.wizard'

invoice_ids = fields.Many2many(comodel_name='account.invoice',
string='Invoices')
error_message = fields.Text('Errors')
Copy link

Choose a reason for hiding this comment

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

Hi @yvaucher, I think it is a silly mistake but,

When you get the related error in the batch print wizard, the error is editable, in my point of view it is a little bit annoying.

Regards!

Copy link
Member Author

@yvaucher yvaucher Sep 20, 2018

Choose a reason for hiding this comment

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

@BT-ccebrian makes sense to me.

@grindtildeath can you also add a readonly on that field? AFAIK it should only be set server side.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fixed in dee27ae

@grindtildeath grindtildeath force-pushed the 11.0-mig-l10n_ch_payment_slip branch from 261e6c8 to ba92eef Compare September 20, 2018 15:25
Copy link
Contributor

@simahawk simahawk left a comment

Choose a reason for hiding this comment

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

LG.
Runbot is not really red, is yellow because of warnings unrelated to this module.

One thing: we might want to mention in a TODO that the merge mode machinery could/should be splitted into reporting-engine module(s)

@yvaucher
Copy link
Member Author

@grindtildeath LG thanks for fixing the tests

grindtildeath and others added 6 commits September 21, 2018 11:38
Restore report_type to reportlab-pdf

Improvement to batch wizard, error readonly
`payment_slip._get_address_lines` computes the address of the partner.

This is done in an onchange context whereas the changes where not isolated
and they were propagated to the real partner
via all the onchanges related to it.

We spotted the issue on the mail compose wizard
whereas the chain of onchanges was wiping all the default values.

With this change we:

* isolate the partner w/ a fake record
* additionally we cache the result per each partner
  since the function is called several times
@grindtildeath grindtildeath force-pushed the 11.0-mig-l10n_ch_payment_slip branch from ba92eef to 758393a Compare September 21, 2018 09:38
@grindtildeath grindtildeath force-pushed the 11.0-mig-l10n_ch_payment_slip branch from 758393a to 0e06d3c Compare September 21, 2018 09:52
Copy link
Contributor

@grindtildeath grindtildeath left a comment

Choose a reason for hiding this comment

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

I approve as I'm the author of the last commits 😊

@yvaucher yvaucher merged commit 98de7e4 into OCA:11.0 Oct 16, 2018
@yvaucher yvaucher deleted the 11.0-mig-l10n_ch_payment_slip branch October 17, 2019 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants