-
-
Notifications
You must be signed in to change notification settings - Fork 401
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_payment_show_invoice #242
[12.0][MIG] account_payment_show_invoice #242
Conversation
Currently translated at 100.0% (2 of 2 strings) Translation: account-payment-11.0/account-payment-11.0-account_payment_show_invoice Translate-URL: https://translation.odoo-community.org/projects/account-payment-11-0/account-payment-11-0-account_payment_show_invoice/de/
<field name="inherit_id" ref="account.view_account_payment_tree"/> | ||
<field name="arch" type="xml"> | ||
<field name="partner_id" position="after"> | ||
<field name="invoice_vendor_references"/> |
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.
@lreficent , I change from invoice_ids to invoice_vendor_references. (not sure invoice_ids is your intention?)
class AccountPayment(models.Model): | ||
_inherit = 'account.payment' | ||
|
||
@api.multi |
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.
@lreficent I change from api.one -> api.multi. In the past, I heard that we should always use api.multi since api.one have performance issue.
But I also see many code using api.one, not sure the performance was fixed. Please suggest.
77f9707
to
8861a83
Compare
_inherit = 'account.payment' | ||
|
||
@api.multi | ||
def _compute_invoice_vendor_references(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.
i think that it is a good practice to include ensure_one() if you change the api from one to multi.
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.
Here, I think the reason to use multi is oppose of using ensure_one() here isn't it? We use multi because we want to compute once for all records.
Please correct me if I am wrong.
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 I double think, should that not be @api.depends('invoice_ids')?
Because the field should be changed in case the 'invoice_ids' are changed.
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.
ok, you are right, after we discussed it I agree that @api.multi without ensure_one is fine. : ))
@@ -0,0 +1 @@ | |||
from . import test_payment_ref_invoice |
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.
dont't we need a license text here?
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 will add it.
<odoo> | ||
|
||
<record id="view_account_supplier_payment_tree" model="ir.ui.view"> | ||
<field name="name">account.supplier.payment.tree - show invoice</field> |
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.
Is changing the name required?
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 you suggest please? I am not sure what you means (I just migrate from original)
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.
In the original is "account.supplier.payment.tree" and here it is "account.supplier.payment.tree - show invoice", I am just not sure if it should be changed or not : )
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.
Yes. I just check from v11 also. And it also has the - show invoice
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.
True, I am sorry. I have overseen it. That here all is fine.
</record> | ||
|
||
<record id="view_account_payment_tree" model="ir.ui.view"> | ||
<field name="name">account.supplier.payment.tree - show invoice</field> |
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.
same as above.
@@ -0,0 +1,431 @@ | |||
<?xml version="1.0" encoding="utf-8" ?> |
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.
Is this file changed, for me it looks like the one in v11?
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.
This one, I did follow the instruction by using oca-gen-addon-readme
for payment in self: | ||
ref = payment.invoice_ids.mapped(lambda x: x.reference or x.number) | ||
ref.sort() | ||
payment.invoice_vendor_references = ', '.join(ref) |
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 like this function implementation much more than in v11, good job!
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.
Thank you :)
It looks good, even better in v11. I just have couple of questions before I approve it. |
8861a83
to
a451bb6
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.
ok, so only the api question is left.
_inherit = 'account.payment' | ||
|
||
@api.multi | ||
def _compute_invoice_vendor_references(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.
When I double think, should that not be @api.depends('invoice_ids')?
Because the field should be changed in case the 'invoice_ids' are changed.
<odoo> | ||
|
||
<record id="view_account_supplier_payment_tree" model="ir.ui.view"> | ||
<field name="name">account.supplier.payment.tree - show invoice</field> |
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.
True, I am sorry. I have overseen it. That here all is fine.
Note really, because this is not store=True field. So, it is not necessary (it will be recomputed every time it is called) |
To use this module, you need to: | ||
|
||
#. Go to 'Invoicing > Vendors > Payments' or to 'Invoicing > Customers > | ||
Payments' |
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 did a function test and did not found the menus mentioned here. Can you please check this too?
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.
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
This PR has the |
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.
"website": "https://odoo-community.org/", |
please change the website in the manifest to: https://github.com/OCA/account-payment
a451bb6
to
eab500d
Compare
Done. |
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.
Code Review
This PR has the |
No description provided.