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

[FIX] account: Remove partner on changing partner_type or payment_type #32069

Open
wants to merge 1 commit into
base: 12.0
from

Conversation

Projects
None yet
5 participants
@sswapnesh
Copy link
Contributor

sswapnesh commented Mar 23, 2019

Description of the issue/feature this PR addresses: Account module (Customer/Vendor Payment)

Current behavior before PR:

  • Create Payment (Customer)
  • Select Partner Type --> Customer
  • Select Partner --> It will be Customer (As domain will be applied based on Partner Type)
  • Change Partner Type -->Vendor

Still Customer is there which should be removed as Partner Type is changed now

Desired behavior after PR is merged: Remove partner when partner_type or payment_type is changed

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@@ -486,6 +486,7 @@ def _compute_reconciled_invoice_ids(self):
@api.onchange('partner_type')
def _onchange_partner_type(self):
self.ensure_one()
self.partner_id = False

This comment has been minimized.

Copy link
@mreficent

mreficent Mar 25, 2019

Contributor

Why not self.env["res.partner"] as an empty record?

@sswapnesh

This comment has been minimized.

Copy link
Contributor Author

sswapnesh commented Mar 25, 2019

@mreficent

This comment has been minimized.

Copy link
Contributor

mreficent commented Mar 25, 2019

The difference is that False is a boolean, so for example, if you do later (in another onchange or some other place) self.partner_id.company_id, then it will break, as boolean doesn't have company_id field. But if you do as empty record, then it doesn't break.

@sswapnesh

This comment has been minimized.

Copy link
Contributor Author

sswapnesh commented Mar 25, 2019

Thanks
Let's see what odoo says on this.

@sswapnesh

This comment has been minimized.

Copy link
Contributor Author

sswapnesh commented Mar 25, 2019

Ping @qdp-odoo

@qdp-odoo

This comment has been minimized.

Copy link
Contributor

qdp-odoo commented Apr 3, 2019

I dunno

@avw-odoo ?

@sswapnesh

This comment has been minimized.

Copy link
Contributor Author

sswapnesh commented Apr 8, 2019

Or Maybe @mart-e can verify.

@mart-e mart-e added the Accounting label Apr 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.