[ADD] product_pricelist: Book price added in Sale Order Line#398
Closed
[ADD] product_pricelist: Book price added in Sale Order Line#398
Conversation
Defined _compute_book_price function which will be depends on product_id, quantity and invoice_origin whenever above mentioned field will change on that time based on condition book_price will be calculated task - 4602859
bhra-odoo
requested changes
Feb 26, 2025
Removed store=True as it is not needed. Book price is only visible in customer invoices. Code formatting done task - 4602859
d2c702a to
eed4ae3
Compare
optimized code for _compute_book_price for invoice lines task - 4602859
bhra-odoo
requested changes
Feb 27, 2025
| if pricelist: | ||
| record.book_price = pricelist._get_product_price( | ||
| record.product_id, record.product_uom_qty | ||
| ) * record.product_uom_qty |
Author
There was a problem hiding this comment.
updated
now it will display only for 1 quantity
|
|
||
| @api.depends('product_id', 'quantity', 'move_id.invoice_origin') | ||
| def _compute_book_price(self): | ||
| sale_orders = {so.name: so for so in self.env['sale.order'].search([('name', 'in', self.mapped('move_id.invoice_origin'))])} |
There was a problem hiding this comment.
instead of sale order you can get price;ist
Author
There was a problem hiding this comment.
updated
instead of compute field, book_price is set as related field so no any compute method
- In account_move_line set book_price as related instead of compute field - Instead of displayed book_price for all quantity changed to for only 1 quantity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

quantity and pricelist whenever mentioned field will change on that time
based on condition book_price will be calculated
task - 4602859