Skip to content

Commit 1f9ae14

Browse files
FlorianGilbertpraj-odoo
authored andcommitted
[FIX] README.md: Fixing typos
There are 2 typos in the README.md that lead to broken links. closes odoo#196 X-original-commit: 460af3f Signed-off-by: Antoine Vandevenne (anv) <[email protected]>
1 parent 4f1d255 commit 1f9ae14

8 files changed

+95
-2
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Odoo tutorials
22

33
This repository hosts the code for the bases of the modules used in the
4-
[official Odoo tutorials](https://www.odoo.com/documentation/lastest/developer/tutorials.html).
4+
[official Odoo tutorials](https://www.odoo.com/documentation/latest/developer/tutorials.html).
55

66
It has 3 branches for each Odoo version: one for the bases, one for the
77
[Discover the JS framework](https://www.odoo.com/documentation/latest/developer/tutorials/discover_js_framework.html)
88
tutorial's solutions, and one for the
9-
[Master the Odoo web framework](https://www.odoo.com/documentation/lastest/developer/tutorials/master_odoo_web_framework.html)
9+
[Master the Odoo web framework](https://www.odoo.com/documentation/latest/developer/tutorials/master_odoo_web_framework.html)
1010
tutorial's solutions. For example, `17.0`, `17.0-discover-js-framework-solutions` and
1111
`17.0-master-odoo-web-framework-solutions`.

book_price/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Part of Odoo. See LICENSE file for full copyright and licensing details.
2+
3+
from . import models

book_price/__manifest__.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Part of Odoo. See LICENSE file for full copyright and licensing details.
2+
3+
{
4+
'name': "Book Price",
5+
'category': "Sales/Sales",
6+
'description': "This is the add-on module that enables 'Book Price' field into order lines ofnSales Orders and Invoicing to let the client know of actual price and adjusted price.",
7+
'version': "1.0",
8+
'depends':['sale_management', 'account'],
9+
'data': [
10+
'views/sale_order_line.xml',
11+
'views/account_move_line.xml',
12+
],
13+
'installable': True,
14+
'application': True,
15+
'license': "LGPL-3",
16+
}

book_price/models/__init__.py

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Part of Odoo. See LICENSE file for full copyright and licensing details.
2+
3+
from . import sale_order_line
4+
from . import account_move_line
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Part of Odoo. See LICENSE file for full copyright and licensing details.
2+
3+
from odoo import api, fields, models
4+
5+
class AccountMoveLine(models.Model):
6+
_inherit = 'account.move.line'
7+
8+
book_price = fields.Float(string='Book Price', compute='_compute_book_price', store=True)
9+
10+
@api.depends('product_id', 'quantity', 'move_id.invoice_origin')
11+
def _compute_book_price(self):
12+
for line in self:
13+
line.book_price = 0.0
14+
if not (line.product_id and line.move_id.invoice_origin):
15+
continue
16+
17+
sale_order = self.env['sale.order'].search([('name', "=", line.move_id.invoice_origin)], limit=1)
18+
if sale_order:
19+
sale_order_line = self.env['sale.order.line'].search([
20+
('order_id', "=", sale_order.id),
21+
('product_id', "=", line.product_id.id)
22+
], limit=1)
23+
if sale_order_line:
24+
line.book_price = sale_order_line.book_price

book_price/models/sale_order_line.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Part of Odoo. See LICENSE file for full copyright and licensing details.
2+
3+
from odoo import models, fields, api
4+
5+
class SaleOrderLine(models.Model):
6+
_inherit = 'sale.order.line'
7+
8+
book_price = fields.Float(string="Book Price", compute='_compute_book_price', store=True)
9+
10+
@api.depends('product_id', 'product_uom_qty', 'order_id.pricelist_id')
11+
def _compute_book_price(self):
12+
for line in self:
13+
if line.product_id and line.order_id.pricelist_id:
14+
price, _ = line.order_id.pricelist_id._get_product_price_rule(
15+
line.product_id, line.product_uom_qty
16+
)
17+
line.book_price = price
18+
else:
19+
line.book_price = 0.0
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<odoo>
3+
<record id="acount_move_form_inherit" model="ir.ui.view">
4+
<field name="name">account.move.form.inherit</field>
5+
<field name="model">account.move</field>
6+
<field name="inherit_id" ref ="account.view_move_form"/>
7+
<field name="arch" type="xml">
8+
<xpath expr="//field[@name='invoice_line_ids']/list/field[@name='quantity']" position="before">
9+
<field name="book_price" readonly="1" />
10+
</xpath>
11+
</field>
12+
</record>
13+
</odoo>

book_price/views/sale_order_line.xml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<odoo>
3+
<record id="view_order_form_inherit" model="ir.ui.view">
4+
<field name="name">sale.order.form.inherit</field>
5+
<field name="model">sale.order</field>
6+
<field name="inherit_id" ref="sale.view_order_form" />
7+
<field name="arch" type="xml">
8+
<xpath expr="//field[@name='order_line']/list/field[@name='price_unit']"
9+
position="before">
10+
<field name="book_price" readonly="1" />
11+
</xpath>
12+
</field>
13+
</record>
14+
</odoo>

0 commit comments

Comments
 (0)