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

10.0 Port purchase_fiscal_position_update #280

Merged
merged 3 commits into from
Nov 16, 2016

Conversation

alexis-via
Copy link
Contributor

No description provided.

@angelmoya
Copy link
Member

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
Copy link
Member

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):
Copy link
Member

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()

Copy link
Contributor Author

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 !

Copy link
Member

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

Copy link
Contributor Author

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 !)

Copy link
Member

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

@pedrobaeza pedrobaeza mentioned this pull request Oct 11, 2016
38 tasks
@pedrobaeza pedrobaeza merged commit 64c0480 into OCA:10.0 Nov 16, 2016
MiquelRForgeFlow pushed a commit to ForgeFlow/purchase-workflow that referenced this pull request Aug 9, 2019
MiquelRForgeFlow pushed a commit to ForgeFlow/purchase-workflow that referenced this pull request Aug 9, 2019
MiquelRForgeFlow pushed a commit to ForgeFlow/purchase-workflow that referenced this pull request Aug 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants