Skip to content

Commit 4ed8e89

Browse files
author
Jacob Hicks
committed
[IMP] Refactor and layout improvements
1 parent de21fa4 commit 4ed8e89

File tree

6 files changed

+68
-29
lines changed

6 files changed

+68
-29
lines changed

sale_pricelist_discount/README.rst

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
2+
:alt: License: AGPL-3
3+
4+
Sale Pricelist Discount
5+
=======================
6+
7+
This module allows specifying a default percentage discount to apply
8+
to sale order lines. This ensures the pricelist discount is visible
9+
on quotations and sale orders.
10+
11+
Installation
12+
============
13+
14+
Nothing special is needed to install this module.
15+
16+
Configuration
17+
=============
18+
19+
Pricelist configuration:
20+
21+
* Add discount percentage value to pricelist items for which the
22+
discount should be visible on sale order lines
23+
24+
Usage
25+
=====
26+
27+
* Select pricelist on sale order line
28+
29+
* The discount defined on pricelist item will be populated as
30+
the sale order line discount percentage
31+
32+
Known issues / Roadmap
33+
======================
34+
35+
* Incompatible with product_visible_discount
36+
37+
Credits
38+
=======
39+
40+
Contributors
41+
------------
42+
43+
* Jacob Hicks <jacob.hicks@credativ.co.uk>
44+
45+
Maintainer
46+
----------
47+
48+
.. image:: http://odoo-community.org/logo.png
49+
:alt: Odoo Community Association
50+
:target: http://odoo-community.org
51+
52+
This module is maintained by the OCA.
53+
54+
OCA, or the Odoo Community Association, is a nonprofit organization whose
55+
mission is to support the collaborative development of Odoo features and
56+
promote its widespread use.
57+
58+
To contribute to this module, please visit http://odoo-community.org.

sale_pricelist_discount/__init__.py

-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#
33
# OpenERP, Open Source Management Solution
44
# Copyright (C) 2015 credativ ltd (<http://www.credativ.co.uk>).
5-
# All Rights Reserved
65
#
76
# This program is free software: you can redistribute it and/or modify
87
# it under the terms of the GNU Affero General Public License as
@@ -20,5 +19,3 @@
2019
##############################################################################
2120

2221
from . import model
23-
24-
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

sale_pricelist_discount/__openerp__.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#
33
# OpenERP, Open Source Management Solution
44
# Copyright (C) 2015 credativ ltd (<http://www.credativ.co.uk>).
5-
# All Rights Reserved
65
#
76
# This program is free software: you can redistribute it and/or modify
87
# it under the terms of the GNU Affero General Public License as
@@ -28,17 +27,16 @@
2827
to sale order lines. This ensures the pricelist discount is visible
2928
on quotations and sale orders.
3029
""",
31-
'author': 'credativ',
30+
'author': 'credativ, Odoo Community Association (OCA)',
3231
'website': 'http://www.credativ.co.uk',
3332
'depends': [
3433
'base',
3534
'sale',
3635
'product',
3736
],
38-
'update_xml': [
37+
'data': [
3938
'view/pricelist_view.xml'
4039
],
4140
'auto_install': False,
4241
'installable': True,
4342
}
44-
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

sale_pricelist_discount/model/__init__.py

-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#
33
# OpenERP, Open Source Management Solution
44
# Copyright (C) 2015 credativ ltd (<http://www.credativ.co.uk>).
5-
# All Rights Reserved
65
#
76
# This program is free software: you can redistribute it and/or modify
87
# it under the terms of the GNU Affero General Public License as
@@ -21,5 +20,3 @@
2120

2221
from . import pricelist
2322
from . import sale
24-
25-
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

sale_pricelist_discount/model/pricelist.py

+8-16
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#
44
# OpenERP, Open Source Management Solution
55
# Copyright (C) 2015 credativ ltd (<http://www.credativ.co.uk>).
6-
# All Rights Reserved
76
#
87
# This program is free software: you can redistribute it and/or modify
98
# it under the terms of the GNU Affero General Public License as
@@ -20,23 +19,16 @@
2019
#
2120
##############################################################################
2221

23-
from openerp.osv import fields, osv
22+
from openerp import fields, models
2423
import openerp.addons.decimal_precision as dp
2524

2625

27-
class product_pricelist_item(osv.osv):
26+
class ProductPricelistItem(models.Model):
2827
_inherit = 'product.pricelist.item'
2928

30-
_columns = {
31-
'discount': fields.float(
32-
'Discount (%)',
33-
digits_compute=dp.get_precision('Discount'),
34-
help="Default discount applied on a sale order line.",
35-
),
36-
}
37-
38-
_defaults = {
39-
'discount': 0.0,
40-
}
41-
42-
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
29+
discount = fields.Float(
30+
'Discount (%)',
31+
digits_compute=dp.get_precision('Discount'),
32+
help="Default discount applied on a sale order line.",
33+
default=0.0,
34+
)

sale_pricelist_discount/model/sale.py

-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#
44
# OpenERP, Open Source Management Solution
55
# Copyright (C) 2015 credativ ltd (<http://www.credativ.co.uk>).
6-
# All Rights Reserved
76
#
87
# This program is free software: you can redistribute it and/or modify
98
# it under the terms of the GNU Affero General Public License as
@@ -53,5 +52,3 @@ def product_id_change(
5352
cr, uid, [rule_id], ['discount'])[0]['discount'] or 0.00
5453

5554
return res
56-
57-
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

0 commit comments

Comments
 (0)