'member_price': fields.float('Member Price', digits_compute= dp.get_precision('Sale Price'), required=True, help='Amount for the membership'),
'account_invoice_line': fields.many2one('account.invoice.line', 'Account Invoice line', readonly=True),
'account_invoice_id': fields.related('account_invoice_line', 'invoice_id', type='many2one', relation='account.invoice', string='Invoice', readonly=True),
- 'state': fields.function(_state, method=True,
+ 'state': fields.function(_state,
string='Membership State', type='selection',
selection=STATE, store = {
'account.invoice': (_get_membership_lines, ['state'], 10),
'membership_cancel': False
}
if name == 'membership_start':
- line_id = member_line_obj.search(cr, uid, [('partner', '=', partner_id)],
+ line_id = member_line_obj.search(cr, uid, [('partner', '=', partner_id),('date_cancel','=',False)],
limit=1, order='date_from', context=context)
if line_id:
res[partner.id]['membership_start'] = member_line_obj.read(cr, uid, line_id[0],
['date_from'], context=context)['date_from']
if name == 'membership_stop':
- line_id1 = member_line_obj.search(cr, uid, [('partner', '=', partner_id)],
+ line_id1 = member_line_obj.search(cr, uid, [('partner', '=', partner_id),('date_cancel','=',False)],
limit=1, order='date_to desc', context=context)
if line_id1:
res[partner.id]['membership_stop'] = member_line_obj.read(cr, uid, line_id1[0],
'Membership amount', digits=(16, 2),
help = 'The price negotiated by the partner'),
'membership_state': fields.function(
- __get_membership_state, method=True,
+ __get_membership_state,
string = 'Current Membership State', type = 'selection',
selection = STATE,
store = {
-Invoiced Member: A member whose invoice has been created.
-Paid Member: A member who has paid the membership amount."""),
'membership_start': fields.function(
- _membership_date, method=True, multi = 'membeship_start',
+ _membership_date, multi = 'membeship_start',
string = 'Start membership date', type = 'date',
store = {
'account.invoice': (_get_invoice_partner, ['state'], 10),
'res.partner': (lambda self, cr, uid, ids, c={}: ids, ['free_member'], 10)
}, help="Date from which membership becomes active."),
'membership_stop': fields.function(
- _membership_date, method=True,
+ _membership_date,
string = 'Stop membership date', type='date', multi='membership_stop',
store = {
'account.invoice': (_get_invoice_partner, ['state'], 10),
'res.partner': (lambda self, cr, uid, ids, c={}: ids, ['free_member'], 10)
}, help="Date until which membership remains active."),
'membership_cancel': fields.function(
- _membership_date, method=True,
+ _membership_date,
string = 'Cancel membership date', type='date', multi='membership_cancel',
store = {
'account.invoice': (_get_invoice_partner, ['state'], 11),
return True
_constraints = [
- (_check_recursion, 'Error ! You can not create recursive associated members.', ['associate_member'])
+ (_check_recursion, 'Error ! You cannot create recursive associated members.', ['associate_member'])
]
def copy(self, cr, uid, id, default=None, context=None):
if default is None:
default = {}
- if context is None:
- context = {}
default = default.copy()
default['member_lines'] = []
return super(Partner, self).copy(cr, uid, id, default, context=context)
invoice_tax_obj = self.pool.get('account.invoice.tax')
product_id = product_id or datas.get('membership_product_id', False)
amount = datas.get('amount', 0.0)
- if context is None:
- context={}
invoice_list = []
if type(ids) in (int, long,):
ids = [ids]
line_dict = invoice_line_obj.product_id_change(cr, uid, {},
product_id, False, quantity, '', 'out_invoice', partner.id, fpos_id, price_unit=amount, context=context)
line_value.update(line_dict['value'])
+ line_value['price_unit'] = amount
if line_value.get('invoice_line_tax_id', False):
tax_tab = [(6, 0, line_value['invoice_line_tax_id'])]
line_value['invoice_line_tax_id'] = tax_tab
def write(self, cr, uid, ids, vals, context=None):
"""Overrides orm write method
"""
- if context is None:
- context={}
member_line_obj = self.pool.get('membership.membership_line')
res = super(account_invoice_line, self).write(cr, uid, ids, vals, context=context)
for line in self.browse(cr, uid, ids, context=context):
def unlink(self, cr, uid, ids, context=None):
"""Remove Membership Line Record for Account Invoice Line
"""
- if context is None:
- context={}
member_line_obj = self.pool.get('membership.membership_line')
for id in ids:
ml_ids = member_line_obj.search(cr, uid, [('account_invoice_line', '=', id)], context=context)
account_invoice_line()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: