Skip to content

Conversation

@Tisho99
Copy link
Contributor

@Tisho99 Tisho99 commented Jul 26, 2024

The account_payment_purchase says that the new fields (Bank Account and Payment Mode) are copied from partner to purchase order, but they are not.

This PR fixes it, but respecting the constrains of the compute of account_payment_partner, the payment mode has to require a bank account to copy the bank account. (Related with #1303)

I have added this constraint to the compute of the bank_account_id of the purchase, but it can be manually edited.

I have also adapted the _onchange_purchase_auto_complete to use the new function.

T-6102

@Tisho99 Tisho99 force-pushed the 17.0-imp-account_payment_purchase branch from 8a6bf67 to c91c941 Compare July 26, 2024 09:26
@Tisho99
Copy link
Contributor Author

Tisho99 commented Jul 26, 2024

@Tisho99 Tisho99 marked this pull request as ready for review July 26, 2024 09:37
@Tisho99
Copy link
Contributor Author

Tisho99 commented Jul 26, 2024

Hi @victoralmau

This PR overrides a function you created last month (#1303), but it respects the account_payment_partner compute and your test. Maybe you are interested

A review would also be appreciated

Thank you!

@Tisho99 Tisho99 force-pushed the 17.0-imp-account_payment_purchase branch from c91c941 to 74103b9 Compare July 26, 2024 10:40
@Tisho99 Tisho99 marked this pull request as draft July 26, 2024 10:44
@Tisho99 Tisho99 force-pushed the 17.0-imp-account_payment_purchase branch from 74103b9 to c0e5006 Compare July 26, 2024 10:59
@Tisho99 Tisho99 marked this pull request as ready for review July 26, 2024 11:13
Copy link
Contributor

@manuelregidor manuelregidor left a comment

Choose a reason for hiding this comment

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

Technical review. LGTM

@HaraldPanten
Copy link

@Tisho99 You commented that this PR is fixing a functionallity of the module. Souldn't it be a FIX, instead of an IMP, then?

@Tisho99 Tisho99 changed the title [IMP] account_payment_purchase: copy the fields to supplier invoices. [FIX] account_payment_purchase: copy the fields to supplier invoices. Jul 29, 2024
@HaraldPanten
Copy link

@Tisho99 What about the commit message?

@Tisho99 Tisho99 force-pushed the 17.0-imp-account_payment_purchase branch from c0e5006 to d1aa866 Compare July 29, 2024 08:23
@Tisho99
Copy link
Contributor Author

Tisho99 commented Jul 29, 2024

@Tisho99 What about the commit message?

Updated

Copy link

@HaraldPanten HaraldPanten left a comment

Choose a reason for hiding this comment

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

@pedrobaeza Doesn't it make sense to you?

THX

@pedrobaeza pedrobaeza changed the title [FIX] account_payment_purchase: copy the fields to supplier invoices. [17.0][FIX] account_payment_purchase: copy the fields to supplier invoices. Jul 29, 2024
@pedrobaeza pedrobaeza added this to the 17.0 milestone Jul 29, 2024
Comment on lines 51 to 52
else:
order.payment_mode_id = False
Copy link
Member

Choose a reason for hiding this comment

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

This part should go out. The payment mode should remain to the existing one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, the module already sets it to False, but i think you are right. i'll change it

Comment on lines 69 to 72
res = super()._prepare_invoice()
vals = {"payment_mode_id": self.payment_mode_id.id}
if self.payment_mode_id.payment_method_id.bank_account_required:
vals["partner_bank_id"] = self.supplier_partner_bank_id.id
else:
res.pop("partner_bank_id")
res.update(vals)
return res
Copy link
Member

Choose a reason for hiding this comment

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

Please avoid the use of an intermediate dictionary:

Suggested change
res = super()._prepare_invoice()
vals = {"payment_mode_id": self.payment_mode_id.id}
if self.payment_mode_id.payment_method_id.bank_account_required:
vals["partner_bank_id"] = self.supplier_partner_bank_id.id
else:
res.pop("partner_bank_id")
res.update(vals)
return res
res = super()._prepare_invoice()
res["payment_mode_id"]: self.payment_mode_id.id
res.pop("partner_bank_id", False)
if self.payment_mode_id.payment_method_id.bank_account_required:
res["partner_bank_id"] = self.supplier_partner_bank_id.id
return res

@Tisho99 Tisho99 force-pushed the 17.0-imp-account_payment_purchase branch from d1aa866 to 1a75664 Compare July 29, 2024 12:31
@Tisho99
Copy link
Contributor Author

Tisho99 commented Jul 29, 2024

Hi @pedrobaeza

I applied your requested changes

Thank you for the review!

Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

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

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 17.0-ocabot-merge-pr-1326-by-pedrobaeza-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit fb48d7e into OCA:17.0 Jul 29, 2024
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 316a732. Thanks a lot for contributing to OCA. ❤️

@HaraldPanten HaraldPanten deleted the 17.0-imp-account_payment_purchase branch July 29, 2024 14:41
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.

5 participants