-
-
Notifications
You must be signed in to change notification settings - Fork 750
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
10.0 Port purchase_fiscal_position_update #280
10.0 Port purchase_fiscal_position_update #280
Conversation
I did similar work to mig to 9.0, you can see it on #281 |
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: https://runbot.odoo-community.org/runbot/purchase-workflow/10.0 |
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.
You need to set repo_id:
:target: https://runbot.odoo-community.org/runbot/142/10.0
_inherit = "purchase.order" | ||
|
||
@api.onchange('fiscal_position_id') | ||
def fiscal_position_change(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.
you can call to onchange_product_id, I solved on version 9.0 on two lines
for line in self.order_line:
line.onchange_product_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.
For me, it's a mistake to call onchange_product_id because it resets the price/description/... to the default value etc... And that's quite heavy 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.
For me it's not, because any modification in the onchange code via inherited modules is not reflected here, so you will need glue modules. It's also not too heavy working on cached recordset. But it's needed a change in the approach (it seems awkward, but it's the way to go to keep the best compatibility, and it's fast):
for line in self.order_line:
temp_line = line.new(line._convert_to_write(line._cache))
temp_line.onchange_product_id()
line.taxes_id = temp_line.taxes_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.
@pedrobaeza Your code proposal is better. @angelmoya 's code was not right. If an inherited module want to change something, he should do it in the map_tax() method of account.fiscal.position, not here. And by the way, your proposal is 4 lines of code ; mine is exactly the same, so it's not simpler. It just seems crazy for me to call onchange_product_id() which itself calls _suggest_quantity() (which reads supplierinfo !) and _onchange_quantity() (which calls 3 other methods !)
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 @alexis-via use cache is not so easy, so I copy your method
@pedrobaeza your code is not working because previous fiscal position is on cache
No description provided.