[IMP] product_margin : Improve the python code and view
bzr revid: sbh@tinyerp.com-20100608130611-0yi56h4wjq1m4ep3
This commit is contained in:
parent
e139086d81
commit
6de7835f1c
|
@ -26,9 +26,7 @@ import time
|
|||
|
||||
class product_product(osv.osv):
|
||||
_inherit = "product.product"
|
||||
|
||||
|
||||
def _product_margin(self, cr, uid, ids, field_names, arg, context):
|
||||
def _product_margin(self, cr, uid, ids, field_names, arg, context=None):
|
||||
res = {}
|
||||
for val in self.browse(cr, uid, ids,context=context):
|
||||
res[val.id] = {}
|
||||
|
|
|
@ -55,7 +55,6 @@
|
|||
<field name="expected_margin"/>
|
||||
<field name="total_margin_rate" widget="progressbar"/>
|
||||
<field name="expected_margin_rate" widget="progressbar"/>
|
||||
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
|
|
|
@ -26,13 +26,24 @@ import netsvc
|
|||
import time
|
||||
from tools.translate import _
|
||||
class product_margin(osv.osv_memory):
|
||||
'''
|
||||
Product Margin
|
||||
'''
|
||||
|
||||
_name = 'product.margin'
|
||||
_description = 'Product Margin'
|
||||
|
||||
def action_open_window(self, cr, uid, ids, context):
|
||||
_columns = {
|
||||
'from_date': fields.date('From'),
|
||||
'to_date': fields.date('To'),
|
||||
'invoice_state':fields.selection([
|
||||
('paid','Paid'),
|
||||
('open_paid','Open and Paid'),
|
||||
('draft_open_paid','Draft, Open and Paid'),
|
||||
],'Invoice State', select=True, required=True),
|
||||
}
|
||||
_defaults = {
|
||||
'from_date': lambda *a:time.strftime('%Y-01-01'),
|
||||
'to_date':lambda *a:time.strftime('%Y-12-31'),
|
||||
'invoice_state': lambda *a:"open_paid",
|
||||
}
|
||||
def action_open_window(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
|
@ -65,21 +76,4 @@ class product_margin(osv.osv_memory):
|
|||
'search_view_id': id['res_id']
|
||||
}
|
||||
|
||||
|
||||
_columns = {
|
||||
#TODO : import time required to get currect date
|
||||
'from_date': fields.date('From'),
|
||||
#TODO : import time required to get currect date
|
||||
'to_date': fields.date('To'),
|
||||
'invoice_state':fields.selection([
|
||||
('paid','Paid'),
|
||||
('open_paid','Open and Paid'),
|
||||
('draft_open_paid','Draft, Open and Paid'),
|
||||
],'Invoice State', select=True, required=True),
|
||||
}
|
||||
_defaults = {
|
||||
'from_date': lambda *a:time.strftime('%Y-01-01'),
|
||||
'to_date':lambda *a:time.strftime('%Y-12-31'),
|
||||
'invoice_state': lambda *a:"open_paid",
|
||||
}
|
||||
product_margin()
|
||||
|
|
|
@ -28,8 +28,5 @@
|
|||
target="new"
|
||||
key2="client_action_multi"
|
||||
id="product_margin_act_window"/>
|
||||
|
||||
|
||||
|
||||
</data>
|
||||
</data>
|
||||
</openerp>
|
Loading…
Reference in New Issue