-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[ADD] product_pricelist: Book price added in Sale Order Line #398
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
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
03ad262
[ADD] product_pricelist: models and views are inherited
ppch-odoo 4cd71df
[IMP] product_pricelist: defined _compute_book_price for invoice line
ppch-odoo eed4ae3
[IMP] product_pricelist: some changes done
ppch-odoo ef05a40
[IMP] product_pricelist: optimized code for _compute_book_price
ppch-odoo 128c007
[IMP] product_pricelist: improved Product Pricelist by some changes
ppch-odoo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
'name': "Book Price (Pricelist Price)", | ||
'version': '1.0', | ||
'depends': ['sale_management'], | ||
'author': "ppch", | ||
'category': 'Category', | ||
'description': """ | ||
Book Price (Pricelist Price) on sales order lines and invoice lines | ||
which will be used to compare between Book Price (Pricelist Price) and | ||
manually adjusted price on the lines. | ||
""", | ||
'license': "LGPL-3", | ||
'data': [ | ||
'views/sale_order_line_views.xml', | ||
'views/account_move_line_views.xml', | ||
], | ||
'installable': True, | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import account_move_line | ||
from . import sale_order_line |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from odoo import api, fields, models | ||
|
||
|
||
class AccountMoveLine(models.Model): | ||
_inherit = "account.move.line" | ||
|
||
book_price = fields.Float(related='sale_line_ids.book_price') |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from odoo import api, fields, models | ||
|
||
|
||
class SaleOrderLine(models.Model): | ||
_inherit = "sale.order.line" | ||
|
||
book_price = fields.Float(string="Book Price", compute='_compute_book_price') | ||
|
||
@api.depends('product_id', 'product_uom_qty', 'order_id.pricelist_id') | ||
def _compute_book_price(self): | ||
for record in self: | ||
if not record.product_id: | ||
record.book_price = 0.0 | ||
continue | ||
|
||
pricelist = record.order_id.pricelist_id if record.order_id else None | ||
if pricelist: | ||
record.book_price = pricelist._get_product_price( | ||
record.product_id, record.product_uom_qty | ||
) | ||
else: | ||
record.book_price = record.product_id.lst_price |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<record id="account_move_form_inherit_book_price" model="ir.ui.view"> | ||
<field name="name">account.move.form.inherite.book.price</field> | ||
<field name="model">account.move</field> | ||
<field name="inherit_id" ref="account.view_move_form"/> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//notebook//page//field[@name='invoice_line_ids']//list//field[@name='quantity']" position="before"> | ||
<field name="book_price" readonly="True" column_invisible="context.get('default_move_type') != 'out_invoice'"/> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<record id="sale_order_form_inherit_book_price" model="ir.ui.view"> | ||
<field name="name">sale.order.form.inherite.book.price</field> | ||
<field name="model">sale.order</field> | ||
<field name="inherit_id" ref="sale.view_order_form"/> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//notebook//page//list//field[@name='product_uom_qty']" position="before"> | ||
<field name="book_price" readonly="True"/> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |
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.
Uh oh!
There was an error while loading. Please reload this page.