-
-
Notifications
You must be signed in to change notification settings - Fork 162
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
Conversation
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.
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'
76a6d17
to
8d847b1
Compare
cb767fa
to
992605b
Compare
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.
LGTM, just nitpicking non-blocking comments ;)
@@ -1,32 +1,28 @@ | |||
# -*- coding: utf-8 -*- | |||
# © 2012-2016 Camptocamp SA | |||
# Copyright 2012-2016 Camptocamp SA |
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.
2012-2018, same for other py files
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.
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 |
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.
"""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 |
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.
"""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 |
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.
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 |
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.
"If there are many PDF..."
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.
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"/> |
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.
IMO would be nice to move these settings from the company from view to res.config.settings
Edit : Didn't see you todo ;)
l10n_ch_payment_slip/__manifest__.py
Outdated
'base', | ||
'account', | ||
'report', | ||
'account_invoicing', | ||
'l10n_ch_base_bank', | ||
'base_transaction_id', # OCA/bank-statement-reconcile |
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.
OCA/account-reconcile
self.report1slip_from_inv = self.env.ref( | ||
'l10n_ch_payment_slip.one_slip_per_page_from_invoice', | ||
) | ||
|
||
def make_bank(self): |
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.
Would be great to have these records as demo data as it's impossible to test functionally without it.
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.
👍 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,' |
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.
lefter sounds weird. to the left?
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. |
Reopened as official module is currently not providing all required features. (alignment on printout, reconciliation based on BVR reference) |
717f064
to
0ab85d3
Compare
0ab85d3
to
5ca48fc
Compare
@grindtildeath It has been merged in 10.0, are you asking to add it to 11.0 ? |
36eaeb6
to
f5ad651
Compare
@grindtildeath Will look at it when I get a green Travis. |
3e6b0af
to
76157af
Compare
@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 ? |
3f0a284
to
7996134
Compare
@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 |
534ec4a
to
d963f6e
Compare
d963f6e
to
0f48cf7
Compare
Remove the button "Print ISR" on invoices to avoid confusion with Odoo base implementation and rename the one from this module for user consistency
Fix right error on ISR print
hi, what's the state here? when will this be merged? |
@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') |
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.
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!
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.
@BT-ccebrian makes sense to me.
@grindtildeath can you also add a readonly on that field? AFAIK it should only be set server side.
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.
Fixed in dee27ae
261e6c8
to
ba92eef
Compare
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.
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)
@grindtildeath LG thanks for fixing the tests |
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
ba92eef
to
758393a
Compare
758393a
to
0e06d3c
Compare
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.
I approve as I'm the author of the last commits 😊
Update headers
Port code to python3
Update README
Fix tests with correct report render calls
Adapt code to report module split
TODO: