-
-
Notifications
You must be signed in to change notification settings - Fork 690
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
[12.0][MIG] account_invoice_line_default_account #1143
[12.0][MIG] account_invoice_line_default_account #1143
Conversation
…Therp) and Alexandre Fayolle (CampToCamp): - No hyphenation in module description - Better module name - Typo's fixed - Streamline access to context dictionary: context.get('key') (../account-financial-tools-6.1 rev 100.1.2)
(../account-financial-tools-6.1 rev 100.1.3)
(../account-financial-tools-6.1 rev 100.1.4)
…pplier (../account-financial-tools-6.1 rev 101)
(../account-financial-tools-6.1 rev 103)
4a08ff6
to
7100a50
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.
Thanks for adding tests.
Some minor remarks.
I remember when I ported to v10 that lot of code had to be rewritten, that's why I squashed all the old commits. I don't think it is useful to recover all those old commits and I would squash them all into a single commit or at least reduce them a lot.
account_id = fields.Many2one(default=_account_id_default) | ||
|
||
@api.onchange('account_id') | ||
def _onchange_account_id(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.
maybe better to use a different name to not have to call super
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.
Thanks for the review!
I can see no harm in calling super
, actually it looks to me like a common thing to call super
when overriding a method; why should this case be treated in a different way?
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.
Before api.onchange
, there could be only a single method called on an onchange. With api.onchange
you can have multiple different methods. The conditions are not to test if super has to be called or not but if this method has to be executed. So I find the current implementation hard to read.
Nevertheless it will work. Just a minor remark.
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.
That makes perfect sense: overriding the method is really needed only when you want to edit the method's behavior, but that does not have to be the way to go with the onchange
methods.
I have done this change too, with a bit of explanation in the comments, let me know if it looks better now :)
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.
Looks clear now
def _onchange_account_id(self): | ||
if not self.account_id or not self.partner_id or self.product_id: | ||
return super(AccountInvoiceLine, self)._onchange_account_id() | ||
if self._context.get('journal_id'): |
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.
self.env.context
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.
Thanks, done :)
/ocabot migration account_invoice_line_default_account |
8a10d2b
to
fc1935f
Compare
fc1935f
to
ed04280
Compare
[ADD] account_invoice_line_default_account [IMP] account_invoice_line_default_account: updated with new OCA guidelines [FIX] pep8, README.rst [FIX] view_load is deprecated [FIX] fields.property definition have changed [FIX] from . import + contributors [FIX] account_invoice_line_default_account: Adding the partner in the context of invoice line of customer invoice. It's there in standard in supplier invoices but not in customer invoices and it's required by this module [ADD]account_invoice_line_default_account: default income account on partner similar to default expense account [ADD] translations fr/nl [FIX] __openerp__ file [IMP] look and feel [FIX] pep8
account_invoice_line_default_account: search based on xmlid as name is translatable [FIX] pylint
ed04280
to
f5d3e2f
Compare
@jbaudoux I squashed most of the commits, and added the __openerp__.py removal in Can you update your review? Github is not allowing me to re-request you to do it
@rafaelbn thanks, I'm sorry I forgot to do those things |
f5d3e2f
to
28c8e70
Compare
@@ -16,6 +16,9 @@ | |||
'data': ['views/account_invoice_view.xml', | |||
'views/report_invoice.xml'], | |||
'depends': ['account'], | |||
'excludes': [ |
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.
Why the 2 modules cannot work together?
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 wrote it in the commit message:
This module is not compatible with account_invoice_line_sequence because them both add to the context of invoice lines in invoice form view
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
.travis.yml
Outdated
- TESTS="1" ODOO_REPO="OCA/OCB" EXCLUDE="account_invoice_line_default_account" | ||
- TESTS="1" ODOO_REPO="OCA/OCB" EXCLUDE="account_invoice_line_sequence" | ||
- TESTS="1" ODOO_REPO="odoo/odoo" MAKEPOT="1" EXCLUDE="account_invoice_line_default_account" | ||
- TESTS="1" ODOO_REPO="odoo/odoo" MAKEPOT="1" EXCLUDE="account_invoice_line_sequence" |
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.
Can runboat be informed about this?
https://runboat.odoo-community.org/api/v1/builds/bf7e8fb88-cda7-4c02-a0c2-5717acb6d8bf/init-log
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.
Runboat currently does not support conflicting addons, see sbidoul/runboat#36
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.
Proposing SirTakobi#1 to avoid basing on context and thus incompatibilities
@eLBati there are some things that do not really convince me in SirTakobi#1. Instead of working on the linked PR, can we go on with the merge of this migration alone? Since we already have enough approvals, this module might finally be merged for the first time! 😄 |
@OCA/accounting-maintainers can this be merged or do I have to change something? Thanks! |
Uhm yes, this SirTakobi#1 |
This module is not compatible with account_invoice_line_sequence because them both add to the context of invoice lines in invoice form view
…which is always executed while adding invoice lines
5750f24
to
cec3b69
Compare
Now that you explained those changes, I merged them :) Just for future reference, my doubts were about choosing the onchange on |
…s account set on line
@eLBati can you update your review now? Thanks! |
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.
Thanks
@OCA/accounting-maintainers can this be merged? There are a few happy reviewers already 😄 |
@OCA/accounting-maintainers can this be merged? Thanks! |
1 similar comment
@OCA/accounting-maintainers can this be merged? Thanks! |
/ocabot merge nobump |
What a great day to merge this nice PR. Let's do it! |
Congratulations, your PR was merged at 395f875. Thanks a lot for contributing to OCA. ❤️ |
Migrating/Adding account_invoice_line_default_account to
12.0
.This poor module has a troubled history: as far as I have found, it was brought from launchpad's
6.1
(unmerged) to8.0
with #23, then #189, and finally #356 (currently still open).Then a migration to
10.0
happened in #351 (currently still open).I tried to put together something like a consistent commit history and this is the result, with a last commit for migrating to
12.0
.Additional notes:
I added some tests 🎉
There is a fixup commit because I couldn't find where the__openerp__
was removed between [8.0] account_invoice_line_default_account #356 and [10.0] account_invoice_line_default_account #351, I didn't squash it in order not to mix authorships, but I can do it if @jbaudoux agreesAbout the roadmap:
account.invoice.line._onchange_account_id
I already tried substitutingwrite
withupdate
but that results in not updating the partner (can be verified with the tests),account.invoice.line.account_id
, currently the module assumes the previousdefault
method is the one defined in account but that might not be True; retrieving the field'sdefault
inside the defined method is useless because it has already been changed to the defined methodIf you have any suggestion it is welcome
Looking at the linked PRs and commits, @jbaudoux you might want to have a look :)