[MERGE] merge with main branch

bzr revid: mra@mra-laptop-20100713034242-iu8mu2dql3xikx1l
bzr revid: mra@mra-laptop-20100713040258-qipc6idysyh40xff
This commit is contained in:
Mustufa Rangwala 2010-07-13 09:32:58 +05:30
commit 891bbd761c
33 changed files with 866 additions and 597 deletions

View File

@ -491,7 +491,6 @@ class account_move_line(osv.osv):
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'account_move_line_journal_id_period_id_index\'')
if not cr.fetchone():
cr.execute('CREATE INDEX account_move_line_journal_id_period_id_index ON account_move_line (journal_id, period_id)')
cr.commit()
def _check_no_view(self, cr, uid, ids):
lines = self.browse(cr, uid, ids)
@ -923,7 +922,7 @@ class account_move_line(osv.osv):
journal = self.pool.get('account.journal').browse(cr, uid, [journal_id])[0]
if journal.allow_date and period_id:
period = self.pool.get('account.period').browse(cr, uid, [period_id])[0]
if not time.strptime(vals['date'],'%Y-%m-%d')>=time.strptime(period.date_start,'%Y-%m-%d') or not time.strptime(vals['date'],'%Y-%m-%d')<=time.strptime(period.date_stop,'%Y-%m-%d'):
if not time.strptime(vals['date'][:10],'%Y-%m-%d')>=time.strptime(period.date_start,'%Y-%m-%d') or not time.strptime(vals['date'][:10],'%Y-%m-%d')<=time.strptime(period.date_stop,'%Y-%m-%d'):
raise osv.except_osv(_('Error'),_('The date of your Ledger Posting is not in the defined period !'))
else:
return True

File diff suppressed because it is too large Load Diff

View File

@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.6\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
"PO-Revision-Date: 2010-04-10 04:39+0000\n"
"Last-Translator: digitalsatori <Unknown>\n"
"PO-Revision-Date: 2010-07-13 03:49+0000\n"
"Last-Translator: Black Jack <onetimespeed@hotmail.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-06-22 04:10+0000\n"
"X-Launchpad-Export-Date: 2010-07-13 03:49+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account_analytic_analysis
@ -21,7 +21,7 @@ msgstr ""
msgid ""
"Number of hours that can be invoiced plus those that already have been "
"invoiced."
msgstr "小时数能加在已开的发票上"
msgstr ""
#. module: account_analytic_analysis
#: model:ir.model,name:account_analytic_analysis.model_account_analytic_analysis_summary_user
@ -31,12 +31,12 @@ msgstr "用户的小时数合计"
#. module: account_analytic_analysis
#: field:account.analytic.account,last_invoice_date:0
msgid "Last Invoice Date"
msgstr "最近开票日期"
msgstr ""
#. module: account_analytic_analysis
#: help:account.analytic.account,remaining_ca:0
msgid "Computed using the formula: Max Invoice Price - Invoiced Amount."
msgstr "计算公式为:最高发票价格 - 票金额"
msgstr "计算公式为:最高发票价格 - 已开票金额"
#. module: account_analytic_analysis
#: help:account.analytic.account,remaining_hours:0
@ -44,25 +44,26 @@ msgid "Computed using the formula: Maximum Quantity - Hours Tot."
msgstr "计算公式为:最大数量 - 小时合计"
#. module: account_analytic_analysis
#: model:ir.actions.act_window,name:account_analytic_analysis.action_account_analytic_all
#: model:ir.ui.menu,name:account_analytic_analysis.menu_action_account_analytic_all
msgid "All Analytic Accounts"
msgstr "所有辅助核算项"
msgstr "所有辅助核算项"
#. module: account_analytic_analysis
#: model:ir.actions.act_window,name:account_analytic_analysis.action_account_analytic_managed_open
#: model:ir.ui.menu,name:account_analytic_analysis.menu_analytic_account_to_valid_open
msgid "My Current Accounts"
msgstr "我的当前科目"
msgstr "我的当前"
#. module: account_analytic_analysis
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
msgstr "描述视图结构的XML文件无效"
msgstr "无效XML视图结构!"
#. module: account_analytic_analysis
#: help:account.analytic.account,last_invoice_date:0
msgid "Date of the last invoice created for this analytic account."
msgstr "这辅助核算项的最近开票日期"
msgstr "这辅助核算项的最近开票日期"
#. module: account_analytic_analysis
#: field:account.analytic.account,ca_theorical:0
@ -83,13 +84,13 @@ msgstr "计算公式:理论收入 - 总费用"
#: constraint:ir.model:0
msgid ""
"The Object name must start with x_ and not contain any special character !"
msgstr "对象名必须要以X_开头并且不能含有特殊字符!"
msgstr "对象名称必须以“x_”开头且不能包含任何特殊字符"
#. module: account_analytic_analysis
#: model:ir.actions.act_window,name:account_analytic_analysis.action_account_analytic_new
#: model:ir.ui.menu,name:account_analytic_analysis.menu_action_account_analytic_new
msgid "New Analytic Account"
msgstr "新的分析科目"
msgstr "新辅助核算项"
#. module: account_analytic_analysis
#: field:account.analytic.account,theorical_margin:0
@ -105,29 +106,29 @@ msgstr "实际利润(%)"
#: model:ir.actions.act_window,name:account_analytic_analysis.action_account_analytic_all_open
#: model:ir.ui.menu,name:account_analytic_analysis.menu_action_account_analytic_all_open
msgid "Current Analytic Accounts"
msgstr "当前分析科目"
msgstr "当前辅助核算项"
#. module: account_analytic_analysis
#: help:account.analytic.account,last_worked_date:0
msgid "Date of the latest work done on this account."
msgstr "这科目的最近的工作完成日期"
msgstr "这的最近的工作完成日期"
#. module: account_analytic_analysis
#: help:account.analytic.account,last_worked_invoiced_date:0
msgid ""
"If invoice from the costs, this is the date of the latest work or cost that "
"have been invoiced."
msgstr "如果是成本发票,最近工作或成本的时间已开出的发票"
msgstr "如果发票来自费用, 这是最近工作日期或已开票的费用"
#. module: account_analytic_analysis
#: model:ir.ui.menu,name:account_analytic_analysis.menu_invoicing
msgid "Invoicing"
msgstr "计价折扣"
msgstr "开发票"
#. module: account_analytic_analysis
#: field:account.analytic.account,last_worked_date:0
msgid "Date of Last Cost/Work"
msgstr "最近的成本/工作 日期"
msgstr "费用或工作的最近日期"
#. module: account_analytic_analysis
#: field:account.analytic.account,total_cost:0
@ -139,7 +140,7 @@ msgstr "总成本"
msgid ""
"Number of hours you spent on the analytic account (from timesheet). It "
"computes on all journal of type 'general'."
msgstr "你的小时数在辅助核算项目(根据时间表).它计算所有普通分类帐."
msgstr "在辅助核算项你花费的小时数(根据时间表). 它在所有类型为普通的记录集合里计算."
#. module: account_analytic_analysis
#: field:account.analytic.account,remaining_hours:0
@ -190,8 +191,8 @@ msgid ""
"important data for project manager of services companies.\n"
"Add menu to show relevant information for each manager."
msgstr ""
"修改核算到显示服务公司的项目管理主要时间\n"
"添加菜单显示每个管理的有关信息"
"修改辅助核算项到显示视图, 服务公司项目经理的重要数据\n"
"添加菜单显示每个管理者的相关信息"
#. module: account_analytic_analysis
#: field:account.analytic.account,hours_qtt_non_invoiced:0
@ -206,12 +207,12 @@ msgstr "总小时"
#. module: account_analytic_analysis
#: model:ir.ui.menu,name:account_analytic_analysis.menu_account
msgid "Analytic Accounts"
msgstr "核算项"
msgstr "辅助核算项"
#. module: account_analytic_analysis
#: model:ir.module.module,shortdesc:account_analytic_analysis.module_meta_information
msgid "report_account_analytic"
msgstr "核算项报表"
msgstr "辅助核算项报表"
#. module: account_analytic_analysis
#: field:account.analytic.account,ca_invoiced:0
@ -226,7 +227,7 @@ msgstr "财务项目管理"
#. module: account_analytic_analysis
#: field:account.analytic.account,last_worked_invoiced_date:0
msgid "Date of Last Invoiced Cost"
msgstr "最近的发票成本日期"
msgstr "最近的发票日期"
#. module: account_analytic_analysis
#: field:account.analytic.account,ca_to_invoice:0
@ -237,7 +238,7 @@ msgstr "未开票金额"
#: model:ir.actions.act_window,name:account_analytic_analysis.action_account_analytic_all_pending
#: model:ir.ui.menu,name:account_analytic_analysis.menu_action_account_analytic_all_pending
msgid "Pending Analytic Accounts"
msgstr "未决的辅助核算项"
msgstr "未决的辅助核算项"
#. module: account_analytic_analysis
#: field:account.analytic.account,hours_qtt_invoiced:0

View File

