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]stock_picking_report_valued: Fix #305. Avoid error when no sale line is linked to move line. #329

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from

Conversation

javierjcf
Copy link

The issue #305 is due to the Subtotal and Total fields being of type Monetary. These fields require the currency_id field to be correctly calculated. Currently, the currency_id field is a related field from the sales line, which may not exist. This PR changes the field from related to computed, and if there is no associated sales line, it takes the currency from the company.

Comment on lines 52 to 56
line.currency_id = (
line.sale_line.currency_id.id
if line.sale_line
else line.company_id.currency_id.id
)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
line.currency_id = (
line.sale_line.currency_id.id
if line.sale_line
else line.company_id.currency_id.id
)
line.currency_id = (
line.sale_line.currency_id.id
or line.company_id.currency_id.id
)

Copy link
Member

Choose a reason for hiding this comment

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

What about this?

@pedrobaeza pedrobaeza added this to the 16.0 milestone Jun 27, 2024
@javierjcf javierjcf force-pushed the 16.0-fix-stock-picking-report-valued branch from 61881b5 to 6b22909 Compare June 27, 2024 11:36
related="sale_line.currency_id", readonly=True, string="Sale Currency"
comodel_name='res.currency',
compute="_compute_sale_currency_id",
readonly=True,
Copy link
Member

Choose a reason for hiding this comment

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

computed fields are readonly by default.

@javierjcf javierjcf force-pushed the 16.0-fix-stock-picking-report-valued branch 3 times, most recently from 63adde2 to 527c261 Compare June 27, 2024 11:41
@javierjcf javierjcf force-pushed the 16.0-fix-stock-picking-report-valued branch from 527c261 to e692596 Compare June 27, 2024 11:43
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.

2 participants