@ -90,7 +90,6 @@ class wiz_auc_lots_buyer_map(osv.osv_memory):
for rec in recs:
if rec.ach_login==datas['ach_login']:
lots_obj.write(cr, uid, [rec.id], {'ach_uid': datas['ach_uid']}, context=context)
cr.commit()
return {}
def fields_view_get(self, cr, uid, view_id=None, view_type='form',

View File

@ -73,7 +73,6 @@ class auction_lots_make_invoice(osv.osv_memory):
result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
id = mod_obj.read(cr, uid, result, ['res_id'])
lots_ids = order_obj.seller_trans_create(cr, uid, context['active_ids'], context)
cr.commit()
return {
'domain': "[('id','in', ["+','.join(map(str, lots_ids))+"])]",
'name': 'Seller invoices',

View File

@ -73,7 +73,6 @@ class auction_lots_make_invoice_buyer(osv.osv_memory):
for lot in lots:
up_auction = order_obj.write(cr, uid, [lot.id], {'ach_uid': data['buyer_id']})
lots_ids = order_obj.lots_invoice(cr, uid, context['active_ids'], context, data['number'])
cr.commit()
return {
'domain': "[('id','in', ["+','.join(map(str, lots_ids))+"])]",
'name': 'Buyer invoices',

View File

@ -105,8 +105,8 @@ the rule to mark CC(mail to any other person defined in actions)."),
'act_mail_to_email': fields.char('Mail to these Emails', size=128, \
help="Email-id of the persons whom mail is to be sent"),
'act_mail_body': fields.text('Mail body', help="Content of mail"),
'regex_name': fields.char('Regex on Resource Name', size=128, help="Regular expression for mathching name of the resource\
\ne.g.: urgent.* will search for records having name starting with urgent\
'regex_name': fields.char('Regex on Resource Name', size=128, help="Regular expression for matching name of the resource\
\ne.g.: 'urgent.*' will search for records having name starting with the string 'urgent'\
\nNote: This is case sensitive search."),
'server_action_id': fields.many2one('ir.actions.server', 'Server Action', help="Describes the action name.\neg:on which object which action to be taken on basis of which condition"),
'filter_id':fields.many2one('ir.filters', 'Filter', required=False),

View File

@ -690,7 +690,6 @@ true, it will allow you to hide the event alarm information without removing it.
cr.execute('Update %s set base_calendar_alarm_id=%s, alarm_id=%s \
where id=%s' % (model_obj._table, \
alarm_id, basic_alarm.id, data.id))
cr.commit()
return True
def do_alarm_unlink(self, cr, uid, ids, model, context=None):
@ -714,7 +713,6 @@ true, it will allow you to hide the event alarm information without removing it.
alarm_obj.unlink(cr, uid, alarm_ids)
cr.execute('Update %s set base_calendar_alarm_id=NULL, alarm_id=NULL\
where id=%s' % (model_obj._table, datas.id))
cr.commit()
return True
res_alarm()

View File

@ -48,7 +48,7 @@ class base_setup_config_choice(osv.osv_memory):
user_ids = user_obj.search(cr, uid, [])
users = user_obj.browse(cr, uid, user_ids)
user_str = '\n'.join(map(lambda x: ' - %s: %s / %s' % (x.name, x.login, x.password), users))
return _('The following users have been installed on your database: \n')+ user_str
return _('The following users have been installed : \n')+ user_str
_columns = {
'installed_users':fields.text('Installed Users', readonly=True),

View File

@ -16,7 +16,7 @@
<separator string="" position="vertical" colspan="1" rowspan="8"/>
<group colspan="4" width="400">
<separator string="Installation Done" colspan="4"/>
<label align="0.0" string="Your new database is now fully installed." colspan="4"/>
<label align="0.0" string="Your database is now created." colspan="4"/>
<field name="installed_users" nolabel= "1" colspan="4"/>
</group>
</group>

View File

@ -11,7 +11,7 @@
<attribute name="string">Main Company Setup</attribute>
</form>
<xpath expr="//label[@string='description']" position="attributes">
<attribute name="string">Information of your company will be used to custiomise your documents like Invoices, Sale Orders,...</attribute>
<attribute name="string">Information of your company will be used to custiomise your documents like Invoices, Sale Orders and many more.</attribute>
</xpath>
<xpath expr='//separator[@string="title"]' position='attributes'>
<attribute name='string'>Configure Your Company</attribute>
@ -24,16 +24,16 @@
<group colspan="5">
<group colspan="2">
<field name="company_id" invisible="1"/>
<field name="name" required="True"/><field name="account_no"/>
<field name="currency" widget="selection"/><field name="street"/>
<field name="street2"/>
<field name="country_id"/>
<field name="name" required="True"/><field name="website"/>
<field name="street"/><field name="street2"/>
<field name="zip"/>
<field name="state_id"/>
<field name="city"/>
<field name="email"/>
<field name="country_id"/>
<field name="state_id"/>
<field name="phone"/>
<field name="website"/>
<field name="email"/>
<field name="account_no"/>
<field name="currency" widget="selection"/>
</group>
<newline/>
<group colspan="2" groups="base.group_extended">

View File

@ -124,7 +124,7 @@ class crm_case(object):
stage_pool = self.pool.get('crm.case.stage')
for case in self.browse(cr, uid, ids, context):
if section in s:
st = case.stage_id.id or False
st = not context.get('force_domain', False) and case.stage_id.id or False
if st in s[section]:
data = {'stage_id': s[section][st]}
stage = s[section][st]
@ -141,8 +141,12 @@ class crm_case(object):
if not context:
context = {}
stage_obj = self.pool.get('crm.case.stage')
sid = stage_obj.search(cr, uid, \
[('object_id.model', '=', self._name)], context=context)
tmp = self.read(cr, uid, ids, ['section_id'], context)[0]['section_id']
section_id = tmp and tmp[0] or False
domain = [('object_id.model', '=', self._name), ('section_id', '=', section_id)]
if 'force_domain' in context and context['force_domain']:
domain += context['force_domain']
sid = stage_obj.search(cr, uid, domain, context=context)
s = {}
previous = {}
section = self._name
@ -168,7 +172,7 @@ class crm_case(object):
stage_pool = self.pool.get('crm.case.stage')
for case in self.browse(cr, uid, ids, context):
if section in s:
st = case.stage_id.id or False
st = not context.get('force_domain', False) and case.stage_id.id or False
s[section] = dict([(v, k) for (k, v) in s[section].iteritems()])
if st in s[section]:
data = {'stage_id': s[section][st]}
@ -440,7 +444,7 @@ class crm_case_section(osv.osv):
'active': fields.boolean('Active', help="If the active field is set to \
true, it will allow you to hide the sales team without removing it."),
'allow_unlink': fields.boolean('Allow Delete', help="Allows to delete non draft cases"),
'change_responsible': fields.boolean('Change Responsible', help="Set responsible of this Sales team on escalation to this team"),
'change_responsible': fields.boolean('Change Responsible', help="Thick this box if you want that on escalation, the responsible of this sale team automatically becomes responsible of the lead/opportunity escaladed"),
'user_id': fields.many2one('res.users', 'Responsible User'),
'member_ids':fields.many2many('res.users', 'sale_member_rel', 'section_id', 'member_id', 'Team Members'),
'reply_to': fields.char('Reply-To', size=64, help="The email address put \

View File

@ -177,10 +177,18 @@ and users"),
@param ids: List of case's Ids
@param *args: Give Tuple Value
"""
old_state = self.read(cr, uid, ids, ['state'])[0]['state']
res = super(crm_lead, self).case_open(cr, uid, ids, *args)
self.write(cr, uid, ids, {'date_open': time.strftime('%Y-%m-%d %H:%M:%S')})
if old_state == 'draft':
stage_id = super(crm_lead, self).stage_next(cr, uid, ids, *args)
if not stage_id:
raise osv.except_osv(_('Warning !'), _('There is no stage defined for this Sale Team.'))
value = self.onchange_stage_id(cr, uid, ids, stage_id, context={})['value']
value.update({'date_open': time.strftime('%Y-%m-%d %H:%M:%S'), 'stage_id': stage_id})
self.write(cr, uid, ids, value)
for (id, name) in self.name_get(cr, uid, ids):
message = _('Lead ') + " '" + name + "' "+ _("is Open.")
message = _('The Lead') + " '" + name + "' "+ _("has been written as Open.")
self.log(cr, uid, id, message)
return res
@ -195,7 +203,7 @@ and users"),
res = super(crm_lead, self).case_close(cr, uid, ids, args)
self.write(cr, uid, ids, {'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')})
for (id, name) in self.name_get(cr, uid, ids):
message = _('Lead ') + " '" + name + "' "+ _("is Closed.")
message = _('The Lead') + " '" + name + "' "+ _("has been written as Closed.")
self.log(cr, uid, id, message)
return res

View File

@ -64,9 +64,15 @@ class crm_opportunity(osv.osv):
@param *args: Tuple Value for additional Params
"""
res = super(crm_opportunity, self).case_close(cr, uid, ids, args)
self.write(cr, uid, ids, {'probability' : 100.0, 'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')})
stage_id = super(crm_opportunity, self).stage_next(cr, uid, ids, context={'force_domain': [('probability', '=', 100)]})
if not stage_id:
raise osv.except_osv(_('Warning !'), _('There is no stage for won oppportunities defined for this Sale Team.'))
value = self.onchange_stage_id(cr, uid, ids, stage_id, context={})['value']
value.update({'date_closed': time.strftime('%Y-%m-%d %H:%M:%S'), 'stage_id': stage_id})
self.write(cr, uid, ids, value)
for (id, name) in self.name_get(cr, uid, ids):
message = _('Opportunity ') + " '" + name + "' "+ _("is Won.")
message = _('The Opportunity') + " '" + name + "' "+ _("has been written as Won.")
self.log(cr, uid, id, message)
return res
@ -78,9 +84,16 @@ class crm_opportunity(osv.osv):
@param ids: List of case Ids
@param *args: Tuple Value for additional Params
"""
res = self.write(cr, uid, ids, {'probability' : 0.0, 'state': 'done'})
res = super(crm_opportunity, self).case_close(cr, uid, ids, args)
stage_id = super(crm_opportunity, self).stage_next(cr, uid, ids, context={'force_domain': [('probability', '=', 0)]})
if not stage_id:
raise osv.except_osv(_('Warning !'), _('There is no stage for lost oppportunities defined for this Sale Team.'))
value = self.onchange_stage_id(cr, uid, ids, stage_id, context={})['value']
value.update({'date_closed': time.strftime('%Y-%m-%d %H:%M:%S'), 'stage_id': stage_id})
res = self.write(cr, uid, ids, value)
for (id, name) in self.name_get(cr, uid, ids):
message = _('Opportunity ') + " '" + name + "' "+ _("is Lost.")
message = _('The Opportunity') + " '" + name + "' "+ _("has been written as Lost.")
self.log(cr, uid, id, message)
return res
@ -95,9 +108,22 @@ class crm_opportunity(osv.osv):
res = super(crm_opportunity, self).case_cancel(cr, uid, ids, args)
self.write(cr, uid, ids, {'probability' : 0.0})
return res
def case_reset(self, cr, uid, ids, *args):
"""Overrides reset as draft in order to set the stage field as empty
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case Ids
@param *args: Tuple Value for additional Params
"""
res = super(crm_opportunity, self).case_reset(cr, uid, ids, *args)
self.write(cr, uid, ids, {'stage_id': False})
return True
def case_open(self, cr, uid, ids, *args):
"""Overrides cancel for crm_case for setting Open Date
"""Overrides open for crm_case for setting Open Date
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,

View File

@ -118,8 +118,8 @@ class email_template_send_wizard(osv.osv_memory):
'full_success': lambda *a: False
}
def fields_get(self, cr, uid, fields=None, context=None, read_access=True):
result = super(email_template_send_wizard, self).fields_get(cr, uid, fields, context, read_access)
def fields_get(self, cr, uid, fields=None, context=None, write_access=True):
result = super(email_template_send_wizard, self).fields_get(cr, uid, fields, context, write_access)
if 'attachment_ids' in result and 'src_model' in context:
result['attachment_ids']['domain'] = [('res_model','=',context['src_model']),('res_id','=',context['active_id'])]
return result

View File

@ -53,7 +53,7 @@ class event_event(osv.osv):
def copy(self, cr, uid, id, default=None, context=None):
""" Copy record of Given id
@param id: Id of Event Registration type record.
@param id: Id of Event record.
@param context: A standard dictionary for contextual values
"""
if not default:
@ -65,7 +65,13 @@ class event_event(osv.osv):
return super(event_event, self).copy(cr, uid, id, default=default, context=context)
def onchange_product(self, cr, uid, ids, product_id):
"""This function returns value of product's unit price based on product id.
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of Event IDs
@param product_id: Product's id
"""
if not product_id:
return {'value': {'unit_price': False}}
else:
@ -82,6 +88,13 @@ class event_event(osv.osv):
return self.write(cr, uid, ids, {'state': 'done'}, context=context)
def button_confirm(self, cr, uid, ids, context=None):
"""This Funtion send reminder who had already confirmed their event registration.
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of Event IDs
@param return: True
"""
register_pool = self.pool.get('event.registration')
for event in self.browse(cr, uid, ids, context=context):
if event.mail_auto_confirm:
@ -95,14 +108,12 @@ class event_event(osv.osv):
def _get_register(self, cr, uid, ids, fields, args, context=None):
"""
Get Confirm or uncofirm register value.
"""Get Confirm or uncofirm register value.
@param ids: List of Event registration type's id
@param fields: List of function fields(register_current and register_prospect).
@param context: A standard dictionary for contextual values
@return: Dictionary of function fields value.
"""
register_pool = self.pool.get('event.registration')
res = {}
for event in self.browse(cr, uid, ids, context):
@ -116,7 +127,7 @@ class event_event(osv.osv):
state.append('draft')
reg_ids = register_pool.search(cr, uid, [
('event_id', '=', event.id),
('event_id', '=', event.id),
('state', 'in', state)])
if 'register_current' in fields:
@ -157,7 +168,6 @@ class event_event(osv.osv):
register_pool.write(cr, uid, reg_ids, register_values)
return res
_columns = {
'type': fields.many2one('event.type', 'Type', help="Type of Event like Seminar, Exhibition, Conference, Training."),
'register_max': fields.integer('Maximum Registrations', help="Provide Maximun Number of Registrations"),
@ -183,7 +193,6 @@ class event_event(osv.osv):
'country_id': fields.related('address_id', 'country_id',
type='many2one', relation='res.country', string='Country'),
'language': fields.char('Language',size=64),
}
@ -218,7 +227,7 @@ and users by email"),
"badge_partner": fields.char('Badge Partner', size=128),
"event_product": fields.char("Product Name", size=128, required=True),
"tobe_invoiced": fields.boolean("To be Invoiced"),
"invoice_id": fields.many2one("account.invoice", "Invoice"),
"invoice_id": fields.many2one("account.invoice", "Invoice", readonly=True),
'date_closed': fields.datetime('Closed', readonly=True),
'ref': fields.reference('Reference', selection=crm._links_get, size=128),
'ref2': fields.reference('Reference 2', selection=crm._links_get, size=128),
@ -235,8 +244,8 @@ and users by email"),
def _make_invoice(self, cr, uid, reg, lines, context=None):
""" Create Invoice from Invoice lines
@param reg : Object of event.registration
@param lines: ids of Invoice lines
@param reg : Model of Event Registration
@param lines: Ids of Invoice lines
"""
if context is None:
context = {}
@ -325,11 +334,10 @@ and users by email"),
return new_invoice_ids
def check_confirm(self, cr, uid, ids, context=None):
"""
Check confirm event register on given id.
"""This Function Open Event Registration and send email to user.
@param ids: List of Event registration's IDs
@param context: A standard dictionary for contextual values
@return: Dictionary value which open Confirm registration form.
@return: True
"""
data_pool = self.pool.get('ir.model.data')
unconfirmed_ids = []
@ -360,13 +368,17 @@ and users by email"),
}
return True
def button_reg_close(self, cr, uid, ids, *args):
def button_reg_close(self, cr, uid, ids, *args):
"""This Function Close Event Registration.
"""
registrations = self.browse(cr, uid, ids)
self._history(cr, uid, registrations, _('Done'))
self.write(cr, uid, ids, {'state': 'done', 'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')})
return True
def button_reg_cancel(self, cr, uid, ids, *args):
def button_reg_cancel(self, cr, uid, ids, *args):
"""This Function Cancel Event Registration.
"""
registrations = self.browse(cr, uid, ids)
self._history(cr, uid, registrations, _('Cancel'))
self.write(cr, uid, ids, {'state': 'cancel'})
@ -375,8 +387,8 @@ and users by email"),
def create(self, cr, uid, values, context=None):
""" Overrides orm create method.
"""
event = self.pool.get('event.event').browse(cr, uid, values['event_id'], context=context)
event_obj = self.pool.get('event.event')
event = event_obj.browse(cr, uid, values['event_id'], context=context)
values['date_deadline']= event.date_begin
values['description']= event.mail_confirm
values['currency_id'] = event.currency_id.id
@ -385,9 +397,12 @@ and users by email"),
self._history(cr, uid, registrations, _('Created'))
return res
def write(self, cr, uid, ids, values, context=None):
def write(self, cr, uid, ids, values, context=None):
""" Overrides orm write method.
"""
event_obj = self.pool.get('event.event')
if 'event_id' in values:
event = self.pool.get('event.event').browse(cr, uid, values['event_id'], context=context)
event = event_obj.browse(cr, uid, values['event_id'], context=context)
values['date_deadline']= event.date_begin
values['description']= event.mail_confirm
return super(event_registration, self).write(cr, uid, ids, values, context=context)
@ -439,6 +454,13 @@ and users by email"),
return self.pool.get('account.invoice.line').create(cr, uid, vals)
def onchange_badge_name(self, cr, uid, ids, badge_name):
"""This function returns value of Registration Name based on Partner Badge Name.
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of Registration IDs
@param badge_name: Badge Name
"""
data ={}
if not badge_name:
@ -448,44 +470,77 @@ and users by email"),
def onchange_contact_id(self, cr, uid, ids, contact, partner):
"""This function returns value of Badge Name , Badge Title based on Partner contact.
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of Registration IDs
@param contact: Patner Contact IDS
@param partner: Partner IDS
"""
data ={}
if not contact:
return data
contact_id = self.pool.get('res.partner.contact').browse(cr, uid, contact)
contact_obj = self.pool.get('res.partner.contact')
addr_obj = self.pool.get('res.partner.address')
job_obj = self.pool.get('res.partner.job')
contact_id = contact_obj.browse(cr, uid, contact)
data['badge_name'] = contact_id.name
data['badge_title'] = contact_id.title.name
if partner:
partner_addresses = self.pool.get('res.partner.address').search(cr, uid, [('partner_id', '=', partner)])
job_ids = self.pool.get('res.partner.job').search(cr, uid, [('contact_id', '=', contact), ('address_id', 'in', partner_addresses)])
partner_addresses = addr_obj.search(cr, uid, [('partner_id', '=', partner)])
job_ids = job_obj.search(cr, uid, [('contact_id', '=', contact), ('address_id', 'in', partner_addresses)])
if job_ids:
data['email_from'] = self.pool.get('res.partner.job').browse(cr, uid, job_ids[0]).email
data['email_from'] = job_obj.browse(cr, uid, job_ids[0]).email
d = self.onchange_badge_name(cr, uid, ids, data['badge_name'])
data.update(d['value'])
return {'value': data}
def onchange_event(self, cr, uid, ids, event_id, partner_invoice_id):
"""This function returns value of Product Name, Unit Price based on Event.
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of Registration IDs
@param event_id: Event ID
@param partner_invoice_id: Partner Invoice ID
"""
context={}
if not event_id:
return {'value': {'unit_price': False, 'event_product': False}}
data_event = self.pool.get('event.event').browse(cr, uid, event_id)
event_obj = self.pool.get('event.event')
prod_obj = self.pool.get('product.product')
res_obj = self.pool.get('res.partner')
data_event = event_obj.browse(cr, uid, event_id)
context['currency_id'] = data_event.currency_id.id
if data_event.user_id.id:
return {'value': {'user_id':data_event.user_id.id}}
if data_event.product_id:
if not partner_invoice_id:
unit_price=self.pool.get('product.product').price_get(cr, uid, [data_event.product_id.id], context=context)[data_event.product_id.id]
unit_price=prod_obj.price_get(cr, uid, [data_event.product_id.id], context=context)[data_event.product_id.id]
return {'value': {'unit_price': unit_price, 'event_product': data_event.product_id.name, 'currency_id': data_event.currency_id.id}}
data_partner = self.pool.get('res.partner').browse(cr, uid, partner_invoice_id)
data_partner = res_obj.browse(cr, uid, partner_invoice_id)
context.update({'partner_id': data_partner})
unit_price = self.pool.get('product.product')._product_price(cr, uid, [data_event.product_id.id], False, False, {'pricelist': data_partner.property_product_pricelist.id})[data_event.product_id.id]
unit_price = prod_obj._product_price(cr, uid, [data_event.product_id.id], False, False, {'pricelist': data_partner.property_product_pricelist.id})[data_event.product_id.id]
return {'value': {'unit_price': unit_price, 'event_product': data_event.product_id.name, 'currency_id': data_event.currency_id.id}}
return {'value': {'unit_price': False, 'event_product': False}}
def onchange_partner_id(self, cr, uid, ids, part, event_id, email=False):
"""This function returns value of Patner Invoice id, Unit Price, badget title based on partner and Event.
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of Registration IDs
@param event_id: Event ID
@param partner_invoice_id: Partner Invoice ID
"""
job_obj = self.pool.get('res.partner.job')
res_obj = self.pool.get('res.partner')
data={}
data['badge_partner'] = data['contact_id'] = data['partner_invoice_id'] = data['email_from'] = data['badge_title'] = data['badge_name'] = False
@ -496,35 +551,46 @@ and users by email"),
d = self.onchange_partner_invoice_id(cr, uid, ids, event_id, part)
# this updates the dictionary
data.update(d['value'])
addr = self.pool.get('res.partner').address_get(cr, uid, [part])
addr = res_obj.address_get(cr, uid, [part])
if addr:
if addr.has_key('default'):
job_ids = self.pool.get('res.partner.job').search(cr, uid, [('address_id', '=', addr['default'])])
job_ids = job_obj.search(cr, uid, [('address_id', '=', addr['default'])])
if job_ids:
data['contact_id'] = self.pool.get('res.partner.job').browse(cr, uid, job_ids[0]).contact_id.id
data['contact_id'] = job_obj.browse(cr, uid, job_ids[0]).contact_id.id
d = self.onchange_contact_id(cr, uid, ids, data['contact_id'], part)
data.update(d['value'])
partner_data = self.pool.get('res.partner').browse(cr, uid, part)
partner_data = res_obj.browse(cr, uid, part)
data['badge_partner'] = partner_data.name
return {'value': data}
def onchange_partner_invoice_id(self, cr, uid, ids, event_id, partner_invoice_id):
"""This function returns value of Product unit Price based on Invoiced partner.
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of Registration IDs
@param event_id: Event ID
@param partner_invoice_id: Partner Invoice ID
"""
data={}
context={}
event_obj = self.pool.get('event.event')
prod_obj = self.pool.get('product.product')
res_obj = self.pool.get('res.partner')
data['unit_price']=False
if not event_id:
return {'value': data}
data_event = self.pool.get('event.event').browse(cr, uid, event_id)
data_event = event_obj.browse(cr, uid, event_id)
if data_event.product_id:
data['event_product']=data_event.product_id.name
if not partner_invoice_id:
data['unit_price']=self.pool.get('product.product').price_get(cr, uid, [data_event.product_id.id], context=context)[data_event.product_id.id]
data['unit_price']=prod_obj.price_get(cr, uid, [data_event.product_id.id], context=context)[data_event.product_id.id]
return {'value': data}
data_partner = self.pool.get('res.partner').browse(cr, uid, partner_invoice_id)
data_partner = res_obj.browse(cr, uid, partner_invoice_id)
context.update({'partner_id': data_partner})
data['unit_price'] = self.pool.get('product.product')._product_price(cr, uid, [data_event.product_id.id], False, False, {'pricelist': data_partner.property_product_pricelist.id})[data_event.product_id.id]
data['unit_price'] = prod_obj._product_price(cr, uid, [data_event.product_id.id], False, False, {'pricelist': data_partner.property_product_pricelist.id})[data_event.product_id.id]
return {'value': data}
return {'value': data}

View File

@ -3,8 +3,8 @@
<data>
<menuitem name="Marketing" id="menu_marketing_event_main" icon="terp-calendar" sequence="9"/>
<menuitem name="Events Organisation" id="menu_event_main" parent="menu_marketing_event_main" />
<!-- EVENTS -->
<!--<menuitem name="Events Organisation" id="menu_event_main" icon="terp-calendar" />-->
<!-- EVENTS/CONFIGURATION/TYPE OF EVENTS -->
<record model="ir.ui.view" id="view_event_type_form">
@ -36,7 +36,6 @@
<menuitem name="Configuration" id="menu_event_config" parent="menu_marketing_event_main" sequence="30" groups="base.group_extended"/>
<menuitem name="Types of Events" id="menu_event_type" action="action_event_type" parent="menu_event_config" groups="base.group_extended,crm.group_crm_manager"/>
<!-- Events Organisation/CONFIGURATION/EVENTS -->
<record model="ir.ui.view" id="view_event_form">
@ -69,8 +68,7 @@
<field name="active"/>
<field name="register_min"/>
<field name="register_max"/>
<separator string="Notes" colspan="4"/>
<!--field name="note" colspan="4" nolabel="1"/-->
<newline/>
<field name="state" select="1"/>
<group col="4" colspan="2">
<button string="Confirm Event" name="button_confirm" states="draft" type="object" icon="gtk-apply"/>
@ -113,7 +111,7 @@
</field>
</record>
<!-- event.event tree view -->
<!-- Event tree view -->
<record model="ir.ui.view" id="view_event_tree">
<field name="name">event.event.tree</field>
@ -134,6 +132,8 @@
</field>
</record>
<!-- Events Calendar View -->
<record id="view_event_calendar" model="ir.ui.view">
<field name="name">event.event.calendar</field>
<field name="model">event.event</field>
@ -142,12 +142,12 @@
<field name="arch" type="xml">
<calendar color="user_id" date_start="date_begin" string="Event Organization">
<field name="name"/>
<field name="partner_id"/>
<field name="type" widget="selection"/>
</calendar>
</field>
</record>
<!-- Event Graph view -->
<record model="ir.ui.view" id="view_event_graph">
<field name="name">Event Graph</field>
@ -162,6 +162,8 @@
</field>
</record>
<!-- Event Search View -->
<record model="ir.ui.view" id="view_event_search">
<field name="name">Events</field>
<field name="model">event.event</field>
@ -169,8 +171,8 @@
<field name="arch" type="xml">
<search string="Events">
<group col="10" colspan="4">
<filter icon="terp-document-new" string="Draft" name="draft" domain="[('state','=','draft')]" help="Draft Events"/>
<filter icon="terp-camera_test" string="Confirmed" domain="[('state','=','confirm')]" help="Confirmed Events"/>
<filter icon="terp-check" string="Current" name="draft" domain="[('state','in',('draft', 'confirm'))]" help="Current Events"/>
<filter icon="terp-camera_test" string="Open" domain="[('state','=','confirm')]" help="Open Events"/>
<separator orientation="vertical"/>
<field name="name" string="Event" select="1"/>
<field name="state" select="1"/>
@ -294,15 +296,17 @@
</page>
<page string="Emails" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" string="CC"/>
<field colspan="4" name="email_cc" string="CC" widget="char" size="512"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<form string="Communication history">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
</group>
<group col="4" colspan="4">
<field name="email_from"/>
<field name="date"/>
<field name="email_to" widget="char" size="512"/>
<field name="email_cc" widget="char" size="512"/>
<field name="name" colspan="4" widget="char" size="512"/>
</group>
<notebook colspan="4">
<page string="Details">
<field name="description" colspan="4" nolabel="1"/>

View File

@ -51,7 +51,7 @@
property_account_receivable: account.a_recv
- |
we create it with a "Conference on OpenERP Offshore Business" event and provide "Beginning date", "Ending Date", "Product" as Concert Ticket.
we create it with a "Conference on OpenERP Offshore Business" event and provide "Beginning date", "Ending Date" and "Product" as Concert Ticket.
-
!record {model: event.event, id: event_event_conference0}:
code: C/004
@ -64,9 +64,9 @@
state: draft
type: 'event_type_conference0'
reply_to: 'info@customer.com'
- |
we set the limit of registrations to this event using "Minimum Registrations" 2 and "Maximum Registrations" 10
we set the limit of registrations to this event using "Minimum Registrations" 2 and "Maximum Registrations" 10.
-
!python {model: event.event}: |
self.write(cr, uid, [ref('event_event_conference0')], {'register_max': 10, 'register_min': 2})
@ -96,7 +96,6 @@
!record {model: event.registration, id: event_registration_registrationjacot0}:
badge_name: Jacot
badge_partner: Mark Johnson
badge_title: M.
contact_id: base_contact.res_partner_contact_jacot0
date_deadline: '2010-06-07 13:39:00'
event_id: event.event_event_conference0
@ -110,11 +109,13 @@
if not then confirmation will fail because its greater then the Maximum registration.
-
!python {model: event.event}: |
from tools.translate import _
obj_register = self.pool.get('event.registration')
event_id1 = self.browse(cr, uid, [ref('event_event_conference0')])[0]
event_id1 = self.browse(cr, uid, ref('event_event_conference0'))
register_ids = obj_register.search(cr, uid, [('event_id', '=', event_id1.id)])
register_id = obj_register.browse(cr, uid, register_ids)[0]
assert register_id.nb_register <= event_id1.register_max
assert register_id.nb_register <= event_id1.register_max, _('NO. of Registration for this event is More than Maximum Registration Defined !')
- |
And Confirm that Registration by click on "Confirm Registration" button of Registraion form.
@ -150,7 +151,6 @@
!record {model: event.registration, id: event_registration_registrationpassot0}:
badge_name: Passot
badge_partner: Mediapole SPRL
badge_title: M.
contact_id: base_contact.res_partner_contact_passot0
date_deadline: '2010-06-07 13:39:00'
email_from: info@mediapole.net
@ -170,10 +170,10 @@
I Check that the total number of confirmed is 2 and unconfirmed registrations 1.
-
!python {model: event.event}: |
obj_event = self.browse(cr, uid, [ref('event_event_conference0')])[0]
assert obj_event.register_current == 2
assert obj_event.register_prospect == 1
from tools.translate import _
obj_event = self.browse(cr, uid, ref('event_event_conference0'))
assert obj_event.register_current == 2, "Number of Confirmed Registration for this event is %s"%(obj_event.register_current)
assert obj_event.register_prospect == 1, "Number of Unconfirmed Registration for this event is %s" %(obj_event.register_prospect)
- |
This event is finished by click on "Event Done" button of this event form.
-
@ -186,8 +186,7 @@
!assert {model: event.registration, id: event_registration_registrationjacot0}:
- state == 'open'
- |
Now, I will invoice the participant who have address using "Make Invoices". This wizard will also give the number of invoices are created and rejected.
Create invoice will be linked to Invoice Field available on Payments tab of registrations
Now, I will invoice the participant who have address using "Make Invoices".Create invoice will be linked to Invoice Field available on Payments tab of registrations.
-
!record {model: event.make.invoice, id: event_make_invoice_0}:
@ -201,16 +200,6 @@
I check that Invoice for this partner is created or not.
-
!python {model: event.registration}: |
obj_event_reg = self.pool.get('event.registration')
obj_lines = self.pool.get('account.invoice.line')
inv_obj = self.pool.get('account.invoice')
data_event_reg = obj_event_reg.browse(cr, uid, [ref('event_registration_registrationzen0')], context=context)[0]
invoice_ids = inv_obj.search(cr, uid, [('partner_id', '=', data_event_reg.partner_invoice_id.id)])
if invoice_ids:
invoice_id = inv_obj.browse(cr, uid, invoice_ids)[0]
line_ids = obj_lines.search(cr, uid, [('product_id', '=', data_event_reg.event_id.product_id.id), ('invoice_id', '=', invoice_id.id), ('price_unit', '=', data_event_reg.unit_price)])
line_id = obj_lines.browse(cr, uid, line_ids)[0]
assert line_id.product_id == data_event_reg.event_id.product_id
assert data_event_reg.partner_id == invoice_id.partner_id
assert invoice_id.address_invoice_id == data_event_reg.partner_address_id
from tools.translate import _
data_event_reg = self.browse(cr, uid, ref('event_registration_registrationzen0'), context=context)
assert data_event_reg.invoice_id, _("Invoices has not been generated for this partner")

View File

@ -47,23 +47,29 @@ class partner_event_registration(osv.osv_memory):
}
def open_registration(self, cr, uid, ids, context=None):
"""This Function Open Registration For Given Event id and Partner.
"""
value = {}
res_obj = self.pool.get('res.partner')
job_obj = self.pool.get('res.partner.job')
event_obj = self.pool.get('event.event')
reg_obj = self.pool.get('event.registration')
mod_obj = self.pool.get('ir.model.data')
record_ids = context and context.get('active_ids', []) or []
addr = res_obj.address_get(cr, uid, record_ids)
contact_id = False
email = False
if addr.has_key('default'):
job_ids = self.pool.get('res.partner.job').search(cr, uid, [('address_id', '=', addr['default'])])
job_ids = job_obj.search(cr, uid, [('address_id', '=', addr['default'])])
if job_ids:
contact = self.pool.get('res.partner.job').browse(cr, uid, job_ids[0])
contact = job_obj.browse(cr, uid, job_ids[0])
if contact:
contact_id = contact.contact_id.id
email = contact.email
event_obj = self.pool.get('event.event')
reg_obj = self.pool.get('event.registration')
mod_obj = self.pool.get('ir.model.data')
result = mod_obj._get_id(cr, uid, 'event', 'view_registration_search')
res = mod_obj.read(cr, uid, result, ['res_id'])
@ -123,10 +129,11 @@ class partner_event_registration(osv.osv_memory):
return res
def onchange_event_id(self, cr, uid, ids, event_id, context={}):
res = {}
res = {}
event_obj = self.pool.get('event.event')
if event_id:
obj_event = self.pool.get('event.event')
event = obj_event.browse(cr, uid, event_id)
event = event_obj.browse(cr, uid, event_id)
res['value'] = {
'event_type': event.type and event.type.id or False,
'start_date': event.date_begin,

View File

@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.4\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
"PO-Revision-Date: 2010-05-10 13:18+0000\n"
"Last-Translator: Angel Spy <melissadilara@yahoo.com>\n"
"PO-Revision-Date: 2010-07-12 11:46+0000\n"
"Last-Translator: adsiz_1029@hotmail.com <Unknown>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-06-22 04:15+0000\n"
"X-Launchpad-Export-Date: 2010-07-13 03:49+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: hr

View File

@ -140,7 +140,13 @@ class membership_line(osv.osv):
'''Member line'''
def _check_membership_date(self, cr, uid, ids, context=None):
'''Check if membership product is not in the past'''
"""Check if membership product is not in the past
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of Membership Line IDs
@param context: A standard dictionary for contextual values
"""
cr.execute('''
SELECT MIN(ml.date_to - ai.date_invoice)
@ -158,7 +164,15 @@ class membership_line(osv.osv):
return True
def _state(self, cr, uid, ids, name, args, context=None):
'''Compute the state lines'''
"""Compute the state lines
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of Membership Line IDs
@param name: Field Name
@param context: A standard dictionary for contextual values
@param return: Dictionary of state Value
"""
res = {}
for line in self.browse(cr, uid, ids):
cr.execute('''
@ -221,35 +235,47 @@ class Partner(osv.osv):
_inherit = 'res.partner'
def _get_partner_id(self, cr, uid, ids, context=None):
data_inv = self.pool.get('membership.membership_line').browse(cr, uid, ids, context)
member_line_obj = self.pool.get('membership.membership_line')
res_obj = self.pool.get('res.partner')
data_inv = member_line_obj.browse(cr, uid, ids, context)
list_partner = []
for data in data_inv:
list_partner.append(data.partner.id)
ids2 = list_partner
while ids2:
ids2 = self.pool.get('res.partner').search(cr, uid, [('associate_member','in',ids2)], context=context)
ids2 = res_obj.search(cr, uid, [('associate_member','in',ids2)], context=context)
list_partner += ids2
return list_partner
def _get_invoice_partner(self, cr, uid, ids, context=None):
data_inv = self.pool.get('account.invoice').browse(cr, uid, ids, context)
inv_obj = self.pool.get('account.invoice')
res_obj = self.pool.get('res.partner')
data_inv = inv_obj.browse(cr, uid, ids, context)
list_partner = []
for data in data_inv:
list_partner.append(data.partner_id.id)
ids2 = list_partner
while ids2:
ids2 = self.pool.get('res.partner').search(cr, uid, [('associate_member','in',ids2)], context=context)
ids2 = res_obj.search(cr, uid, [('associate_member','in',ids2)], context=context)
list_partner += ids2
return list_partner
def _membership_state(self, cr, uid, ids, name, args, context=None):
"""This Function return Membership State For Given Partner.
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of Partner IDs
@param name: Field Name
@param context: A standard dictionary for contextual values
@param return: Dictionary of Membership state Value
"""
res = {}
for id in ids:
res[id] = 'none'
today = time.strftime('%Y-%m-%d')
for id in ids:
partner_data = self.browse(cr,uid,id)
partner_data = self.browse(cr, uid, id)
if partner_data.membership_cancel and today > partner_data.membership_cancel:
res[id] = 'canceled'
continue
@ -302,7 +328,7 @@ class Partner(osv.osv):
def _membership_date(self, cr, uid, ids, name, args, context=None):
'''Return date of membership'''
"""Return date of membership"""
name = name[0]
res = {}
@ -404,6 +430,8 @@ class Partner(osv.osv):
}
def _check_recursion(self, cr, uid, ids):
"""Check Recursive for Associated Members.
"""
level = 100
while len(ids):
cr.execute('select distinct associate_member from res_partner where id IN %s',(tuple(ids),))
@ -438,9 +466,11 @@ product_template()
class Product(osv.osv):
def fields_view_get(self, cr, user, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
model_obj = self.pool.get('ir.model.data')
if ('product' in context) and (context['product']=='membership_product'):
model_data_ids_form = self.pool.get('ir.model.data').search(cr,user,[('model','=','ir.ui.view'),('name','in',['membership_products_form','membership_products_tree'])])
resource_id_form = self.pool.get('ir.model.data').read(cr, user, model_data_ids_form, fields=['res_id','name'])
model_data_ids_form = model_obj.search(cr,user,[('model','=','ir.ui.view'),('name','in',['membership_products_form','membership_products_tree'])])
resource_id_form = model_obj.read(cr, user, model_data_ids_form, fields=['res_id','name'])
dict_model={}
for i in resource_id_form:
dict_model[i['name']]=i['res_id']
@ -488,6 +518,8 @@ class account_invoice_line(osv.osv):
_inherit='account.invoice.line'
def write(self, cr, uid, ids, vals, context=None):
"""Overrides orm write method
"""
if not context:
context={}
res = super(account_invoice_line, self).write(cr, uid, ids, vals, context=context)
@ -513,6 +545,8 @@ class account_invoice_line(osv.osv):
return res
def unlink(self, cr, uid, ids, context=None):
"""Remove Membership Line Record for Account Invoice Line
"""
if not context:
context={}
member_line_obj = self.pool.get('membership.membership_line')
@ -522,10 +556,13 @@ class account_invoice_line(osv.osv):
return super(account_invoice_line, self).unlink(cr, uid, ids, context=context)
def create(self, cr, uid, vals, context={}):
"""Overrides orm create method
"""
result = super(account_invoice_line, self).create(cr, uid, vals, context)
line = self.browse(cr, uid, result)
member_line_obj = self.pool.get('membership.membership_line')
if line.invoice_id.type == 'out_invoice':
member_line_obj = self.pool.get('membership.membership_line')
ml_ids = member_line_obj.search(cr, uid, [('account_invoice_line','=',line.id)])
if line.product_id and line.product_id.membership and not ml_ids:
# Product line is a membership product

View File

@ -138,7 +138,7 @@
<field name="arch" type="xml">
<field name="membership_start" position="after">
<newline/>
<group expand="1" string="Group By" colspan="10" col="8">
<group expand="0" string="Group By" colspan="10" col="8">
<filter string="Associate Member" name = "associate" icon="terp-personal" domain="[]" context="{'group_by':'associate_member'}"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'membership_state'}"/>
<separator orientation="vertical"/>
@ -169,7 +169,7 @@
<field name="view_mode">form</field>
<field name="act_window_id" ref="action_membership_members"/>
</record>
<menuitem name="Members" parent="menu_member" id="menu_members" sequence="2" action="action_membership_members"/>
<!-- PARTNERS -->

View File

@ -46,21 +46,9 @@
-
!record {model: membership.invoice, id: membership_invoice_0}:
product_id: membership.product_product_membershipproduct0
- |
I check that address is defined or not for this Member.
-
!python {model: membership.invoice}: |
partner_ids = [ref('res_partner_markjohnson0')]
addre_obj = self.pool.get('res.partner.address')
ids = addre_obj.search(cr, uid, [('partner_id', '=', partner_ids)])
addre_id = addre_obj.browse(cr, uid, ids)[0]
assert addre_id.partner_id
assert addre_id.id
assert addre_id.type
- |
I click on "Confirm" button of this wizard.
I click on "Confirm" button of this wizard. and also check that address is defined or not for this partner in this function.
-
!python {model: membership.invoice}: |
self.membership_invoice(cr, uid, [ref("membership_invoice_0")], {"active_ids": [ref("membership.res_partner_markjohnson0")]})
@ -69,21 +57,20 @@
I check that Invoice is created for this members.
-
!python {model: res.partner}: |
from tools.translate import _
invoice_obj = self.pool.get('account.invoice')
partner_obj = self.pool.get('res.partner')
product_obj = self.pool.get('product.product')
invoice_line_obj = self.pool.get(('account.invoice.line'))
invoice_line_obj = self.pool.get('account.invoice.line')
partner_id = self.browse(cr, uid, [ref('res_partner_markjohnson0')])[0]
ids = invoice_obj.search(cr, uid, [('partner_id', '=', partner_id.id), ('account_id', '=', partner_id.property_account_receivable.id)])
invoice_id = invoice_obj.browse(cr, uid, ids)[0]
product = product_obj.browse(cr, uid, [ref('product_product_membershipproduct0')], context=context)[0]
partner_id = self.browse(cr, uid, ref('res_partner_markjohnson0'))
inv_ids = invoice_obj.search(cr, uid, [('partner_id', '=', partner_id.id), ('account_id', '=', partner_id.property_account_receivable.id)])
invoice_id = invoice_obj.browse(cr, uid, inv_ids)[0]
product = product_obj.browse(cr, uid, ref('product_product_membershipproduct0'), context=context)
line_ids = invoice_line_obj.search(cr, uid, [('product_id', '=', product.id), ('invoice_id', '=', invoice_id.id)])
line_id = invoice_line_obj.browse(cr, uid, line_ids)[0]
assert line_id.product_id.id == product.id
assert invoice_id.partner_id.id == partner_id.id
assert line_ids, _('Invoices has not been generated for this Member!')
- |
I check that the "Current membership state" will remain same untill opening the invoice.
@ -96,17 +83,17 @@
So, I check that invoice is in draft state then the "membership state" of a member is "Waiting member".
-
!python {model: membership.membership_line}: |
partner_id = self.pool.get('res.partner').browse(cr, uid, [ref('res_partner_markjohnson0')])[0]
ids = self.search(cr, uid, [('partner', '=', partner_id.id)])
current_id = self.browse(cr, uid, ids)[0]
partner_obj = self.pool.get('res.partner')
partner_obj = self.pool.get('res.partner')
inv_obj = self.pool.get('account.invoice')
ids = inv_obj.search(cr, uid, [('partner_id', '=', partner_id.id), ('account_id', '=', partner_id.property_account_receivable.id)])
inv_id = inv_obj.browse(cr, uid, ids)[0]
partner_id = partner_obj.browse(cr, uid, ref('res_partner_markjohnson0'))
member_ids = self.search(cr, uid, [('partner', '=', partner_id.id)])
current_id = self.browse(cr, uid, member_ids)[0]
inv_ids = inv_obj.search(cr, uid, [('partner_id', '=', partner_id.id), ('account_id', '=', partner_id.property_account_receivable.id)])
inv_id = inv_obj.browse(cr, uid, inv_ids)[0]
if inv_id.state == 'draft':
assert current_id == 'waiting'
assert current_id.state == 'waiting'
- |
When the invoice is in open state it become Invoiced Member, When the invoice is in paid state the same "Current membership state" changed to Paid Member.
Now, If we cancel the invoice "Current membership state" changed to Cancel Member.

View File

@ -25,56 +25,48 @@ from tools.translate import _
import tools
class membership_invoice(osv.osv_memory):
"""Membership Invoice"""
_name = "membership.invoice"
_description = "Membership Invoice From Partner"
_columns ={
_description = "Membership Invoice"
_columns = {
'product_id': fields.many2one('product.product','Membership Product', required=True),
}
}
def membership_invoice(self, cr, uid, ids, context={}):
def membership_invoice(self, cr, uid, ids, context=None):
invoice_obj = self.pool.get('account.invoice')
partner_obj = self.pool.get('res.partner')
product_obj = self.pool.get('product.product')
invoice_line_obj = self.pool.get(('account.invoice.line'))
invoice_tax_obj = self.pool.get(('account.invoice.tax'))
partner_ids = context['active_ids']
for data in self.read(cr, uid, ids, context=context):
product_id = data['product_id']
cr.execute('''
SELECT partner_id, id, type
FROM res_partner_address
WHERE partner_id IN %s''',(tuple(partner_ids),))
fetchal = cr.fetchall()
if not fetchal:
raise osv.except_osv(_('Error !'), _('No Address defined for this partner'))
partner_address_ids = {}
for x in range(len(fetchal)):
pid = fetchal[x][0]
id = fetchal[x][1]
type = fetchal[x][2]
if partner_address_ids.has_key(pid) and partner_address_ids[pid]['type'] == 'invoice':
continue
partner_address_ids[pid] = {'id': id, 'type': type}
invoice_list= []
product = product_obj.read(cr, uid, product_id, ['uom_id'], context=context)
for partner_id in partner_ids:
account_id = partner_obj.read(cr, uid, partner_id, ['property_account_receivable'], context=context)['property_account_receivable'][0]
read_fpos = partner_obj.read(cr, uid, partner_id, ['property_account_position'], context=context)
fpos_id = read_fpos['property_account_position'] and read_fpos['property_account_position'][0]
invoice_line_obj = self.pool.get('account.invoice.line')
invoice_tax_obj = self.pool.get('account.invoice.tax')
if not context:
context={}
partner_ids = context.get('active_ids', [])
invoice_list = []
for partner in partner_obj.browse(cr, uid, partner_ids, context=context):
account_id = partner.property_account_receivable and partner.property_account_receivable.id or False
fpos_id = partner.property_account_position and partner.property_account_position.id or False
addr = partner_obj.address_get(cr, uid, [partner.id], ['invoice'])
if not addr.get('invoice', False):
continue
for data in self.browse(cr, uid, ids, context=context):
product_id = data.product_id and data.product_id.id or False
product_uom_id = data.product_id and data.product_id.uom_id.id
quantity = 1
line_value = {
'product_id' : product_id,
}
quantity = 1
line_dict = invoice_line_obj.product_id_change(cr, uid, {}, product_id, product['uom_id'][0], quantity, '', 'out_invoice', partner_id, fpos_id, context=context)
}
line_dict = invoice_line_obj.product_id_change(cr, uid, {},
product_id, product_uom_id, quantity, '', 'out_invoice', partner.id, fpos_id, context=context)
line_value.update(line_dict['value'])
if line_value['invoice_line_tax_id']:
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
invoice_id = invoice_obj.create(cr, uid, {
'partner_id' : partner_id,
'address_invoice_id': partner_address_ids[partner_id]['id'],
'partner_id' : partner.id,
'address_invoice_id': addr.get('invoice', False),
'account_id': account_id,
'fiscal_position': fpos_id or False
}
@ -86,16 +78,17 @@ class membership_invoice(osv.osv_memory):
if line_value['invoice_line_tax_id']:
tax_value = invoice_tax_obj.compute(cr, uid, invoice_id).values()
for tax in tax_value:
invoice_tax_obj.create(cr, uid, tax, context=context)
invoice_tax_obj.create(cr, uid, tax, context=context)
return {
'domain': [('id', 'in', invoice_list)],
'name': 'Membership Invoice',
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'account.invoice',
'type': 'ir.actions.act_window',
}
return {
'domain': [('id', 'in', invoice_list)],
'name': 'Membership Invoice',
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'account.invoice',
'type': 'ir.actions.act_window',
}
membership_invoice()

View File

@ -9,11 +9,11 @@
<field name="arch" type="xml">
<form string="Membership Invoice">
<group colspan="4" >
<field name="product_id" context="{'product':membership_product}" domain="[('membership','=',True)]"/>
<field name="product_id" context="{'product':membership_product}" domain="[('membership','=',True)]" widget="selection"/>
</group>
<group colspan="4" col="6">
<button icon="gtk-close" special="cancel" string="Close"/>
<button icon="gtk-ok" string="Confirm" name="membership_invoice" type="object"/>
<button icon="gtk-apply" string="Confirm" name="membership_invoice" type="object"/>
</group>
</form>
</field>
@ -39,4 +39,4 @@
</record>
</data>
</openerp>
</openerp>

View File

@ -42,9 +42,9 @@ class pos_config_journal(osv.osv):
pos_config_journal()
class pos_company_discount(osv.osv):
""" Company Discount and Cashboxes """
""" Company Discount and Cashboxes """
_inherit = 'res.company'
_columns = {
'company_discount': fields.float('Max Discount(%)', digits_compute= dp.get_precision('Point Of Sale')),
@ -55,10 +55,10 @@ pos_company_discount()
class pos_order(osv.osv):
""" Point of sale gives business owners a convenient way of checking out customers
and of recording sales """
and of recording sales """
_name = "pos.order"
_description = "Point of Sale"
_order = "date_order, create_date desc"
@ -66,7 +66,7 @@ class pos_order(osv.osv):
def unlink(self, cr, uid, ids, context={}):
for rec in self.browse(cr, uid, ids, context=context):
for rec_statement in rec.statement_ids:
if (rec_statement.statement_id and rec_statement.statement_id.state=='confirm') or rec.state=='done':
@ -76,7 +76,7 @@ class pos_order(osv.osv):
def onchange_partner_pricelist(self, cr, uid, ids, part, context={}):
""" Changed price list on_change of partner_id"""
if not part:
return {}
pricelist = self.pool.get('res.partner').browse(cr, uid, part).property_product_pricelist.id
@ -108,13 +108,13 @@ class pos_order(osv.osv):
return res
def _get_date_payment2(self, cr, uid, ids, context, *a):
# Todo need to check this function
# Todo need to check this function
""" Find payment Date
@param field_names: Names of fields.
@return: Dictionary of values """
res = {}
pay_obj = self.pool.get('account.bank.statement')
stat_obj_line = self.pool.get('account.bank.statement.line')
@ -137,12 +137,12 @@ class pos_order(osv.osv):
if val:
res[order.id]=val
return res
def _get_date_payment(self, cr, uid, ids, context, *a):
""" Find Validation Date
@return: Dictionary of values """
@return: Dictionary of values """
res = {}
pay_obj = self.pool.get('pos.payment')
tot =0.0
@ -172,22 +172,22 @@ class pos_order(osv.osv):
return res
def _amount_all(self, cr, uid, ids, name, args, context=None):
tax_obj = self.pool.get('account.tax')
cur_obj = self.pool.get('res.currency')
tax_obj = self.pool.get('account.tax')
cur_obj = self.pool.get('res.currency')
res={}
for order in self.browse(cr, uid, ids):
res[order.id] = {
'amount_paid': 0.0,
'amount_return':0.0,
'amount_tax':0.0,
}
val=0.0
cur_obj = self.pool.get('res.currency')
cur = order.pricelist_id.currency_id
}
val=0.0
cur_obj = self.pool.get('res.currency')
cur = order.pricelist_id.currency_id
for payment in order.statement_ids:
res[order.id]['amount_paid'] += payment.amount
res[order.id]['amount_paid'] += payment.amount
for payment in order.payments:
res[order.id]['amount_return'] += (payment.amount < 0 and payment.amount or 0)
res[order.id]['amount_return'] += (payment.amount < 0 and payment.amount or 0)
for line in order.lines:
if order.price_type!='tax_excluded':
res[order.id]['amount_tax'] = reduce(lambda x, y: x+round(y['amount'], 2),
@ -197,16 +197,16 @@ class pos_order(osv.osv):
res[order.id]['amount_tax'])
elif line.qty != 0.0:
for c in tax_obj.compute_all(cr, uid, line.product_id.taxes_id, line.price_unit * (1-(line.discount or 0.0)/100.0), line.qty, line.product_id, line.order_id.partner_id)['taxes']:
val += c['amount']
val += c['amount']
res[order.id]['amount_tax'] = cur_obj.round(cr, uid, cur, val)
return res
def _sale_journal_get(self, cr, uid, context):
""" To get sale journal for this order"
@return: journal """
""" To get sale journal for this order"
@return: journal """
journal_obj = self.pool.get('account.journal')
res = journal_obj.search(cr, uid,
@ -217,10 +217,10 @@ class pos_order(osv.osv):
return False
def _shop_get(self, cr, uid, context):
""" To get Shop for this order"
@return: Shop id """
""" To get Shop for this order"
@return: Shop id """
company = self.pool.get('res.users').browse(cr, uid, uid, context).company_id
res = self.pool.get('sale.shop').search(cr, uid, [])
if res:
@ -228,7 +228,7 @@ class pos_order(osv.osv):
else:
return False
def copy(self, cr, uid, id, default=None, context={}):
if not default:
default = {}
default.update({
@ -245,7 +245,7 @@ class pos_order(osv.osv):
return super(pos_order, self).copy(cr, uid, id, default, context)
def _get_v( self, cr, uid, ids,*a):
""" Changed the Validation state of order
@return: State """
@ -326,11 +326,11 @@ class pos_order(osv.osv):
def _select_pricelist(self, cr, uid, context):
""" To get default pricelist for the order"
""" To get default pricelist for the order"
@param name: Names of fields.
@return: pricelist ID
"""
"""
pricelist = self.pool.get('product.pricelist').search(cr, uid, [('name', '=', 'Public Pricelist')])
if pricelist:
return pricelist[0]
@ -338,11 +338,11 @@ class pos_order(osv.osv):
return False
def _journal_default(self, cr, uid, context={}):
""" To get default pricelist for the order"
""" To get default pricelist for the order"
@param name: Names of fields.
@return: journal ID
"""
"""
journal_list = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'cash')])
if journal_list:
return journal_list[0]
@ -350,7 +350,7 @@ class pos_order(osv.osv):
return False
_defaults = {
'user_salesman_id':lambda self, cr, uid, context: uid,
'user_salesman_id':lambda self, cr, uid, context: uid,
'user_id': lambda self, cr, uid, context: uid,
'sale_manager': lambda self, cr, uid, context: uid,
'state': lambda *a: 'draft',
@ -369,11 +369,11 @@ class pos_order(osv.osv):
def test_order_lines(self, cr, uid, order, context={}):
""" Test order line is created or not for the order "
""" Test order line is created or not for the order "
@param name: Names of fields.
@return: True
"""
"""
if not order.lines:
raise osv.except_osv(_('Error'), _('No order lines defined for this sale.'))
@ -385,10 +385,10 @@ class pos_order(osv.osv):
return True
def test_paid(self, cr, uid, ids, context=None):
""" Test all amount is paid for this order
""" Test all amount is paid for this order
@return: True
"""
"""
for order in self.browse(cr, uid, ids, context):
if order.lines and not order.amount_total:
return True
@ -398,9 +398,9 @@ class pos_order(osv.osv):
return True
def _get_qty_differences(self, orders, old_picking):
"""check if the customer changed the product quantity """
order_dict = {}
for order in orders:
for line in order.lines:
@ -422,9 +422,9 @@ class pos_order(osv.osv):
return diff_dict
def _split_picking(self, cr, uid, ids, context, old_picking, diff_dict):
"""if the customer changes the product quantity, split the picking in two"""
# create a copy of the original picking and adjust the product qty:
picking_model = self.pool.get('stock.picking')
defaults = {
@ -462,9 +462,9 @@ class pos_order(osv.osv):
line.unlink(context=context)
def create_picking(self, cr, uid, ids, context={}):
"""Create a picking for each order and validate it."""
picking_obj = self.pool.get('stock.picking')
pick_name=self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.out')
orders = self.browse(cr, uid, ids, context)
@ -472,7 +472,7 @@ class pos_order(osv.osv):
if not order.picking_id:
new = True
picking_id = picking_obj.create(cr, uid, {
'name':pick_name,
'name':pick_name,
'origin': order.name,
'type': 'out',
'state': 'draft',
@ -530,8 +530,8 @@ class pos_order(osv.osv):
return True
def set_to_draft(self, cr, uid, ids, *args):
""" Changes order state to draft
""" Changes order state to draft
@return: True
"""
if not len(ids):
@ -545,10 +545,10 @@ class pos_order(osv.osv):
return True
def button_invalidate(self, cr, uid, ids, *args):
""" Check the access for the sale order
""" Check the access for the sale order
@return: True
"""
"""
res_obj = self.pool.get('res.company')
try:
part_company=res_obj.browse(cr,uid,uid) and res_obj.browse(cr,uid,uid).parent_id and res_obj.browse(cr,uid,uid).parent_id.id or None
@ -559,10 +559,10 @@ class pos_order(osv.osv):
return True
def button_validate(self, cr, uid, ids, *args):
""" Check the access for the sale order and update the date_validation
@return: True
"""
"""
res_obj = self.pool.get('res.company')
try:
part_company=res_obj.browse(cr,uid,uid) and res_obj.browse(cr,uid,uid).parent_id and res_obj.browse(cr,uid,uid).parent_id.id or None
@ -581,18 +581,18 @@ class pos_order(osv.osv):
def cancel_order(self, cr, uid, ids, context=None):
""" Changes order state to cancel
""" Changes order state to cancel
@return: True
"""
"""
self.write(cr, uid, ids, {'state': 'cancel'})
self.cancel_picking(cr, uid, ids, context={})
return True
def add_payment(self, cr, uid, order_id, data, context=None):
"""Create a new payment for the order"""
res_obj = self.pool.get('res.company')
statementl_obj = self.pool.get('account.bank.statement.line')
prod_obj = self.pool.get('product.product')
@ -645,9 +645,9 @@ class pos_order(osv.osv):
return statement_id
def add_product(self, cr, uid, order_id, product_id, qty, context=None):
"""Create a new order line the order"""
line_obj = self.pool.get('pos.order.line')
values = self.read(cr, uid, order_id, ['partner_id', 'pricelist_id'])
@ -669,9 +669,9 @@ class pos_order(osv.osv):
return order_line_id
def refund(self, cr, uid, ids, context={}):
"""Create a copy of order for refund order"""
"""Create a copy of order for refund order"""
clone_list = []
line_obj = self.pool.get('pos.order.line')
@ -696,7 +696,7 @@ class pos_order(osv.osv):
return clone_list
def action_invoice(self, cr, uid, ids, context={}):
"""Create a invoice of order """
res_obj = self.pool.get('res.company')
@ -739,7 +739,7 @@ class pos_order(osv.osv):
'quantity': line.qty,
}
inv_name = product_obj.name_get(cr, uid, [line.product_id.id], context=context)[0][1]
inv_line.update(inv_line_ref.product_id_change(cr, uid, [],
line.product_id.id,
line.product_id.uom_id.id,
@ -759,9 +759,9 @@ class pos_order(osv.osv):
return inv_ids
def create_account_move(self, cr, uid, ids, context=None):
"""Create a account move line of order """
"""Create a account move line of order """
account_move_obj = self.pool.get('account.move')
account_move_line_obj = self.pool.get('account.move.line')
account_period_obj = self.pool.get('account.period')
@ -777,7 +777,7 @@ class pos_order(osv.osv):
to_reconcile = []
group_tax = {}
account_def = property_obj.get(cr, uid, 'property_account_receivable', 'res.partner', context=context).id
order_account = order.partner_id and order.partner_id.property_account_receivable and order.partner_id.property_account_receivable.id or account_def or curr_c.account_receivable.id
# Create an entry for the sale
@ -845,7 +845,7 @@ class pos_order(osv.osv):
# Create a move for the line
account_move_line_obj.create(cr, uid, {
'name': "aa"+order.name,
'date': order.date_order,
'date': order.date_order[:10],
'ref': order.contract_number or order.name,
'quantity': line.qty,
'product_id':line.product_id.id,
@ -873,7 +873,7 @@ class pos_order(osv.osv):
account_move_line_obj.create(cr, uid, {
'name': "bb"+order.name,
'date': order.date_order,
'date': order.date_order[:10],
'ref': order.contract_number or order.name,
'product_id':line.product_id.id,
'quantity': line.qty,
@ -894,7 +894,7 @@ class pos_order(osv.osv):
for key, amount in group_tax.items():
account_move_line_obj.create(cr, uid, {
'name':"cc"+order.name,
'date': order.date_order,
'date': order.date_order[:10],
'ref': order.contract_number or order.name,
'move_id': move_id,
'company_id': comp_id,
@ -912,7 +912,7 @@ class pos_order(osv.osv):
# counterpart
to_reconcile.append(account_move_line_obj.create(cr, uid, {
'name': "dd"+order.name,
'date': order.date_order,
'date': order.date_order[:10],
'ref': order.contract_number or order.name,
'move_id': move_id,
'company_id': comp_id,
@ -963,7 +963,7 @@ class pos_order(osv.osv):
'statement_id': False,
'account_id':order_account
})
self.write(cr,uid,order.id,{'state':'done'})
return True
@ -1072,7 +1072,7 @@ class pos_order_line(osv.osv):
else:
res[line.id]=line.price_unit*line.qty
res[line.id] = res[line.id] + tax_amount
return res
def _amount_line(self, cr, uid, ids, field_name, arg, context):
res = {}
@ -1093,7 +1093,7 @@ class pos_order_line(osv.osv):
_('You have to select a pricelist in the sale form !\n' \
'Please set one before choosing a product.'))
p_obj = self.pool.get('product.product').browse(cr,uid,[product_id])[0]
uom_id=p_obj.uom_po_id.id
uom_id=p_obj.uom_po_id.id
price = self.pool.get('product.pricelist').price_get(cr, uid,
[pricelist], product_id, qty or 1.0, partner_id,{'uom': uom_id})[pricelist]
unit_price=price or p_obj.list_price
@ -1102,8 +1102,8 @@ class pos_order_line(osv.osv):
_("Couldn't find a pricelist line matching this product" \
" and quantity.\nYou have to change either the product," \
" the quantity or the pricelist."))
return unit_price
return unit_price
def onchange_product_id(self, cr, uid, ids, pricelist, product_id, qty=0, partner_id=False):
price = self.price_by_product(cr, uid, ids, pricelist, product_id, qty, partner_id)
self.write(cr,uid,ids,{'price_unit':price})
@ -1284,7 +1284,7 @@ class pos_payment(osv.osv):
pos_payment()
class account_move_line(osv.osv):
_inherit = 'account.move.line'
def create(self, cr, user, vals, context={}):
pos_obj = self.pool.get('pos.order')
@ -1304,9 +1304,9 @@ account_move_line()
class account_move(osv.osv):
_inherit = 'account.move'
def create(self, cr, user, vals, context={}):
pos_obj = self.pool.get('pos.order')
val_name = vals.get('name', '')

View File

@ -48,7 +48,6 @@ class pos_invoice(report_sxw.rml_parse):
raise osv.except_osv(_('Error !'), _('Please create an invoice for this sale.'))
iids.append(order.invoice_id)
nids.append(order.invoice_id.id)
self.cr.commit()
data['ids'] = nids
self.datas = data
self.ids = nids

View File

@ -70,7 +70,6 @@ class pos_open_statement(osv.osv_memory):
# })
period = statement_obj._get_period(cr, uid, context) or None
cr.execute("INSERT INTO account_bank_statement(journal_id,company_id,user_id,state,name, period_id,date) VALUES(%d,%d,%d,'open','%s',%d,'%s')"%(journal.id, company_id, uid, number, period, time.strftime('%Y-%m-%d %H:%M:%S')))
cr.commit()
cr.execute("select id from account_bank_statement where journal_id=%d and company_id=%d and user_id=%d and state='open' and name='%s'"%(journal.id, company_id, uid, number))
statement_id = cr.fetchone()[0]
if st_id:

View File

@ -36,7 +36,7 @@
<field name="name" >Tasks According to User and Project</field>
<field name="model_id" ref="model_project_task"/>
<field name="global" eval="True"/>
<field name="domain_force">['|','|','|',('user_id','=',False),('user_id','=',user.id),('project_id.members','=',user.id),('project_id.user_id','=',user.id)]</field>
<field name="domain_force">['|','|','|',('user_id','=',False),('user_id','=',user.id),('project_id.members','in', [user.id]),('project_id.user_id','=',user.id)]</field>
</record>
</data>

View File

@ -233,7 +233,7 @@ class sale_order(osv.osv):
'incoterm': fields.selection(_incoterm_get, 'Incoterm', size=3, help="Incoterm which stands for 'International Commercial terms' implies its a series of sales terms which are used in the commercial transaction"),
'picking_policy': fields.selection([('direct', 'Partial Delivery'), ('one', 'Complete Delivery')],
'Picking Policy', required=True, help="""If you don't have enough stock available to deliver all at once, do you accept partial shipments or not?"""),
'Picking Policy', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="""If you don't have enough stock available to deliver all at once, do you accept partial shipments or not?"""),
'order_policy': fields.selection([
('prepaid', 'Payment Before Delivery'),
('manual', 'Shipping & Manual Invoice'),
@ -786,7 +786,7 @@ class sale_order_line(osv.osv):
context = context or {}
for line in self.browse(cr, uid, ids, context=context):
price = line.price_unit * line.product_uom_qty * (1 - (line.discount or 0.0) / 100.0)
taxes = tax_obj.compute_all(cr, uid, line.tax_id, price, line.product_uom_qty)
taxes = tax_obj.compute_all(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty)
cur = line.order_id.pricelist_id.currency_id
res[line.id] = cur_obj.round(cr, uid, cur, taxes['total'])
return res
@ -828,7 +828,7 @@ class sale_order_line(osv.osv):
'discount': fields.float('Discount (%)', digits=(16, 2), readonly=True, states={'draft':[('readonly',False)]}),
'number_packages': fields.function(_number_packages, method=True, type='integer', string='Number Packages'),
'notes': fields.text('Notes'),
'th_weight': fields.float('Weight'),
'th_weight': fields.float('Weight', readonly=True, states={'draft':[('readonly',False)]}),
'state': fields.selection([('draft', 'Draft'),('confirmed', 'Confirmed'),('done', 'Done'),('cancel', 'Cancelled'),('exception', 'Exception')], 'State', required=True, readonly=True,
help=' * The \'Draft\' state is set automatically when sale order in draft state. \
\n* The \'Confirmed\' state is set automatically when sale order in confirm state. \
@ -837,7 +837,7 @@ class sale_order_line(osv.osv):
\n* The \'Cancelled\' state is set automatically when user cancel sale order.'),
'order_partner_id': fields.related('order_id', 'partner_id', type='many2one', relation='res.partner', string='Customer'),
'salesman_id':fields.related('order_id', 'user_id', type='many2one', relation='res.users', string='Salesman'),
'company_id': fields.related('order_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True),
'company_id': fields.related('order_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True, states={'draft':[('readonly',False)]}),
}
_order = 'sequence, id'
_defaults = {
@ -852,9 +852,17 @@ class sale_order_line(osv.osv):
'product_packaging': False
}
def create_sale_order_line_invoice(self, cr, uid, ids, context=None):
if context is None:
context = {}
context.update({'active_ids' : ids,'active_id' : ids})
self.pool.get('sale.order.line.make.invoice').make_invoices(cr, uid, ids, context=context)
return True
def invoice_line_create(self, cr, uid, ids, context=None):
if context is None:
context = {}
def _get_line_qty(line):
if (line.order_id.invoice_quantity=='order') or not line.procurement_id:
if line.product_uos:
@ -919,7 +927,6 @@ class sale_order_line(osv.osv):
sales[line.order_id.id] = True
create_ids.append(inv_id)
# Trigger workflow events
wf_service = netsvc.LocalService("workflow")
for sid in sales.keys():
@ -932,6 +939,10 @@ class sale_order_line(osv.osv):
for line in self.browse(cr, uid, ids, context=context):
if line.invoiced:
raise osv.except_osv(_('Invalid action !'), _('You cannot cancel a sale order line that has already been invoiced !'))
# if line.order_id.picking_ids:
# raise osv.except_osv(
# _('Could not cancel sale order line!'),
# _('You must first cancel stock move attached to this sale order line.'))
message = _('Sale order line') + " '" + line.name + "' "+_("is cancelled")
self.log(cr, uid, id, message)
return self.write(cr, uid, ids, {'state': 'cancel'})

View File

@ -165,10 +165,10 @@
<field name="state"/>
<field name="invoiced"/>
<button colspan="1"
name="%(action_view_sale_order_line_make_invoice)d"
name="create_sale_order_line_invoice"
states="confirmed"
string="Make Invoice"
type="action"
string="Create Invoice"
type="object"
icon="terp-document-new" />
</group>
</page>
@ -396,20 +396,24 @@
<field colspan="4" name="tax_id" domain="[('parent_id','=',False),('type_tax_use','&lt;&gt;','purchase')]" nolabel="1"/>
<separator colspan="4" string="States"/>
<field name="state"/>
<button colspan="1"
name="%(action_view_sale_order_line_make_invoice)d"
string="Make Invoice"
type="action"
icon="terp-document-new" />
<group col="2" colspan="2">
<group col="3" colspan="2">
<button colspan="1"
name="create_sale_order_line_invoice"
states="confirmed"
string="Create Invoice"
type="object"
icon="terp-document-new"
attrs="{'invisible': [('invoiced', '=', 1)]}"/>
<button name="button_cancel"
states="confirmed,exception"
string="Cancel" type="object"
icon="gtk-cancel"
attrs="{'invisible': [('invoiced', '=', 1)]}" />
<button name="button_done"
states="confirmed,exception"
string="Done" type="object"
icon="gtk-jump-to" />
<button name="button_cancel"
states="confirmed,exception"
string="Cancel" type="object"
icon="gtk-cancel" />
icon="gtk-jump-to"
attrs="{'invisible': [('invoiced', '=', 0)]}"/>
</group>
</page>
<!-- <page string="Properties" groups="base.group_extended">-->
@ -492,6 +496,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form,graph</field>
<field name="search_view_id" ref="view_sales_order_uninvoiced_line_filter" />
<field name="context">{"search_default_uninvoiced":1}</field>
<field name="filter" eval="True"/>
</record>

View File

@ -1451,7 +1451,6 @@ class stock_move(osv.osv):
if not cursor.fetchone():
cursor.execute('CREATE INDEX stock_move_location_id_location_dest_id_product_id_state \
ON stock_move (location_id, location_dest_id, product_id, state)')
cursor.commit()
return res
def onchange_lot_id(self, cr, uid, ids, prodlot_id=False, product_qty=False,

View File

@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.4\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
"PO-Revision-Date: 2010-05-10 17:37+0000\n"
"Last-Translator: Nurettin Ayarcı <nurettinx@gmail.com>\n"
"PO-Revision-Date: 2010-07-12 11:45+0000\n"
"Last-Translator: adsiz_1029@hotmail.com <Unknown>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-06-22 04:17+0000\n"
"X-Launchpad-Export-Date: 2010-07-13 03:49+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: wiki
@ -30,7 +30,7 @@ msgstr "Nesne adı x_ ile başlamalı ve özel karakter içermemelidir!"
#. module: wiki
#: model:ir.model,name:wiki.model_wiki_groups_link
msgid "Wiki Groups Links"
msgstr ""
msgstr "Wiki Grupları Bağlantıları"
#. module: wiki
#: field:wiki.wiki,create_uid:0
@ -45,7 +45,7 @@ msgstr ""
#. module: wiki
#: field:wiki.groups.link,action_id:0
msgid "Menu"
msgstr ""
msgstr "Menü"
#. module: wiki
#: field:wiki.groups,child_ids:0
@ -57,7 +57,7 @@ msgstr ""
#: model:ir.actions.act_window,name:wiki.action_wiki
#: model:ir.ui.menu,name:wiki.menu_action_wiki_wiki
msgid "Wiki Pages"
msgstr ""
msgstr "Wiki Sayfaları"
#. module: wiki
#: field:wiki.groups,section:0
@ -68,7 +68,7 @@ msgstr ""
#: model:ir.model,name:wiki.model_wiki_wiki_history
#: view:wiki.wiki.history:0
msgid "Wiki History"
msgstr ""
msgstr "Wiki Geçmiş"
#. module: wiki
#: field:wiki.wiki,minor_edit:0
@ -94,7 +94,7 @@ msgstr ""
#: field:wiki.groups,name:0
#: field:wiki.wiki,group_id:0
msgid "Wiki Group"
msgstr ""
msgstr "Wiki Toplulugu"
#. module: wiki
#: field:wiki.wiki,name:0
@ -114,7 +114,7 @@ msgstr ""
#. module: wiki
#: model:ir.module.module,shortdesc:wiki.module_meta_information
msgid "Document Management - Wiki"
msgstr ""
msgstr "Belge Yönetimi - Wiki"
#. module: wiki
#: view:wiki.groups:0
@ -124,7 +124,7 @@ msgstr "Menü Oluştur"
#. module: wiki
#: field:wiki.groups,notes:0
msgid "Description"
msgstr ""
msgstr "Tanım"
#. module: wiki
#: field:wiki.wiki,section:0
@ -144,12 +144,12 @@ msgstr ""
#. module: wiki
#: field:wiki.wiki,write_uid:0
msgid "Last Author"
msgstr ""
msgstr "Son Yazar"
#. module: wiki
#: model:ir.actions.act_window,name:wiki.act_view_diff
msgid "Differences"
msgstr ""
msgstr "Degişiklikler"
#. module: wiki
#: help:wiki.wiki,section:0
@ -169,12 +169,12 @@ msgstr ""
#. module: wiki
#: field:wiki.wiki.history,create_date:0
msgid "Date"
msgstr ""
msgstr "Tarih"
#. module: wiki
#: wizard_view:wiki.make.index,init:0
msgid "Want to create a Index on Selected Pages ? "
msgstr ""
msgstr "Seçili sayfada dizin yaratmak istediginizden emin misiniz? "
#. module: wiki
#: view:wiki.groups:0
@ -185,7 +185,7 @@ msgstr ""
#: field:wiki.groups,home:0
#: field:wiki.groups,page_ids:0
msgid "Pages"
msgstr ""
msgstr "Sayfalar"
#. module: wiki
#: constraint:ir.ui.view:0
@ -200,7 +200,7 @@ msgstr "Metin alanı"
#. module: wiki
#: wizard_field:wiki.create.menu,init,menu_parent_id:0
msgid "Parent Menu"
msgstr ""
msgstr "Ana Menü"
#. module: wiki
#: field:wiki.wiki,create_date:0
@ -210,7 +210,7 @@ msgstr ""
#. module: wiki
#: view:wiki.groups:0
msgid "Notes"
msgstr ""
msgstr "Notlar"
#. module: wiki
#: wizard_view:wiki.create.menu,init:0
@ -269,7 +269,7 @@ msgstr "Değişiklikler"
#. module: wiki
#: model:ir.actions.act_window,name:wiki.act_wiki_wiki_history
msgid "History"
msgstr ""
msgstr "Geçmiş"
#. module: wiki
#: model:ir.ui.menu,name:wiki.menu_document
@ -319,12 +319,12 @@ msgstr ""
#. module: wiki
#: field:wiki.wiki.history,write_uid:0
msgid "Modify By"
msgstr ""
msgstr "Düzenleyen"
#. module: wiki
#: field:wiki.wiki,toc:0
msgid "Table of Contents"
msgstr ""
msgstr "İçerik Tablosu"
#. module: wiki
#: wizard_button:wiki.create.menu,init,end:0