@@ -13,7 +13,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-07-06 03:37+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-07-07 03:39+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: account
|
||||
|
||||
@@ -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-07-06 03:17+0000\n"
|
||||
"PO-Revision-Date: 2010-07-06 10:39+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-07-06 03:37+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-07-07 03:39+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: account
|
||||
@@ -45,7 +45,7 @@ msgstr "设置过期支付的催款信息"
|
||||
#. module: account
|
||||
#: model:process.transition,name:account.process_transition_confirmstatementfromdraft0
|
||||
msgid "Confirm statement from draft"
|
||||
msgstr "从草稿确认"
|
||||
msgstr "从草稿确认对帐单"
|
||||
|
||||
#. module: account
|
||||
#: model:account.account.type,name:account.account_type_asset
|
||||
@@ -60,7 +60,7 @@ msgstr "在动作定义使用了无效的模块名。"
|
||||
#. module: account
|
||||
#: help:account.journal,currency:0
|
||||
msgid "The currency used to enter statement"
|
||||
msgstr "报表使用的货币"
|
||||
msgstr "使用的货币"
|
||||
|
||||
#. module: account
|
||||
#: wizard_view:account_use_models,init_form:0
|
||||
@@ -454,7 +454,7 @@ msgstr "特殊计算"
|
||||
#. module: account
|
||||
#: model:process.transition,note:account.process_transition_confirmstatementfromdraft0
|
||||
msgid "Confirm statement with/without reconciliation from draft statement"
|
||||
msgstr "从草稿确认将不对账"
|
||||
msgstr "从草稿确认与对/不对帐"
|
||||
|
||||
#. module: account
|
||||
#: wizard_view:account.move.bank.reconcile,init:0
|
||||
@@ -487,7 +487,7 @@ msgstr "税用在"
|
||||
msgid ""
|
||||
"Set if the amount of tax must be included in the base amount before "
|
||||
"computing the next taxes."
|
||||
msgstr "如果这税额必须包含在计算下一个税的基础金额里, 请设置"
|
||||
msgstr "如果这税额必须在计算下一个税的基础金额里, 请设置"
|
||||
|
||||
#. module: account
|
||||
#: model:ir.ui.menu,name:account.menu_finance_periodical_processing
|
||||
@@ -954,7 +954,7 @@ msgstr "默认借方科目"
|
||||
#: model:ir.actions.act_window,name:account.action_bank_statement_tree
|
||||
#: model:ir.ui.menu,name:account.menu_bank_statement_tree
|
||||
msgid "Entries by Statements"
|
||||
msgstr "银行对帐单"
|
||||
msgstr "对帐单"
|
||||
|
||||
#. module: account
|
||||
#: model:process.transition,name:account.process_transition_analyticinvoice0
|
||||
@@ -1092,7 +1092,7 @@ msgstr "含税价计算代码"
|
||||
#: model:ir.actions.act_window,name:account.action_tax_code_list
|
||||
#: model:ir.ui.menu,name:account.menu_action_tax_code_list
|
||||
msgid "Tax codes"
|
||||
msgstr "税代码"
|
||||
msgstr "税事务"
|
||||
|
||||
#. module: account
|
||||
#: field:account.fiscal.position.template,chart_template_id:0
|
||||
@@ -1739,7 +1739,7 @@ msgstr "成本分类账的会计期间"
|
||||
#: model:ir.actions.act_window,name:account.action_bank_statement_tree2
|
||||
#: model:ir.ui.menu,name:account.menu_bank_statement_tree2
|
||||
msgid "New Statement"
|
||||
msgstr "新银行对帐单"
|
||||
msgstr "新对帐单"
|
||||
|
||||
#. module: account
|
||||
#: wizard_field:account.analytic.account.chart,init,from_date:0
|
||||
@@ -2581,7 +2581,7 @@ msgstr "应付账"
|
||||
#. module: account
|
||||
#: wizard_view:populate_statement_from_inv,init:0
|
||||
msgid "Import Invoices in Statement"
|
||||
msgstr "在银行对帐单里导入发票"
|
||||
msgstr "在对帐单里导入发票"
|
||||
|
||||
#. module: account
|
||||
#: view:account.invoice:0
|
||||
@@ -2873,12 +2873,12 @@ msgstr "跳过'草稿'状态创建分录"
|
||||
#: field:account.invoice.tax,account_id:0
|
||||
#: field:account.move.line,tax_code_id:0
|
||||
msgid "Tax Account"
|
||||
msgstr "税科目"
|
||||
msgstr "税事务"
|
||||
|
||||
#. module: account
|
||||
#: model:process.transition,note:account.process_transition_statemententries0
|
||||
msgid "From statement, create entries"
|
||||
msgstr "从对账单创建分录"
|
||||
msgstr "从对帐单创建分录"
|
||||
|
||||
#. module: account
|
||||
#: field:account.analytic.account,complete_name:0
|
||||
@@ -2913,7 +2913,7 @@ msgstr "会计报表"
|
||||
#. module: account
|
||||
#: rml:account.overdue:0
|
||||
msgid "Document: Customer account statement"
|
||||
msgstr "文档:客户报表"
|
||||
msgstr "文档:客户科目"
|
||||
|
||||
#. module: account
|
||||
#: view:product.product:0
|
||||
@@ -3003,7 +3003,7 @@ msgid ""
|
||||
"The maturity date of the generated entries for this model. You can chosse "
|
||||
"between the date of the creation action or the the date of the creation of "
|
||||
"the entries plus the partner payment terms."
|
||||
msgstr "这模型在到期日产生分录. 你能从创建日期到到付款期限间选择."
|
||||
msgstr "这模型在付款到期日产生分录. 你能从创建日期到到付款期限间选择."
|
||||
|
||||
#. module: account
|
||||
#: selection:account.analytic.journal,type:0
|
||||
@@ -3212,7 +3212,7 @@ msgstr "平均汇率"
|
||||
#: model:process.node,note:account.process_node_bankstatement0
|
||||
#: model:process.node,note:account.process_node_supplierbankstatement0
|
||||
msgid "Statement encoding produces payment entries"
|
||||
msgstr "产品付款分录清单"
|
||||
msgstr "产品付款分录对帐单"
|
||||
|
||||
#. module: account
|
||||
#: field:account.account,code:0
|
||||
@@ -3694,7 +3694,7 @@ msgstr "周期性分录科目"
|
||||
#: field:account.move.line,date_maturity:0
|
||||
#: rml:account.overdue:0
|
||||
msgid "Maturity date"
|
||||
msgstr "到期日期"
|
||||
msgstr "付款到期日"
|
||||
|
||||
#. module: account
|
||||
#: view:account.subscription:0
|
||||
@@ -3798,7 +3798,7 @@ msgstr "付款分录"
|
||||
#. module: account
|
||||
#: help:account.move.line,tax_code_id:0
|
||||
msgid "The Account can either be a base tax code or tax code account."
|
||||
msgstr "这科目可以选基础税的代码或税代码科目"
|
||||
msgstr "可以选基于的税务代码或税务代码"
|
||||
|
||||
#. module: account
|
||||
#: help:account.automatic.reconcile,init,account_ids:0
|
||||
@@ -4011,7 +4011,7 @@ msgstr "凭证"
|
||||
#: view:account.bank.statement:0
|
||||
#: field:account.bank.statement,line_ids:0
|
||||
msgid "Statement lines"
|
||||
msgstr "银行对帐单明细"
|
||||
msgstr "对帐单明细"
|
||||
|
||||
#. module: account
|
||||
#: field:account.move.line,amount_taxed:0
|
||||
@@ -4182,7 +4182,7 @@ msgstr "报表上显示的会计年度名称"
|
||||
msgid ""
|
||||
"This field is used for payable and receivable entries. You can put the limit "
|
||||
"date for the payment of this entry line."
|
||||
msgstr "这字段用于应付和应收分录. 你可以在付款分录明细放入的限制日期"
|
||||
msgstr "这字段用于应付和应收分录. 你可以放入该分录明细的付款限定日期"
|
||||
|
||||
#. module: account
|
||||
#: rml:account.tax.code.entries:0
|
||||
@@ -4552,7 +4552,7 @@ msgstr "将根据选择的模板自动设置你的科目一览表、银行帐号
|
||||
#: field:account.bank.statement.line,statement_id:0
|
||||
#: field:account.move.line,statement_id:0
|
||||
msgid "Statement"
|
||||
msgstr "银行对帐单"
|
||||
msgstr "对帐单"
|
||||
|
||||
#. module: account
|
||||
#: model:ir.actions.act_window,name:account.action_move_line_form_encode_by_move
|
||||
@@ -4622,12 +4622,12 @@ msgstr "运行中"
|
||||
msgid ""
|
||||
"Indicate if the amount of tax must be included in the base amount for the "
|
||||
"computation of the next taxes"
|
||||
msgstr "表明如果税额必须包含在计算下一个税的基础金额里"
|
||||
msgstr "指出如果税额必须在计算下一个税的基础金额里"
|
||||
|
||||
#. module: account
|
||||
#: model:process.node,name:account.process_node_draftstatement0
|
||||
msgid "Draft statement"
|
||||
msgstr "银行对帐单草稿"
|
||||
msgstr "对帐单草稿"
|
||||
|
||||
#. module: account
|
||||
#: field:account.analytic.journal,name:0
|
||||
@@ -4637,7 +4637,7 @@ msgstr "分录集合名称"
|
||||
#. module: account
|
||||
#: model:process.transition,note:account.process_transition_invoiceimport0
|
||||
msgid "Import invoice from statement"
|
||||
msgstr "从银行对帐单导入发票"
|
||||
msgstr "从对帐单导入发票"
|
||||
|
||||
#. module: account
|
||||
#: selection:account.automatic.reconcile,init,power:0
|
||||
@@ -4730,7 +4730,7 @@ msgstr "已取消"
|
||||
#: model:ir.actions.act_window,name:account.action_bank_statement_draft_tree
|
||||
#: model:ir.ui.menu,name:account.menu_bank_statement_draft_tree
|
||||
msgid "Draft statements"
|
||||
msgstr "银行对帐单草稿"
|
||||
msgstr "对帐单草稿"
|
||||
|
||||
#. module: account
|
||||
#: wizard_field:populate_statement_from_inv,init,date:0
|
||||
@@ -5887,7 +5887,7 @@ msgstr "财务结构"
|
||||
#. module: account
|
||||
#: model:process.process,name:account.process_process_statementprocess0
|
||||
msgid "Statement Process"
|
||||
msgstr "银行对帐单处理"
|
||||
msgstr "对帐单处理"
|
||||
|
||||
#. module: account
|
||||
#: model:ir.model,name:account.model_account_bank_statement_reconcile
|
||||
|
||||
@@ -58,14 +58,19 @@ class account_statement_from_invoice_lines(osv.osv_memory):
|
||||
# else:
|
||||
ctx['date'] = line_date
|
||||
amount = 0.0
|
||||
|
||||
if line.debit > 0:
|
||||
amount = line.debit
|
||||
elif line.credit > 0:
|
||||
amount = -line.credit
|
||||
|
||||
if line.amount_currency:
|
||||
amount = currency_obj.compute(cr, uid, line.currency_id.id,
|
||||
amount = currency_obj.compute(cursor, user, line.currency_id.id,
|
||||
statement.currency.id, line.amount_currency, context=ctx)
|
||||
else:
|
||||
if line.debit > 0:
|
||||
amount=line.debit
|
||||
elif line.credit > 0:
|
||||
amount=-line.credit
|
||||
elif (line.invoice and line.invoice.currency_id.id <> statement.currency.id):
|
||||
amount = currency_obj.compute(cursor, user, line.invoice.currency_id.id,
|
||||
statement.currency.id, amount, context=ctx)
|
||||
|
||||
reconcile_id = statement_reconcile_obj.create(cr, uid, {
|
||||
'line_ids': [(6, 0, [line.id])]
|
||||
}, context=context)
|
||||
|
||||
@@ -200,7 +200,7 @@ class account_analytic_account(osv.osv):
|
||||
res[id] = round(res.get(id, 0.0),2) + round(res2.get(id, 0.0),2)
|
||||
return res
|
||||
|
||||
def _last_worked_date_calc (self, cr, uid, ids, name, arg, context = None):
|
||||
def _last_worked_date_calc (self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)]))
|
||||
if parent_ids:
|
||||
@@ -384,6 +384,7 @@ class account_analytic_account(osv.osv):
|
||||
'month_ids': fields.function(_month, method=True, type='many2many', relation='account_analytic_analysis.summary.month', string='Month'),
|
||||
'user_ids': fields.function(_user, method=True, type="many2many", relation='account_analytic_analysis.summary.user', string='User'),
|
||||
}
|
||||
|
||||
account_analytic_account()
|
||||
|
||||
class account_analytic_account_summary_user(osv.osv):
|
||||
@@ -507,11 +508,11 @@ class account_analytic_account_summary_user(osv.osv):
|
||||
res.extend(cr.dictfetchall())
|
||||
else:
|
||||
res = map(lambda x: {'id': x}, ids)
|
||||
|
||||
res_trans_obj = self.pool.get('ir.translation')
|
||||
for f in fields_pre:
|
||||
if self._columns[f].translate:
|
||||
ids = map(lambda x: x['id'], res)
|
||||
res_trans = self.pool.get('ir.translation')._get_ids(cr, user, self._name+','+f, 'model', context.get('lang', False) or 'en_US', ids)
|
||||
res_trans = res_trans_obj._get_ids(cr, user, self._name+','+f, 'model', context.get('lang', False) or 'en_US', ids)
|
||||
for r in res:
|
||||
r[f] = res_trans.get(r['id'], False) or r[f]
|
||||
|
||||
@@ -683,11 +684,12 @@ class account_analytic_account_summary_month(osv.osv):
|
||||
res.extend(cr.dictfetchall())
|
||||
else:
|
||||
res = map(lambda x: {'id': x}, ids)
|
||||
|
||||
|
||||
res_trans_obj = self.pool.get('ir.translation')
|
||||
for f in fields_pre:
|
||||
if self._columns[f].translate:
|
||||
ids = map(lambda x: x['id'], res)
|
||||
res_trans = self.pool.get('ir.translation')._get_ids(cr, user, self._name+','+f, 'model', context.get('lang', False) or 'en_US', ids)
|
||||
res_trans = res_trans_obj._get_ids(cr, user, self._name+','+f, 'model', context.get('lang', False) or 'en_US', ids)
|
||||
for r in res:
|
||||
r[f] = res_trans.get(r['id'], False) or r[f]
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-07-04 03:45+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-07-07 03:39+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: account_analytic_analysis
|
||||
|
||||
@@ -33,7 +33,7 @@ Allows to automatically select analytic accounts based on criterions:
|
||||
""",
|
||||
'author' : 'Tiny',
|
||||
'website' : 'http://www.openerp.com',
|
||||
'depends' : ['account', 'sale'],
|
||||
'depends' : ['sale'],
|
||||
'init_xml' : [],
|
||||
'update_xml': ['security/ir.model.access.csv', 'account_analytic_default_view.xml'],
|
||||
'demo_xml' : [],
|
||||
|
||||
@@ -38,6 +38,7 @@ class account_analytic_default(osv.osv):
|
||||
'date_start': fields.date('Start Date'),
|
||||
'date_stop': fields.date('End Date'),
|
||||
}
|
||||
|
||||
def account_get(self, cr, uid, product_id=None, partner_id=None, user_id=None, date=None, context=None):
|
||||
domain = []
|
||||
if product_id:
|
||||
@@ -65,20 +66,22 @@ class account_analytic_default(osv.osv):
|
||||
res = rec
|
||||
best_index = index
|
||||
return res
|
||||
|
||||
account_analytic_default()
|
||||
|
||||
class account_invoice_line(osv.osv):
|
||||
_inherit = 'account.invoice.line'
|
||||
_description = 'Invoice Line'
|
||||
|
||||
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None):
|
||||
res_prod = super(account_invoice_line,self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition, price_unit, address_invoice_id, currency_id=currency_id, context=context)
|
||||
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fiscal_position=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None):
|
||||
res_prod = super(account_invoice_line,self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fiscal_position, price_unit, address_invoice_id, currency_id=currency_id, context=context)
|
||||
rec = self.pool.get('account.analytic.default').account_get(cr, uid, product, partner_id, uid, time.strftime('%Y-%m-%d'), context)
|
||||
if rec:
|
||||
res_prod['value'].update({'account_analytic_id':rec.analytic_id.id})
|
||||
else:
|
||||
res_prod['value'].update({'account_analytic_id':False})
|
||||
return res_prod
|
||||
|
||||
account_invoice_line()
|
||||
|
||||
|
||||
@@ -105,14 +108,14 @@ class sale_order_line(osv.osv):
|
||||
create_ids = super(sale_order_line,self).invoice_line_create(cr, uid, ids, context)
|
||||
if not ids:
|
||||
return create_ids
|
||||
sale_line_obj = self.browse(cr, uid, ids[0], context)
|
||||
pool_inv_line = self.pool.get('account.invoice.line')
|
||||
|
||||
for line in pool_inv_line.browse(cr, uid, create_ids, context):
|
||||
rec = self.pool.get('account.analytic.default').account_get(cr, uid, line.product_id.id, sale_line_obj.order_id.partner_id.id, uid, time.strftime('%Y-%m-%d'), context)
|
||||
sale_line = self.browse(cr, uid, ids[0], context)
|
||||
inv_line_obj = self.pool.get('account.invoice.line')
|
||||
anal_def_obj = self.pool.get('account.analytic.default')
|
||||
for line in inv_line_obj.browse(cr, uid, create_ids, context):
|
||||
rec = anal_def_obj.account_get(cr, uid, line.product_id.id, sale_line.order_id.partner_id.id, uid, time.strftime('%Y-%m-%d'), context)
|
||||
|
||||
if rec:
|
||||
pool_inv_line.write(cr, uid, [line.id], {'account_analytic_id':rec.analytic_id.id}, context=context)
|
||||
inv_line_obj.write(cr, uid, [line.id], {'account_analytic_id':rec.analytic_id.id}, context=context)
|
||||
return create_ids
|
||||
|
||||
sale_order_line()
|
||||
|
||||
@@ -53,6 +53,7 @@ class account_analytic_plan(osv.osv):
|
||||
'name': fields.char('Analytic Plan', size=64, required=True, select=True,),
|
||||
'plan_ids': fields.one2many('account.analytic.plan.line','plan_id','Analytic Plans'),
|
||||
}
|
||||
|
||||
account_analytic_plan()
|
||||
|
||||
class account_analytic_plan_line(osv.osv):
|
||||
@@ -71,6 +72,7 @@ class account_analytic_plan_line(osv.osv):
|
||||
'min_required': 100.0,
|
||||
'max_required': 100.0,
|
||||
}
|
||||
|
||||
account_analytic_plan_line()
|
||||
|
||||
class account_analytic_plan_instance(osv.osv):
|
||||
@@ -187,16 +189,18 @@ class account_analytic_plan_instance(osv.osv):
|
||||
pids = self.pool.get('account.analytic.plan.instance').search(cr, uid, [('name','=',vals['name']),('code','=',vals['code']),('plan_id','<>',False)])
|
||||
if pids:
|
||||
raise osv.except_osv(_('Error'), _('A model having this name and code already exists !'))
|
||||
|
||||
res = self.pool.get('account.analytic.plan.line').search(cr, uid, [('plan_id','=',journal.plan_id.id)])
|
||||
|
||||
acct_anal_acct = self.pool.get('account.analytic.account')
|
||||
acct_anal_plan_line_obj = self.pool.get('account.analytic.plan.line')
|
||||
res = acct_anal_plan_line_obj.search(cr, uid, [('plan_id','=',journal.plan_id.id)])
|
||||
for i in res:
|
||||
total_per_plan = 0
|
||||
item = self.pool.get('account.analytic.plan.line').browse(cr, uid, i)
|
||||
item = acct_anal_plan_line_obj.browse(cr, uid, i)
|
||||
temp_list=['account1_ids','account2_ids','account3_ids','account4_ids','account5_ids','account6_ids']
|
||||
for l in temp_list:
|
||||
if vals.has_key(l):
|
||||
for tempo in vals[l]:
|
||||
if self.pool.get('account.analytic.account').search(cr, uid, [('parent_id','child_of',[item.root_analytic_id.id]),('id','=',tempo[2]['analytic_account_id'])]):
|
||||
if acct_anal_acct.search(cr, uid, [('parent_id','child_of',[item.root_analytic_id.id]),('id','=',tempo[2]['analytic_account_id'])]):
|
||||
total_per_plan += tempo[2]['rate']
|
||||
if total_per_plan < item.min_required or total_per_plan > item.max_required:
|
||||
raise osv.except_osv(_('Value Error') ,_('The Total Should be Between %s and %s') % (str(item.min_required), str(item.max_required)))
|
||||
@@ -252,6 +256,7 @@ class account_journal(osv.osv):
|
||||
_columns = {
|
||||
'plan_id':fields.many2one('account.analytic.plan', 'Analytic Plans'),
|
||||
}
|
||||
|
||||
account_journal()
|
||||
|
||||
class account_invoice_line(osv.osv):
|
||||
@@ -277,6 +282,7 @@ class account_invoice_line(osv.osv):
|
||||
if rec and rec.analytics_id:
|
||||
res_prod['value'].update({'analytics_id':rec.analytics_id.id})
|
||||
return res_prod
|
||||
|
||||
account_invoice_line()
|
||||
|
||||
class account_move_line(osv.osv):
|
||||
@@ -345,6 +351,7 @@ class account_invoice(osv.osv):
|
||||
sign = -1
|
||||
|
||||
iml = self.pool.get('account.invoice.line').move_line_get(cr, uid, inv.id)
|
||||
acct_ins_obj = self.pool.get('account.analytic.plan.instance')
|
||||
|
||||
for il in iml:
|
||||
if il['analytics_id']:
|
||||
@@ -353,14 +360,14 @@ class account_invoice(osv.osv):
|
||||
ref = inv.reference
|
||||
else:
|
||||
ref = self._convert_ref(cr, uid, inv.number)
|
||||
obj_move_line=self.pool.get('account.analytic.plan.instance').browse(cr, uid, il['analytics_id'])
|
||||
amount_calc=cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, il['price'], context={'date': inv.date_invoice}) * sign
|
||||
qty=il['quantity']
|
||||
obj_move_line = acct_ins_obj.browse(cr, uid, il['analytics_id'])
|
||||
amount_calc = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, il['price'], context={'date': inv.date_invoice}) * sign
|
||||
qty = il['quantity']
|
||||
il['analytic_lines']=[]
|
||||
for line2 in obj_move_line.account_ids:
|
||||
amt=amount_calc * (line2.rate/100)
|
||||
qtty=qty* (line2.rate/100)
|
||||
al_vals={
|
||||
amt = amount_calc * (line2.rate/100)
|
||||
qtty = qty* (line2.rate/100)
|
||||
al_vals = {
|
||||
'name': il['name'],
|
||||
'date': inv['date_invoice'],
|
||||
'unit_amount':qtty,
|
||||
@@ -389,6 +396,7 @@ class analytic_default(osv.osv):
|
||||
_columns = {
|
||||
'analytics_id': fields.many2one('account.analytic.plan.instance', 'Analytic Distribution'),
|
||||
}
|
||||
|
||||
analytic_default()
|
||||
|
||||
class sale_order_line(osv.osv):
|
||||
@@ -398,14 +406,15 @@ class sale_order_line(osv.osv):
|
||||
def invoice_line_create(self, cr, uid, ids, context=None):
|
||||
create_ids = super(sale_order_line,self).invoice_line_create(cr, uid, ids, context)
|
||||
if ids:
|
||||
sale_line_obj = self.browse(cr, uid, ids[0], context)
|
||||
pool_inv_line = self.pool.get('account.invoice.line')
|
||||
|
||||
for line in pool_inv_line.browse(cr, uid, create_ids, context):
|
||||
rec = self.pool.get('account.analytic.default').account_get(cr, uid, line.product_id.id, sale_line_obj.order_id.partner_id.id, uid, time.strftime('%Y-%m-%d'), context)
|
||||
sale_line = self.browse(cr, uid, ids[0], context)
|
||||
inv_line_obj = self.pool.get('account.invoice.line')
|
||||
acct_anal_def_obj = self.pool.get('account.analytic.default')
|
||||
|
||||
for line in inv_line_obj.browse(cr, uid, create_ids, context):
|
||||
rec = acct_anal_def_obj.account_get(cr, uid, line.product_id.id, sale_line.order_id.partner_id.id, uid, time.strftime('%Y-%m-%d'), context)
|
||||
|
||||
if rec:
|
||||
pool_inv_line.write(cr, uid, [line.id], {'analytics_id':rec.analytics_id.id}, context=context)
|
||||
inv_line_obj.write(cr, uid, [line.id], {'analytics_id':rec.analytics_id.id}, context=context)
|
||||
return create_ids
|
||||
|
||||
sale_order_line()
|
||||
|
||||
@@ -22,4 +22,5 @@ import product
|
||||
import stock
|
||||
import purchase
|
||||
import invoice
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -17,11 +17,12 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
{
|
||||
"name" : "Stock Accounting for Anglo Saxon countries",
|
||||
"version" : "1.2",
|
||||
"author" : "Tiny, Veritos",
|
||||
"website" : "http://tinyerp.com - http://veritos.nl",
|
||||
"name" : "Stock Accounting for Anglo Saxon countries",
|
||||
"version" : "1.2",
|
||||
"author" : "Tiny, Veritos",
|
||||
"website" : "http://tinyerp.com - http://veritos.nl",
|
||||
"description" : """This module will support the Anglo-Saxons accounting methodology by
|
||||
changing the accounting logic with stock transactions. The difference between the Anglo-Saxon accounting countries
|
||||
and the Rhine or also called Continental accounting countries is the moment of taking the Cost of Goods Sold versus Cost of Sales.
|
||||
@@ -29,12 +30,13 @@
|
||||
This module will add this functionality by using a interim account, to store the value of shipped goods and will contra book this interim account
|
||||
when the invoice is created to transfer this amount to the debtor or creditor account.
|
||||
Secondly, price differences between actual purchase price and fixed product standard price are booked on a seperate account""",
|
||||
"depends" : ["product", "account", "sale", "purchase", "stock"],
|
||||
"category" : "Generic Modules/Inventory Control",
|
||||
"init_xml" : [],
|
||||
"demo_xml" : [],
|
||||
"depends" : ["product", "purchase"],
|
||||
"category" : "Generic Modules/Inventory Control",
|
||||
"init_xml" : [],
|
||||
"demo_xml" : [],
|
||||
"update_xml" : ["product_view.xml",],
|
||||
"active": False,
|
||||
"active" : False,
|
||||
"installable": True
|
||||
}
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -5,13 +5,11 @@
|
||||
<field name="name">product.normal.form.inherit.stock</field>
|
||||
<field name="model">product.product</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="product.product_normal_form_view"/>
|
||||
<field name="inherit_id" ref="account.product_normal_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="/form/notebook/page/field[@name='property_account_expense']" position="after">
|
||||
<field name="property_account_creditor_price_difference" domain="[('type','<>','view'),('type','<>','consolidation')]" attrs="{'readonly':[('purchase_ok','=',0)]}" />
|
||||
<newline/>
|
||||
<!-- <field name="property_account_sending_goods" domain="[('type','<>','view'),('type','<>','consolidation')]" attrs="{'readonly':[('sale_ok','=',0)]}" />-->
|
||||
<!-- <field name="property_account_received_goods" domain="[('type','<>','view'),('type','<>','consolidation')]" attrs="{'readonly':[('purchase_ok','=',0)]}" />-->
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
@@ -20,13 +18,11 @@
|
||||
<field name="name">product.template.product.form.inherit</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="product.product_template_form_view"/>
|
||||
<field name="inherit_id" ref="account.product_template_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="/form/notebook/page/field[@name='property_account_expense']" position="after">
|
||||
<field name="property_account_creditor_price_difference" domain="[('type','<>','view'),('type','<>','consolidation')]" attrs="{'readonly':[('purchase_ok','=',0)]}" />
|
||||
<newline/>
|
||||
<!-- <field name="property_account_sending_goods" domain="[('type','<>','view'),('type','<>','consolidation')]" attrs="{'readonly':[('sale_ok','=',0)]}" />-->
|
||||
<!-- <field name="property_account_received_goods" domain="[('type','<>','view'),('type','<>','consolidation')]" attrs="{'readonly':[('purchase_ok','=',0)]}" />-->
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
@@ -41,8 +37,6 @@
|
||||
<group col="2" colspan="2">
|
||||
<separator string=" Accounting Property" colspan="2"/>
|
||||
<field name="property_account_creditor_price_difference_categ" domain="[('type','<>','view'),('type','<>','consolidation')]" attrs="{'readonly':[('purchase_ok','=',0)]}" />
|
||||
<!-- <field name="property_account_sending_goods_categ" domain="[('type','<>','view'),('type','<>','consolidation')]" attrs="{'readonly':[('sale_ok','=',0)]}" />-->
|
||||
<!-- <field name="property_account_received_goods_categ" domain="[('type','<>','view'),('type','<>','consolidation')]" attrs="{'readonly':[('purchase_ok','=',0)]}" />-->
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
@@ -22,5 +22,6 @@
|
||||
import crossovered_budget
|
||||
import report
|
||||
import wizard
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -20,14 +20,9 @@
|
||||
##############################################################################
|
||||
|
||||
from osv import osv,fields
|
||||
import tools
|
||||
import netsvc
|
||||
from mx import DateTime
|
||||
import time
|
||||
import datetime
|
||||
from tools.translate import _
|
||||
|
||||
|
||||
def strToDate(dt):
|
||||
dt_date=datetime.date(int(dt[0:4]),int(dt[5:7]),int(dt[8:10]))
|
||||
return dt_date
|
||||
@@ -127,13 +122,6 @@ class crossovered_budget(osv.osv):
|
||||
'creating_user_id': lambda self,cr,uid,context: uid,
|
||||
}
|
||||
|
||||
# def action_set_to_draft(self, cr, uid, ids, *args):
|
||||
# self.write(cr, uid, ids, {'state': 'draft'})
|
||||
# wf_service = netsvc.LocalService('workflow')
|
||||
# for id in ids:
|
||||
# wf_service.trg_create(uid, self._name, id, cr)
|
||||
# return True
|
||||
|
||||
def budget_confirm(self, cr, uid, ids, *args):
|
||||
self.write(cr, uid, ids, {
|
||||
'state':'confirm'
|
||||
|
||||
@@ -19,17 +19,16 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
||||
{
|
||||
"name" : "Account Cancel",
|
||||
"version" : "1.1",
|
||||
"depends" : ["account"],
|
||||
"author" : "Tiny",
|
||||
"category": 'Generic Modules/Accounting',
|
||||
"description": """
|
||||
Module Add Allow cancelling entries field on form view of account journal if it set to true it allows user to cancel entries & invoices.
|
||||
Module adds 'Allow cancelling entries' field on form view of account journal. If set to true it allows user to cancel entries & invoices.
|
||||
""",
|
||||
'website': 'http://www.openerp.com',
|
||||
"depends" : ["account"],
|
||||
'init_xml': [],
|
||||
'update_xml': ['account_cancel_view.xml' ],
|
||||
'demo_xml': [],
|
||||
@@ -37,4 +36,5 @@
|
||||
'active': False,
|
||||
|
||||
}
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -21,5 +21,6 @@
|
||||
|
||||
import account_coda
|
||||
import wizard
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -20,23 +20,24 @@
|
||||
##############################################################################
|
||||
|
||||
{
|
||||
"name":"Account CODA - import bank statements from coda file",
|
||||
"version":"1.0",
|
||||
"author":"Tiny",
|
||||
"category":"Account CODA",
|
||||
"description":"""
|
||||
"name" : "Account CODA - import bank statements from coda file",
|
||||
"version" : "1.0",
|
||||
"author" : "Tiny",
|
||||
"category" : "Account CODA",
|
||||
"description": """
|
||||
Module provides functionality to import
|
||||
bank statements from coda files.
|
||||
""",
|
||||
"depends":["base", "account"],
|
||||
"demo_xml":["account_coda_demo.xml"],
|
||||
"init_xml":[],
|
||||
"update_xml" : ["security/ir.model.access.csv",
|
||||
"depends" : ["account"],
|
||||
"demo_xml" : [],
|
||||
"init_xml" : [],
|
||||
"update_xml": ["security/ir.model.access.csv",
|
||||
"wizard/account_coda_import.xml",
|
||||
"account_coda_view.xml"],
|
||||
"active":False,
|
||||
"installable":True,
|
||||
"active" : False,
|
||||
"installable" : True,
|
||||
|
||||
}
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -26,25 +26,26 @@ class account_coda(osv.osv):
|
||||
_name = "account.coda"
|
||||
_description = "coda for an Account"
|
||||
_columns = {
|
||||
'name': fields.binary('Coda file', readonly=True ,help="Store the detail of bank statements"),
|
||||
'statement_ids': fields.one2many('account.bank.statement','coda_id','Generated Bank Statements', readonly=True),
|
||||
'name': fields.binary('Coda file', readonly=True, help="Store the detail of bank statements"),
|
||||
'statement_ids': fields.one2many('account.bank.statement', 'coda_id', 'Generated Bank Statements', readonly=True),
|
||||
'note': fields.text('Import log', readonly=True),
|
||||
'journal_id': fields.many2one('account.journal','Journal', readonly=True, select=True,help="Bank Journal"),
|
||||
'journal_id': fields.many2one('account.journal', 'Journal', readonly=True, select=True, help="Bank Journal"),
|
||||
'date': fields.date('Date', readonly=True, select=True, help="Import Date"),
|
||||
'user_id': fields.many2one('res.users','User', readonly=True, select=True),
|
||||
'user_id': fields.many2one('res.users', 'User', readonly=True, select=True),
|
||||
}
|
||||
_defaults = {
|
||||
'date': time.strftime('%Y-%m-%d'),
|
||||
'user_id': lambda self,cr,uid,context: uid,
|
||||
}
|
||||
|
||||
account_coda()
|
||||
|
||||
class account_bank_statement(osv.osv):
|
||||
_inherit = "account.bank.statement"
|
||||
_columns = {
|
||||
'coda_id':fields.many2one('account.coda','Coda'),
|
||||
'coda_id':fields.many2one('account.coda', 'Coda'),
|
||||
}
|
||||
|
||||
account_bank_statement()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -21,7 +21,6 @@
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
from mx import DateTime
|
||||
import base64
|
||||
|
||||
from osv import fields
|
||||
@@ -54,7 +53,8 @@ class account_coda_import(osv.osv_memory):
|
||||
'coda': fields.binary('Coda File', required=True),
|
||||
'note':fields.text('Log'),
|
||||
}
|
||||
def coda_parsing(self, cr, uid, ids, context):
|
||||
|
||||
def coda_parsing(self, cr, uid, ids, context=None):
|
||||
|
||||
journal_obj=self.pool.get('account.journal')
|
||||
account_period_obj = self.pool.get('account.period')
|
||||
@@ -65,10 +65,12 @@ class account_coda_import(osv.osv_memory):
|
||||
statement_reconcile_obj = self.pool.get('account.bank.statement.reconcile')
|
||||
account_coda_obj = self.pool.get('account.coda')
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
|
||||
|
||||
if not context:
|
||||
context = {}
|
||||
|
||||
data = self.read(cr, uid, ids)[0]
|
||||
|
||||
|
||||
codafile = data['coda']
|
||||
journal_code = journal_obj.browse(cr, uid, data['journal_id'], context).code
|
||||
|
||||
@@ -265,6 +267,7 @@ class account_coda_import(osv.osv_memory):
|
||||
context.update({ 'statment_ids':bkst_list})
|
||||
model_data_ids = mod_obj.search(cr, uid, [('model', '=', 'ir.ui.view'), ('name', '=', 'account_coda_note_view')], context=context)
|
||||
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
|
||||
|
||||
return {
|
||||
'name': _('Result'),
|
||||
'res_id': ids[0],
|
||||
@@ -277,7 +280,10 @@ class account_coda_import(osv.osv_memory):
|
||||
'context': context,
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
def action_open_window(self, cr, uid, data, context):
|
||||
|
||||
def action_open_window(self, cr, uid, data, context=None):
|
||||
if not context:
|
||||
cotext = {}
|
||||
return {
|
||||
'domain':"[('id','in',%s)]"%(context.get('statment_ids', False)),
|
||||
'name': 'Statement',
|
||||
@@ -287,6 +293,7 @@ class account_coda_import(osv.osv_memory):
|
||||
'view_id': False,
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
|
||||
account_coda_import()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -40,4 +40,5 @@ This module implement the modification on the invoice form.
|
||||
'active': False,
|
||||
'certificate': '0070514190381',
|
||||
}
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
import time
|
||||
|
||||
from osv import fields, osv
|
||||
import decimal_precision as dp
|
||||
|
||||
class account_invoice(osv.osv):
|
||||
_inherit = "account.invoice"
|
||||
@@ -117,7 +116,7 @@ class account_invoice_line(osv.osv):
|
||||
return super(account_invoice_line, self)._price_unit_default(cr, uid, context)
|
||||
return 0
|
||||
|
||||
def _get_invoice(self, cr, uid, ids, context):
|
||||
def _get_invoice(self, cr, uid, ids, context=None):
|
||||
result = {}
|
||||
for inv in self.pool.get('account.invoice').browse(cr, uid, ids, context=context):
|
||||
for line in inv.invoice_line:
|
||||
@@ -126,9 +125,9 @@ class account_invoice_line(osv.osv):
|
||||
|
||||
_columns = {
|
||||
'price_subtotal': fields.function(_amount_line2, method=True, string='Subtotal w/o tax', multi='amount',
|
||||
store={'account.invoice':(_get_invoice,['price_type'],10), 'account.invoice.line': (lambda self, cr, uid, ids, c={}: ids, None,10)}),
|
||||
store={'account.invoice':(_get_invoice,['price_type'], 10), 'account.invoice.line': (lambda self, cr, uid, ids, c={}: ids, None,10)}),
|
||||
'price_subtotal_incl': fields.function(_amount_line2, method=True, string='Subtotal', multi='amount',
|
||||
store={'account.invoice':(_get_invoice,['price_type'],10), 'account.invoice.line': (lambda self, cr, uid, ids, c={}: ids, None,10)}),
|
||||
store={'account.invoice':(_get_invoice,['price_type'], 10), 'account.invoice.line': (lambda self, cr, uid, ids, c={}: ids, None,10)}),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
|
||||
@@ -31,15 +31,10 @@
|
||||
""",
|
||||
"category" : "Generic Modules/Accounting",
|
||||
"website" : "http://tinyerp.com",
|
||||
"depends" : [
|
||||
"base",
|
||||
"account"
|
||||
],
|
||||
"init_xml" : [
|
||||
],
|
||||
"depends" : ["account"],
|
||||
"init_xml" : [],
|
||||
|
||||
"demo_xml" : [
|
||||
],
|
||||
"demo_xml" : [],
|
||||
|
||||
"update_xml" : [
|
||||
"security/ir.model.access.csv",
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
|
||||
from datetime import datetime
|
||||
from osv import fields, osv, orm
|
||||
from osv.orm import except_orm
|
||||
from osv.osv import osv_pool
|
||||
from tools.translate import _
|
||||
import mx.DateTime
|
||||
import pooler
|
||||
@@ -42,17 +40,14 @@ class base_action_rule(osv.osv):
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param context: A standard dictionary for contextual values """
|
||||
|
||||
return self.state_get(cr, uid, context=context)
|
||||
|
||||
|
||||
def state_get(self, cr, uid, context={}):
|
||||
""" Get State
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param context: A standard dictionary for contextual values """
|
||||
|
||||
return [('', '')]
|
||||
|
||||
def priority_get(self, cr, uid, context={}):
|
||||
@@ -61,14 +56,13 @@ class base_action_rule(osv.osv):
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param context: A standard dictionary for contextual values """
|
||||
|
||||
return [('', '')]
|
||||
|
||||
_columns = {
|
||||
'name': fields.many2one('ir.model', 'Object', required=True),
|
||||
'max_level': fields.integer('Max Level', help='Specifies maximum level.'),
|
||||
'create_date': fields.datetime('Create Date', readonly=1),
|
||||
'active': fields.boolean('Active', help="If the active field is set to true,\
|
||||
'active': fields.boolean('Active', help="If the active field is set to False,\
|
||||
it will allow you to hide the rule without removing it."),
|
||||
'sequence': fields.integer('Sequence', help="Gives the sequence order \
|
||||
when displaying a list of rules."),
|
||||
@@ -85,10 +79,7 @@ specifies you can put a negative number. If you need a delay before the \
|
||||
trigger date, like sending a reminder 15 minutes before a meeting."),
|
||||
'trg_date_range_type': fields.selection([('minutes', 'Minutes'), ('hour', 'Hours'), \
|
||||
('day', 'Days'), ('month', 'Months')], 'Delay type'),
|
||||
|
||||
|
||||
'trg_user_id': fields.many2one('res.users', 'Responsible'),
|
||||
|
||||
'trg_partner_id': fields.many2one('res.partner', 'Partner'),
|
||||
'trg_partner_categ_id': fields.many2one('res.partner.category', 'Partner Category'),
|
||||
'trg_state_from': fields.selection(_state_get, 'State', size=16),
|
||||
@@ -136,7 +127,9 @@ the rule to mark CC(mail to any other person defined in actions)."),
|
||||
|
||||
def pre_action(self, cr, uid, ids, model, context=None):
|
||||
# Searching for action rules
|
||||
cr.execute("SELECT model.model, rule.id FROM base_action_rule rule LEFT JOIN ir_model model on (model.id = rule.name)")
|
||||
cr.execute("SELECT model.model, rule.id FROM base_action_rule rule \
|
||||
LEFT JOIN ir_model model on (model.id = rule.name) \
|
||||
where active")
|
||||
res = cr.fetchall()
|
||||
# Check if any rule matching with current object
|
||||
for obj_name, rule_id in res:
|
||||
@@ -171,10 +164,9 @@ the rule to mark CC(mail to any other person defined in actions)."),
|
||||
def _register_hook(self, cr, uid, ids, context=None):
|
||||
if not context:
|
||||
context = {}
|
||||
model_pool = self.pool.get('ir.model')
|
||||
for action_rule in self.browse(cr, uid, ids, context=context):
|
||||
model = action_rule.name.model
|
||||
obj_pool = self.pool.get(model)
|
||||
obj_pool = self.pool.get(model)
|
||||
obj_pool.__setattr__('create', self._create(obj_pool.create, model, context=context))
|
||||
obj_pool.__setattr__('write', self._write(obj_pool.write, model, context=context))
|
||||
return True
|
||||
@@ -194,7 +186,7 @@ the rule to mark CC(mail to any other person defined in actions)."),
|
||||
"""
|
||||
This Function is call by scheduler.
|
||||
"""
|
||||
rule_pool= self.pool.get('base.action.rule')
|
||||
rule_pool = self.pool.get('base.action.rule')
|
||||
rule_ids = rule_pool.search(cr, uid, [], context=context)
|
||||
return self._register_hook(cr, uid, rule_ids, context=context)
|
||||
|
||||
@@ -202,7 +194,6 @@ the rule to mark CC(mail to any other person defined in actions)."),
|
||||
def format_body(self, body):
|
||||
""" Foramat Action rule's body
|
||||
@param self: The object pointer """
|
||||
|
||||
return body and tools.ustr(body) or ''
|
||||
|
||||
def format_mail(self, obj, body):
|
||||
@@ -392,7 +383,7 @@ the rule to mark CC(mail to any other person defined in actions)."),
|
||||
obj.date_action_next = dt
|
||||
model_obj.write(cr, uid, [obj.id], {'date_action_next': dt}, context)
|
||||
else:
|
||||
ok = action.trg_date_type=='none'
|
||||
ok = action.trg_date_type == 'none'
|
||||
|
||||
if ok:
|
||||
self.do_action(cr, uid, action, model_obj, obj, context)
|
||||
@@ -431,7 +422,7 @@ class ir_cron(osv.osv):
|
||||
|
||||
def _poolJobs(self, db_name, check=False):
|
||||
try:
|
||||
db, pool = pooler.get_db_and_pool(db_name)
|
||||
db = pooler.get_db(db_name)
|
||||
except:
|
||||
return False
|
||||
cr = db.cursor()
|
||||
@@ -439,12 +430,12 @@ class ir_cron(osv.osv):
|
||||
next = datetime.now().strftime('%Y-%m-%d %H:00:00')
|
||||
# Putting nextcall always less than current time in order to call it every time
|
||||
cr.execute('UPDATE ir_cron set nextcall = \'%s\' where numbercall<>0 and active and model=\'base.action.rule\' ' % (next))
|
||||
cr.commit()
|
||||
res = super(ir_cron, self)._poolJobs(db_name, check=check)
|
||||
finally:
|
||||
cr.commit()
|
||||
cr.close()
|
||||
|
||||
super(ir_cron, self)._poolJobs(db_name, check=check)
|
||||
|
||||
ir_cron()
|
||||
|
||||
|
||||
|
||||
@@ -57,22 +57,18 @@
|
||||
<field name="server_action_id"/>
|
||||
</page>
|
||||
<page string="Email Actions">
|
||||
<!-- <group col="4" colspan="2">-->
|
||||
<separator colspan="4" string="Email Reminders"/>
|
||||
<field name="act_remind_partner"/>
|
||||
<field name="act_remind_attach"/>
|
||||
<field name="act_remind_user"/>
|
||||
<group col="2" colspan="2" attrs="{'invisible': [('act_remind_user','=',False)]}">
|
||||
<field name="act_reply_to" attrs="{'required':[('act_remind_user','=',True)]}"/>
|
||||
</group>
|
||||
<separator colspan="4" string="Email Information"/>
|
||||
<field name="act_mail_to_watchers"/>
|
||||
<field name="act_mail_to_user"/>
|
||||
<field colspan="4" name="act_mail_to_email"/>
|
||||
<!-- </group>-->
|
||||
<!-- <group col="4" colspan="2">-->
|
||||
<separator colspan="4" string="Email Reminders"/>
|
||||
<field name="act_remind_partner"/>
|
||||
<field name="act_remind_attach"/>
|
||||
<field name="act_remind_user"/>
|
||||
<group col="2" colspan="2" attrs="{'invisible': [('act_remind_user','=',False)]}">
|
||||
<field name="act_reply_to" attrs="{'required':[('act_remind_user','=',True)]}"/>
|
||||
</group>
|
||||
<field name="act_mail_to_watchers"/>
|
||||
<field colspan="4" name="act_email_cc"/>
|
||||
<!-- </group>-->
|
||||
<separator colspan="4" string="Email Body"/>
|
||||
<field colspan="4" name="act_mail_body" height="250"
|
||||
nolabel="1" attrs="{'required':[('act_remind_user','=',True)]}" />
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
|
||||
"access_base_action_rule","base.action.rule","model_base_action_rule",,1,0,0,0
|
||||
"access_base_action_rule_config","base.action.rule config","model_base_action_rule",base.group_system,1,0,0,0
|
||||
"access_base_action_rule_config","base.action.rule config","model_base_action_rule",base.group_system,1,1,1,1
|
||||
|
@@ -60,7 +60,7 @@ def get_recurrent_dates(rrulestring, exdate, startdate=None, exrule=None):
|
||||
if exrule:
|
||||
rset1.exrule(rrule.rrulestr(str(exrule), dtstart=startdate))
|
||||
|
||||
return rset1._iter()
|
||||
return list(rset1._iter())
|
||||
|
||||
def base_calendar_id2real_id(base_calendar_id=None, with_date=False):
|
||||
"""
|
||||
@@ -822,6 +822,8 @@ class calendar_alarm(osv.osv):
|
||||
delta = alarm.trigger_occurs == 'after' and delta or -delta
|
||||
|
||||
for rdate in recurrent_dates:
|
||||
if rdate + delta > current_datetime:
|
||||
break
|
||||
if rdate + delta <= current_datetime:
|
||||
re_dates.append(rdate.strftime("%Y-%m-%d %H:%M:%S"))
|
||||
rest_dates = recurrent_dates[len(re_dates):]
|
||||
|
||||
+5
-5
@@ -22,7 +22,7 @@
|
||||
import time
|
||||
from datetime import datetime
|
||||
from datetime import timedelta
|
||||
|
||||
import base64
|
||||
import tools
|
||||
from osv import fields
|
||||
from osv import osv
|
||||
@@ -342,7 +342,6 @@ class crm_case(object):
|
||||
destination=False)
|
||||
|
||||
def remind_user(self, cr, uid, ids, context={}, attach=False,destination=True):
|
||||
|
||||
"""
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@@ -359,8 +358,9 @@ class crm_case(object):
|
||||
if case.section_id.reply_to and case.email_from:
|
||||
src = case.email_from
|
||||
dest = case.section_id.reply_to
|
||||
body = ""
|
||||
body = case.email_last or case.description
|
||||
body = case.description or ""
|
||||
if case.message_ids:
|
||||
body = case.message_ids[0].description or ""
|
||||
if not destination:
|
||||
src, dest = dest, src
|
||||
if body and case.user_id.signature:
|
||||
@@ -371,7 +371,7 @@ class crm_case(object):
|
||||
attach_to_send = None
|
||||
|
||||
if attach:
|
||||
attach_ids = self.pool.get('ir.attachment').search(cr, uid, [('res_model', '=', 'mailgate.thread'), ('res_id', '=', case.id)])
|
||||
attach_ids = self.pool.get('ir.attachment').search(cr, uid, [('res_model', '=', self._name), ('res_id', '=', case.id)])
|
||||
attach_to_send = self.pool.get('ir.attachment').read(cr, uid, attach_ids, ['datas_fname','datas'])
|
||||
attach_to_send = map(lambda x: (x['datas_fname'], base64.decodestring(x['datas'])), attach_to_send)
|
||||
|
||||
|
||||
@@ -115,26 +115,22 @@ this if you want the rule to send an email to the partner."),
|
||||
|
||||
|
||||
def state_get(self, cr, uid, context={}):
|
||||
|
||||
"""@param self: The object pointer
|
||||
"""Gets available states for crm
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param context: A standard dictionary for contextual values """
|
||||
|
||||
res = super(base_action_rule, self).state_get(cr, uid, context=context)
|
||||
return res + crm.AVAILABLE_STATES
|
||||
|
||||
def priority_get(self, cr, uid, context={}):
|
||||
|
||||
"""@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param context: A standard dictionary for contextual values """
|
||||
|
||||
res = super(base_action_rule, self).priority_get(cr, uid, context=context)
|
||||
return res + crm.AVAILABLE_PRIORITIES
|
||||
|
||||
|
||||
base_action_rule()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
<field name="inherit_id" ref="base_action_rule.view_base_action_rule_form"/>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="act_mail_to_watchers" position="before">
|
||||
<field name="act_mail_to_user" position="after">
|
||||
<field name="act_mail_to_partner"/>
|
||||
</field>
|
||||
</field>
|
||||
|
||||
@@ -57,6 +57,8 @@ class crm_meeting(osv.osv, crm_case):
|
||||
'id': fields.integer('ID'),
|
||||
'create_date': fields.datetime('Creation Date' , readonly=True),
|
||||
'write_date': fields.datetime('Write Date' , readonly=True),
|
||||
'date_action_last': fields.datetime('Last Action', readonly=1),
|
||||
'date_action_next': fields.datetime('Next Action', readonly=1),
|
||||
# Meeting fields
|
||||
'categ_id': fields.many2one('crm.case.categ', 'Meeting Type', \
|
||||
domain="[('object_id.model', '=', 'crm.meeting')]", \
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
<field name="employee_id"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By...">
|
||||
<group expand="1" string="Group By...">
|
||||
<filter string="Employee" name="employee" icon="terp-personal" context="{'group_by':'employee_id'}"/>
|
||||
<filter string="Department" icon="terp-personal+" context="{'group_by':'department_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
|
||||
@@ -54,6 +54,12 @@
|
||||
'wizard/hr_payroll_employees_detail.xml',
|
||||
'wizard/hr_payroll_year_salary.xml',
|
||||
|
||||
],
|
||||
'test': [
|
||||
'test/payslip.yml',
|
||||
'test/payment_advice.yml',
|
||||
'test/payroll_register.yml',
|
||||
|
||||
],
|
||||
'demo_xml': [
|
||||
'hr_payroll_demo.xml'
|
||||
|
||||
@@ -194,10 +194,10 @@ class payroll_register(osv.osv):
|
||||
# 'advice_ids':fields.one2many('hr.payroll.advice', 'register_id', 'Bank Advice'),
|
||||
'company_id':fields.many2one('res.company', 'Company', required=False),
|
||||
'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')], help="Keep empty to use the period of the validation(Payslip) date."),
|
||||
'grows': fields.function(_calculate, method=True, store=True, multi='dc', string='Gross Salary', type='float', digits=(16, 4))),
|
||||
'net': fields.function(_calculate, method=True, store=True, multi='dc', string='Net Salary', digits=(16, 4)),
|
||||
'allounce': fields.function(_calculate, method=True, store=True, multi='dc', string='Allowance', digits=(16, 4)),
|
||||
'deduction': fields.function(_calculate, method=True, store=True, multi='dc', string='Deduction', digits=(16, 4)),
|
||||
'grows': fields.function(_calculate, method=True, store=True, multi='dc', string='Gross Salary', type='float', digits=(16, int(config['price_accuracy']))),
|
||||
'net': fields.function(_calculate, method=True, store=True, multi='dc', string='Net Salary', digits=(16, int(config['price_accuracy']))),
|
||||
'allounce': fields.function(_calculate, method=True, store=True, multi='dc', string='Allowance', digits=(16, int(config['price_accuracy']))),
|
||||
'deduction': fields.function(_calculate, method=True, store=True, multi='dc', string='Deduction', digits=(16, int(config['price_accuracy']))),
|
||||
'note': fields.text('Description'),
|
||||
}
|
||||
|
||||
@@ -366,8 +366,8 @@ class payroll_advice_line(osv.osv):
|
||||
'advice_id':fields.many2one('hr.payroll.advice', 'Bank Advice', required=False),
|
||||
'name':fields.char('Bank Account A/C', size=64, required=True, readonly=False),
|
||||
'employee_id':fields.many2one('hr.employee', 'Employee', required=True),
|
||||
'amount': fields.float('Amount', digits=(16, 4)),
|
||||
'bysal': fields.float('By Salary', digits=(16, 4)),
|
||||
'amount': fields.float('Amount', digits=(16, int(config['price_accuracy']))),
|
||||
'bysal': fields.float('By Salary', digits=(16, int(config['price_accuracy']))),
|
||||
'flag':fields.char('D/C', size=8, required=True, readonly=False),
|
||||
}
|
||||
_defaults = {
|
||||
@@ -434,10 +434,10 @@ class contrib_register(osv.osv):
|
||||
'analytic_account_id':fields.many2one('account.analytic.account', 'Analytic Account', required=False),
|
||||
'name':fields.char('Name', size=256, required=True, readonly=False),
|
||||
'register_line_ids':fields.one2many('hr.contibution.register.line', 'register_id', 'Register Line', readonly=True),
|
||||
'yearly_total_by_emp': fields.function(_total_contrib, method=True, multi='dc', store=True, string='Total By Employee', digits=(16, 4)),
|
||||
'yearly_total_by_comp': fields.function(_total_contrib, method=True, multi='dc', store=True, string='Total By Company', digits=(16, 4)),
|
||||
'monthly_total_by_emp': fields.function(_total_contrib, method=True, multi='dc', store=True, string='Total By Employee', digits=(16, 4)),
|
||||
'monthly_total_by_comp': fields.function(_total_contrib, method=True, multi='dc', store=True, string='Total By Company', digits=(16, 4)),
|
||||
'yearly_total_by_emp': fields.function(_total_contrib, method=True, multi='dc', store=True, string='Total By Employee', digits=(16, int(config['price_accuracy']))),
|
||||
'yearly_total_by_comp': fields.function(_total_contrib, method=True, multi='dc', store=True, string='Total By Company', digits=(16, int(config['price_accuracy']))),
|
||||
'monthly_total_by_emp': fields.function(_total_contrib, method=True, multi='dc', store=True, string='Total By Employee', digits=(16, int(config['price_accuracy']))),
|
||||
'monthly_total_by_comp': fields.function(_total_contrib, method=True, multi='dc', store=True, string='Total By Company', digits=(16, int(config['price_accuracy']))),
|
||||
'note': fields.text('Description'),
|
||||
}
|
||||
_defaults = {
|
||||
@@ -466,9 +466,9 @@ class contrib_register_line(osv.osv):
|
||||
'code':fields.char('Code', size=64, required=False, readonly=False),
|
||||
'employee_id':fields.many2one('hr.employee', 'Employee', required=True),
|
||||
'period_id': fields.many2one('account.period', 'Period'),
|
||||
'emp_deduction': fields.float('Employee Deduction', digits=(16, 4)),
|
||||
'comp_deduction': fields.float('Company Deduction', digits=(16, 4)),
|
||||
'total': fields.function(_total, method=True, store=True, string='Total', digits=(16, 4)),
|
||||
'emp_deduction': fields.float('Employee Deduction', digits=(16, int(config['price_accuracy']))),
|
||||
'comp_deduction': fields.float('Company Deduction', digits=(16, int(config['price_accuracy']))),
|
||||
'total': fields.function(_total, method=True, store=True, string='Total', digits=(16, int(config['price_accuracy']))),
|
||||
}
|
||||
contrib_register_line()
|
||||
|
||||
@@ -539,7 +539,7 @@ class company_contribution(osv.osv):
|
||||
('fix','Fixed Amount'),
|
||||
('func','Function Calculation'),
|
||||
],'Amount Type', select=True),
|
||||
'contribute_per':fields.float('Contribution', digits=(16, 4), help='Define Company contribution ratio 1.00=100% contribution, If Employee Contribute 5% then company will and here 0.50 defined then company will contribute 50% on employee 5% contribution'),
|
||||
'contribute_per':fields.float('Contribution', digits=(16, int(config['price_accuracy'])), help='Define Company contribution ratio 1.00=100% contribution, If Employee Contribute 5% then company will and here 0.50 defined then company will contribute 50% on employee 5% contribution'),
|
||||
'account_id':fields.property(
|
||||
'account.account',
|
||||
type='many2one',
|
||||
@@ -596,13 +596,13 @@ class company_contribution_line(osv.osv):
|
||||
'contribution_id':fields.many2one('company.contribution', 'Contribution', required=False),
|
||||
'name':fields.char('Name', size=64, required=False, readonly=False),
|
||||
'umo_id':fields.many2one('product.uom', 'Unite', required=False),
|
||||
'from_val': fields.float('From', digits=(16, 4)),
|
||||
'to_val': fields.float('To', digits=(16, 4)),
|
||||
'from_val': fields.float('From', digits=(16, int(config['price_accuracy']))),
|
||||
'to_val': fields.float('To', digits=(16, int(config['price_accuracy']))),
|
||||
'amount_type':fields.selection([
|
||||
('fix','Fixed Amount'),
|
||||
],'Amount Type', select=True),
|
||||
'sequence':fields.integer('Sequence'),
|
||||
'value': fields.float('Value', digits=(16, 4)),
|
||||
'value': fields.float('Value', digits=(16, int(config['price_accuracy']))),
|
||||
}
|
||||
company_contribution_line()
|
||||
|
||||
@@ -1213,9 +1213,9 @@ class hr_payslip_line(osv.osv):
|
||||
'amount': fields.float('Amount / Percentage', digits=(16, 4)),
|
||||
'analytic_account_id':fields.many2one('account.analytic.account', 'Analytic Account', required=False),
|
||||
'account_id':fields.many2one('account.account', 'General Account', required=True),
|
||||
'total': fields.float('Sub Total', readonly=True, digits=(16, 4)),
|
||||
'total': fields.float('Sub Total', readonly=True, digits=(16, int(config['price_accuracy']))),
|
||||
#'total': fields.function(_calculate, method=True, type='float', string='Label', store=True),
|
||||
'company_contrib': fields.float('Company Contribution', readonly=True, digits=(16, 4)),
|
||||
'company_contrib': fields.float('Company Contribution', readonly=True, digits=(16, int(config['price_accuracy']))),
|
||||
'expanse_id': fields.many2one('hr.expense.expense', 'Expense'),
|
||||
'sequence': fields.integer('Sequence'),
|
||||
'note':fields.text('Description'),
|
||||
@@ -1251,13 +1251,13 @@ class hr_payslip_line_line(osv.osv):
|
||||
'slipline_id':fields.many2one('hr.payslip.line', 'Slip Line', required=False),
|
||||
'name':fields.char('Name', size=64, required=False, readonly=False),
|
||||
'umo_id':fields.many2one('product.uom', 'Unite', required=False),
|
||||
'from_val': fields.float('From', digits=(16, 4)),
|
||||
'to_val': fields.float('To', digits=(16, 4)),
|
||||
'from_val': fields.float('From', digits=(16, int(config['price_accuracy']))),
|
||||
'to_val': fields.float('To', digits=(16, int(config['price_accuracy']))),
|
||||
'amount_type':fields.selection([
|
||||
('fix','Fixed Amount'),
|
||||
],'Amount Type', select=True),
|
||||
'sequence':fields.integer('Sequence'),
|
||||
'value': fields.float('Value', digits=(16, 4)),
|
||||
'value': fields.float('Value', digits=(16, int(config['price_accuracy']))),
|
||||
}
|
||||
hr_payslip_line_line()
|
||||
|
||||
|
||||
@@ -169,6 +169,7 @@
|
||||
<field name="manager" select="1"/>
|
||||
<field name="vehicle" select="1"/>
|
||||
<field name="vehicle_distance" select="1"/>
|
||||
<field name="medic_exam" select="1"/>
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<separator colspan="2" string="ESI Information"/>
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
-
|
||||
I test the 'Payment Advice' in order to check the hr_payroll in OpenERP
|
||||
-
|
||||
I create a new employee “Richie”
|
||||
-
|
||||
!record {model: hr.employee, id: hr_employee_richie0}:
|
||||
address_home_id: base.res_partner_address_1
|
||||
address_id: base.res_partner_address_9
|
||||
birthday: '1984-05-01'
|
||||
children: 0.0
|
||||
contract_ids:
|
||||
- advantages_gross: 0.0
|
||||
advantages_net: 0.0
|
||||
date_end: '2011-07-01'
|
||||
date_start: '2010-07-01'
|
||||
name: reference
|
||||
wage: 5000.0
|
||||
wage_type_id: hr_contract.hr_contract_monthly_gross
|
||||
country_id: base.in
|
||||
department_id: hr.dep_it
|
||||
employee_account: account.a_recv
|
||||
gender: male
|
||||
marital: hr.hr_employee_marital_status_single
|
||||
name: Richie
|
||||
pg_joining: '2009-12-01'
|
||||
property_bank_account: account.cash
|
||||
salary_account: account.a_recv
|
||||
vehicle_distance: 0.0
|
||||
-
|
||||
Then I create a new payment advice record
|
||||
-
|
||||
!record {model: hr.payroll.advice, id: hr_payroll_advice_advice0}:
|
||||
account_id: account.cash
|
||||
line_ids:
|
||||
- amount: 5500.0
|
||||
bysal: 5000.0
|
||||
employee_id: 'hr_employee_richie0'
|
||||
flag: C
|
||||
name: Axis Bank
|
||||
name: advice1
|
||||
-
|
||||
In order to confirm a sheet I click on "Confirm Sheet" button
|
||||
-
|
||||
!python {model: hr.payroll.advice}: |
|
||||
self.confirm_sheet(cr, uid, [ref("hr_payroll_advice_advice0")], {"lang": "en_US",
|
||||
"active_model": "ir.ui.menu", "active_ids": [ref("hr_payroll.hr_menu_payment_advice")],
|
||||
"tz": False, "active_id": ref("hr_payroll.hr_menu_payment_advice")})
|
||||
-
|
||||
I check that a state has transferred from draft to confirm
|
||||
-
|
||||
!python {model: hr.payroll.advice}: |
|
||||
from tools.translate import _
|
||||
advice_id=self.browse(cr, uid, ref("hr_payroll_advice_advice0"))
|
||||
assert(advice_id.state == 'confirm'), _('State not changed!')
|
||||
@@ -0,0 +1,63 @@
|
||||
-
|
||||
I test the 'Payroll Register' in order to check the hr_payroll in OpenERP
|
||||
-
|
||||
I create a new employee “Keith”
|
||||
-
|
||||
!record {model: hr.employee, id: hr_employee_keith0}:
|
||||
address_home_id: base.res_partner_address_3
|
||||
address_id: base.res_partner_address_9
|
||||
birthday: '1984-05-01'
|
||||
children: 0.0
|
||||
contract_ids:
|
||||
- advantages_gross: 0.0
|
||||
advantages_net: 0.0
|
||||
date_end: '2011-07-01'
|
||||
date_start: '2010-07-01'
|
||||
name: reference
|
||||
wage: 5000.0
|
||||
wage_type_id: hr_contract.hr_contract_monthly_gross
|
||||
country_id: base.in
|
||||
department_id: hr.dep_it
|
||||
employee_account: account.a_recv
|
||||
gender: male
|
||||
marital: hr.hr_employee_marital_status_single
|
||||
name: Keith
|
||||
pg_joining: '2009-12-01'
|
||||
property_bank_account: account.cash
|
||||
salary_account: account.a_recv
|
||||
vehicle_distance: 0.0
|
||||
-
|
||||
I create a payroll register record
|
||||
-
|
||||
!record {model: hr.payroll.register, id: hr_payroll_register_payroll0}:
|
||||
bank_journal_id: account.bank_journal
|
||||
date: '2010-07-02'
|
||||
journal_id: account.expenses_journal
|
||||
line_ids:
|
||||
- employee_id: hr_payroll.hr_employee_keith0
|
||||
bank_journal_id: account.bank_journal
|
||||
journal_id: account.expenses_journal
|
||||
name: payroll1
|
||||
-
|
||||
I click on Compute button
|
||||
-
|
||||
!python {model: hr.payroll.register}: |
|
||||
self.compute_sheet(cr, uid, [ref("hr_payroll_register_payroll0")], {"lang": "en_US",
|
||||
"tz": False, "active_model": "ir.ui.menu", "department_id": False, "active_ids":
|
||||
[ref("hr_payroll.hr_menu_payroll_register")], "section_id": False, "active_id":
|
||||
ref("hr_payroll.hr_menu_payroll_register"), })
|
||||
-
|
||||
Then I click on Verify Sheet button
|
||||
-
|
||||
!python {model: hr.payroll.register}: |
|
||||
self.verify_sheet(cr, uid, [ref("hr_payroll_register_payroll0")], {"lang": "en_US",
|
||||
"tz": False, "active_model": "ir.ui.menu", "department_id": False, "active_ids":
|
||||
[ref("hr_payroll.hr_menu_payroll_register")], "section_id": False, "active_id":
|
||||
ref("hr_payroll.hr_menu_payroll_register"), })
|
||||
-
|
||||
I check that a state has transferred from 'Wating for Verification' to 'Wating for HR Verification'state
|
||||
-
|
||||
!python {model: hr.payroll.register}: |
|
||||
from tools.translate import _
|
||||
reg_brw=self.browse(cr, uid, ref("hr_payroll_register_payroll0"))
|
||||
assert(reg_brw.state == 'hr_check'), _('State not changed!')
|
||||
@@ -0,0 +1,132 @@
|
||||
-
|
||||
I test the 'Payment Advice' in order to check the hr_payroll in OpenERP
|
||||
-
|
||||
I create a new employee “Richard”
|
||||
-
|
||||
!record {model: hr.employee, id: hr_employee_richard0}:
|
||||
address_home_id: base.res_partner_address_2
|
||||
address_id: base.res_partner_address_9
|
||||
birthday: '1984-05-01'
|
||||
children: 0.0
|
||||
contract_ids:
|
||||
- advantages_gross: 0.0
|
||||
advantages_net: 0.0
|
||||
date_end: '2011-07-01'
|
||||
date_start: '2010-07-01'
|
||||
name: reference
|
||||
wage: 5000.0
|
||||
wage_type_id: hr_contract.hr_contract_monthly_gross
|
||||
country_id: base.in
|
||||
department_id: hr.dep_it
|
||||
employee_account: account.a_recv
|
||||
gender: male
|
||||
marital: hr.hr_employee_marital_status_single
|
||||
name: Richard
|
||||
pg_joining: '2009-12-01'
|
||||
property_bank_account: account.cash
|
||||
salary_account: account.a_recv
|
||||
vehicle_distance: 0.0
|
||||
-
|
||||
I create a new payroll structure for software developer
|
||||
-
|
||||
!record {model: hr.payroll.structure, id: hr_payroll_structure_softwaredeveloper0}:
|
||||
code: SD
|
||||
line_ids:
|
||||
- account_id: account.a_expense
|
||||
amount: 0.40000000000000002
|
||||
amount_type: per
|
||||
category_id: hr_payroll.HRA
|
||||
code: HRA
|
||||
company_contrib: 0.0
|
||||
name: House Rant Allowance
|
||||
sequence: 5
|
||||
total: 0.0
|
||||
type: allowance
|
||||
- account_id: account.a_expense
|
||||
amount: 10000.0
|
||||
amount_type: fix
|
||||
category_id: hr_payroll.CA
|
||||
code: CA
|
||||
company_contrib: 0.0
|
||||
name: Convance Allowance
|
||||
sequence: 10
|
||||
total: 0.0
|
||||
type: allowance
|
||||
- account_id: account.a_pay
|
||||
amount: 10000.0
|
||||
amount_type: fix
|
||||
category_id: hr_payroll.PT
|
||||
code: PT
|
||||
company_contrib: 0.0
|
||||
name: Professional Tax
|
||||
sequence: 15
|
||||
total: 0.0
|
||||
type: deduction
|
||||
- account_id: account.a_pay
|
||||
amount: 0.125
|
||||
amount_type: per
|
||||
category_id: hr_payroll.PF
|
||||
code: PF
|
||||
company_contrib: 0.0
|
||||
name: Provident Fund
|
||||
sequence: 20
|
||||
total: 0.0
|
||||
type: deduction
|
||||
name: Software Developer
|
||||
-
|
||||
I create a employee payslip record
|
||||
-
|
||||
!record {model: hr.payslip, id: hr_payslip_0}:
|
||||
bank_journal_id: account.bank_journal
|
||||
employee_id: hr_payroll.hr_employee_richard0
|
||||
journal_id: account.expenses_journal
|
||||
-
|
||||
I click on 'Compute Sheet' button
|
||||
-
|
||||
!workflow {model: hr.payslip, action: compute_sheet, ref: hr_payslip_0}
|
||||
-
|
||||
!python {model: hr.payslip}: |
|
||||
self.compute_sheet(cr, uid, [ref("hr_payslip_0")], {"lang": "en_US", "tz": False,
|
||||
"active_model": "ir.ui.menu", "department_id": False, "active_ids": [ref("hr_payroll.menu_department_tree")],
|
||||
"section_id": False, "active_id": ref("hr_payroll.menu_department_tree"),
|
||||
})
|
||||
-
|
||||
I check that an order which was in the "New Slip" state has transit to "Wating for Verification" state
|
||||
-
|
||||
!python {model: hr.payslip}: |
|
||||
from tools.translate import _
|
||||
payslip_brw=self.browse(cr, uid, ref("hr_payslip_0"))
|
||||
assert(payslip_brw.state == 'draft'), _('State not changed!')
|
||||
-
|
||||
Then I click on Verify Sheet button
|
||||
-
|
||||
!workflow {model: hr.payslip, action: verify_sheet, ref: hr_payslip_0}
|
||||
-
|
||||
I check that an order which was in the "Wating for Verification" state has transit to "Wating for HR Verification" state
|
||||
-
|
||||
!python {model: hr.payslip}: |
|
||||
from tools.translate import _
|
||||
payslip_brw=self.browse(cr, uid, ref("hr_payslip_0"))
|
||||
assert(payslip_brw.state == 'hr_check'), _('State not changed!')
|
||||
-
|
||||
Then I click on Complete HR Checking button
|
||||
-
|
||||
!workflow {model: hr.payslip, action: final_verify_sheet, ref: hr_payslip_0}
|
||||
-
|
||||
I check that an order which was in the "'Wating for HR Verification'" state has transit to "Confirm Sheet" state
|
||||
-
|
||||
!python {model: hr.payslip}: |
|
||||
from tools.translate import _
|
||||
payslip_brw=self.browse(cr, uid, ref("hr_payslip_0"))
|
||||
assert(payslip_brw.state == 'confirm'), _('State not changed!')
|
||||
-
|
||||
Then I click on Pay Salary button
|
||||
-
|
||||
!workflow {model: hr.payslip, action: process_sheet, ref: hr_payslip_0}
|
||||
-
|
||||
I check that an order which was in the "Confirm Sheet" state has transit to "Paid Salary" state
|
||||
-
|
||||
!python {model: hr.payslip}: |
|
||||
from tools.translate import _
|
||||
payslip_brw=self.browse(cr, uid, ref("hr_payslip_0"))
|
||||
assert(payslip_brw.state == 'done'), _('State not changed!')
|
||||
@@ -13,7 +13,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-07-06 03:37+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-07-07 03:39+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: mrp
|
||||
|
||||
@@ -14,7 +14,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-07-03 03:48+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-07-07 03:39+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: multi_company
|
||||
|
||||
@@ -14,7 +14,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-07-03 03:48+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-07-07 03:39+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: product_visible_discount
|
||||
|
||||
@@ -45,7 +45,7 @@ class purchase_report(osv.osv):
|
||||
'product_id':fields.many2one('product.product', 'Product', readonly=True),
|
||||
'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', readonly=True),
|
||||
'location_id': fields.many2one('stock.location', 'Destination', readonly=True),
|
||||
'partner_id':fields.many2one('res.partner', 'Partner', readonly=True),
|
||||
'partner_id':fields.many2one('res.partner', 'Supplier', readonly=True),
|
||||
'partner_address_id':fields.many2one('res.partner.address', 'Address Contact Name', readonly=True),
|
||||
'dest_address_id':fields.many2one('res.partner.address', 'Dest. Address Contact Name',readonly=True),
|
||||
'pricelist_id':fields.many2one('product.pricelist', 'Pricelist', readonly=True),
|
||||
|
||||
@@ -76,37 +76,39 @@
|
||||
<separator orientation="vertical"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="product_id"/>
|
||||
<field name="user_id"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="10" col="12">
|
||||
<group expand="1" string="Group By..." colspan="10" col="12">
|
||||
<filter string="Supplier" name="group_partner_id" icon="terp-personal" context="{'group_by':'partner_id'}"/>
|
||||
<filter string="Product" name="group_product_id" icon="terp-accessories-archiver" context="{'group_by':'product_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Responsible" name="Responsible" icon="terp-personal" context="{'group_by':'user_id'}"/>
|
||||
<filter string="Validated by" icon="terp-personal" context="{'group_by':'validator'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
|
||||
<filter string="Warehouse" icon="terp-go-home" context="{'group_by':'warehouse_id'}"/>
|
||||
<filter string="Destination" icon="terp-gtk-jump-to-ltr" context="{'group_by':'location_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Day" icon="terp-go-today" context="{'group_by':'day'}"/>
|
||||
<filter string="Month" icon="terp-go-month" context="{'group_by':'month'}"/>
|
||||
<filter string="Year" icon="terp-go-year" context="{'group_by':'name'}"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended filters..." colspan="10" col="12" groups="base.group_extended">
|
||||
<field name="user_id"/>
|
||||
<field name="validator"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="location_id"/>
|
||||
<field name="warehouse_id" widget="selection"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
<newline/>
|
||||
<field name="date"/>
|
||||
<field name="date_approve"/>
|
||||
<field name="expected_date"/>
|
||||
<newline/>
|
||||
<field name="warehouse_id" widget="selection"/>
|
||||
<field name="validator" widget="selection"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="location_id"/>
|
||||
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
@@ -179,12 +181,12 @@
|
||||
<record model="ir.ui.view" id="view_purchase_by_supplier_graph">
|
||||
<field name="name">purchase.by.supplier.graph</field>
|
||||
<field name="model">purchase.report</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Purchase by supplier" >
|
||||
<graph string="Purchase by supplier" type="bar">
|
||||
<field name="partner_id"/>
|
||||
<field name="nbr" operator="+"/>
|
||||
</tree>
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
<record id="action_purchase_by_supplier" model="ir.actions.act_window">
|
||||
@@ -200,13 +202,14 @@
|
||||
<record model="ir.ui.view" id="view_total_price_by_product_by_state_graph">
|
||||
<field name="name">total.price.by.product.by.state.graph</field>
|
||||
<field name="model">purchase.report</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Total price by product by state" >
|
||||
<graph string="Total price by product by state" type="pie">
|
||||
<field name="product_id"/>
|
||||
<field name="price_total" operator="+"/>
|
||||
<field name="state" group="True"/>
|
||||
</tree>
|
||||
<field name="price_total" operator="+"/>
|
||||
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
<record id="action_total_price_by_product_by_state" model="ir.actions.act_window">
|
||||
@@ -221,12 +224,12 @@
|
||||
<record model="ir.ui.view" id="view_qty_per_product_graph">
|
||||
<field name="name">qty.per.product.graph</field>
|
||||
<field name="model">purchase.report</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Qty. per product" >
|
||||
<graph string="Qty. per product" type="bar">
|
||||
<field name="product_id"/>
|
||||
<field name="quantity" operator="+"/>
|
||||
</tree>
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
<record id="action_qty_per_product" model="ir.actions.act_window">
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<field name="nbr" sum="# of Lines"/>
|
||||
<field name="product_uom_qty" sum="# of Qty"/>
|
||||
<field name="shipped_qty_1"/>
|
||||
<field name="uom_name" invisible="not context.get('set_visible',False)"/>
|
||||
<field name="uom_name" invisible="context.get('set_visible',False)"/>
|
||||
<field name="price_average" avg="Average Price"/>
|
||||
<field name="price_total" sum="Total Price"/>
|
||||
<field name="delay" avg="Commitment Delay"/>
|
||||
|
||||
@@ -64,7 +64,7 @@ class sale_advance_payment_inv(osv.osv_memory):
|
||||
_("You cannot make an advance on a sale order \
|
||||
that is defined as 'Automatic Invoice after delivery'."))
|
||||
val = obj_lines.product_id_change(cr, uid, [], sale_adv_obj.product_id.id,
|
||||
uom = False, partner_id = sale.partner_id.id, fposition_id=sale.fiscal_position.id)
|
||||
uom = False, partner_id = sale.partner_id.id, fiscal_position = sale.fiscal_position.id)
|
||||
line_id =obj_lines.create(cr, uid, {
|
||||
'name': val['value']['name'],
|
||||
'account_id': val['value']['account_id'],
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<field name="res_model">account.invoice.report</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">graph,tree</field>
|
||||
<field name="view_id" ref="view_turnover_by_month_tree"/>
|
||||
<field name="view_id" ref="view_turnover_by_month_graph"/>
|
||||
<field name="domain">[('year','ilike',time.strftime('%Y')),('user_id','=',uid)]</field>
|
||||
<field name="context">{'group_by_no_leaf':1,'group_by':['month']}</field>
|
||||
<field name="search_view_id" ref="account.view_account_invoice_report_search"/>
|
||||
|
||||
@@ -14,7 +14,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-07-03 03:48+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-07-07 03:39+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: sale_margin
|
||||
|
||||
@@ -58,12 +58,6 @@ class sale_order_dates(osv.osv):
|
||||
'effective_date': fields.function(_get_effective_date, method=True, type='date', store=True,string='Effective Date'),
|
||||
}
|
||||
sale_order_dates()
|
||||
"""
|
||||
- date_commitment: min(fields.function using delay on SO lines +
|
||||
date_order)
|
||||
- date_requested: fields.date
|
||||
- Effective date: fields.function the first picking done.
|
||||
"""
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -25,5 +25,4 @@ import product
|
||||
import report
|
||||
import wizard
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -19,7 +19,6 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
||||
{
|
||||
"name" : "Inventory Management",
|
||||
"version" : "1.1",
|
||||
@@ -61,7 +60,6 @@ Thanks to the double entry management, the inventory controlling is powerful and
|
||||
"wizard/stock_traceability_view.xml",
|
||||
"stock_workflow.xml",
|
||||
"stock_incoterms.xml",
|
||||
"stock_wizard.xml",
|
||||
"stock_view.xml",
|
||||
"stock_report.xml",
|
||||
"stock_sequence.xml",
|
||||
|
||||
@@ -45,5 +45,6 @@
|
||||
|
||||
<menuitem icon="terp-graph" id="menu_dashboard_stock" name="Dashboard" sequence="0" parent="stock.next_id_61"/>
|
||||
<menuitem action="open_board_warehouse" icon="terp-graph" id="menu_board_warehouse" parent="menu_dashboard_stock" sequence="1"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
+11
-13
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
@@ -15,7 +15,7 @@
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
@@ -23,29 +23,27 @@ from osv import fields, osv
|
||||
import ir
|
||||
|
||||
class res_partner(osv.osv):
|
||||
_name = 'res.partner'
|
||||
_inherit = 'res.partner'
|
||||
_columns = {
|
||||
'property_stock_customer': fields.property(
|
||||
'stock.location',
|
||||
type='many2one',
|
||||
relation='stock.location',
|
||||
string="Customer Location",
|
||||
type='many2one',
|
||||
relation='stock.location',
|
||||
string="Customer Location",
|
||||
method=True,
|
||||
view_load=True,
|
||||
help="This stock location will be used, instead of the default one, as the destination location for goods you send to this partner"),
|
||||
|
||||
'property_stock_supplier': fields.property(
|
||||
'stock.location',
|
||||
type='many2one',
|
||||
relation='stock.location',
|
||||
string="Supplier Location",
|
||||
type='many2one',
|
||||
relation='stock.location',
|
||||
string="Supplier Location",
|
||||
method=True,
|
||||
view_load=True,
|
||||
help="This stock location will be used, instead of the default one, as the source location for goods you receive from the current partner"),
|
||||
}
|
||||
|
||||
res_partner()
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -22,4 +22,4 @@
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</openerp>
|
||||
+44
-39
@@ -22,45 +22,46 @@
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
|
||||
|
||||
class product_product(osv.osv):
|
||||
_inherit = "product.product"
|
||||
|
||||
def get_product_accounts(self, cr, uid, product_id, context=None):
|
||||
""" To get the stock input account, stock output account and stock journal related to product.
|
||||
@param product_id: product id
|
||||
@param product_id: product id
|
||||
@return: dictionary which contains information regarding stock input account, stock output account and stock journal
|
||||
"""
|
||||
product_obj = self.pool.get('product.product').browse(cr, uid, product_id, context)
|
||||
|
||||
stock_input_acc = product_obj.property_stock_account_input and product_obj.property_stock_account_input.id or False
|
||||
if context is None:
|
||||
context = {}
|
||||
product_obj = self.pool.get('product.product').browse(cr, uid, product_id, context=context)
|
||||
|
||||
stock_input_acc = product_obj.property_stock_account_input and product_obj.property_stock_account_input.id or False
|
||||
if not stock_input_acc:
|
||||
stock_input_acc = product_obj.categ_id.property_stock_account_input_categ and product_obj.categ_id.property_stock_account_input_categ.id or False
|
||||
|
||||
|
||||
stock_output_acc = product_obj.property_stock_account_output and product_obj.property_stock_account_output.id or False
|
||||
if not stock_output_acc:
|
||||
stock_output_acc = product_obj.categ_id.property_stock_account_output_categ and product_obj.categ_id.property_stock_account_output_categ.id or False
|
||||
|
||||
journal_id = product_obj.categ_id.property_stock_journal and product_obj.categ_id.property_stock_journal.id or False
|
||||
account_variation = product_obj.categ_id.property_stock_variation and product_obj.categ_id.property_stock_variation.id or False
|
||||
|
||||
|
||||
return {
|
||||
'stock_account_input': stock_input_acc,
|
||||
'stock_account_output': stock_output_acc,
|
||||
'stock_journal': journal_id,
|
||||
'stock_account_input': stock_input_acc,
|
||||
'stock_account_output': stock_output_acc,
|
||||
'stock_journal': journal_id,
|
||||
'property_stock_variation': account_variation
|
||||
}
|
||||
}
|
||||
|
||||
def do_change_standard_price(self, cr, uid, ids, datas, context={}):
|
||||
""" Changes the Standard Price of Product and creates an account move accordingly.
|
||||
@param datas : dict. contain default datas like new_price, stock_output_account, stock_input_account, stock_journal
|
||||
@param context: A standard dictionary
|
||||
@return:
|
||||
|
||||
"""
|
||||
@param context: A standard dictionary
|
||||
@return:
|
||||
|
||||
"""
|
||||
location_obj = self.pool.get('stock.location')
|
||||
move_obj = self.pool.get('account.move')
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
move_line_obj = self.pool.get('account.move.line')
|
||||
|
||||
new_price = datas.get('new_price', 0.0)
|
||||
stock_output_acc = datas.get('stock_output_account', False)
|
||||
@@ -71,7 +72,7 @@ class product_product(osv.osv):
|
||||
account_variation = product_obj.categ_id.property_stock_variation
|
||||
account_variation_id = account_variation and account_variation.id or False
|
||||
if not account_variation_id: raise osv.except_osv(_('Error!'), _('Variation Account is not specified for Product Category: %s' % (product_obj.categ_id.name)))
|
||||
move_ids = []
|
||||
move_ids = []
|
||||
loc_ids = location_obj.search(cr, uid,[('usage','=','internal')])
|
||||
for rec_id in ids:
|
||||
for location in location_obj.browse(cr, uid, loc_ids):
|
||||
@@ -79,14 +80,14 @@ class product_product(osv.osv):
|
||||
c.update({
|
||||
'location': location.id,
|
||||
'compute_child': False
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
product = self.browse(cr, uid, rec_id, context=c)
|
||||
qty = product.qty_available
|
||||
diff = product.standard_price - new_price
|
||||
diff = product.standard_price - new_price
|
||||
if not diff: raise osv.except_osv(_('Error!'), _("Could not find any difference between standard price and new price!"))
|
||||
if qty:
|
||||
company_id = location.company_id and location.company_id.id or False
|
||||
company_id = location.company_id and location.company_id.id or False
|
||||
if not company_id: raise osv.except_osv(_('Error!'), _('Company is not specified in Location'))
|
||||
#
|
||||
# Accounting Entries
|
||||
@@ -100,10 +101,10 @@ class product_product(osv.osv):
|
||||
(product.categ_id.name,
|
||||
product.categ_id.id,))
|
||||
move_id = move_obj.create(cr, uid, {
|
||||
'journal_id': journal_id,
|
||||
'journal_id': journal_id,
|
||||
'company_id': company_id
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
move_ids.append(move_id)
|
||||
|
||||
|
||||
@@ -120,7 +121,7 @@ class product_product(osv.osv):
|
||||
'for this product: "%s" (id: %d)') % \
|
||||
(product.name,
|
||||
product.id,))
|
||||
amount_diff = qty * diff
|
||||
amount_diff = qty * diff
|
||||
move_line_obj.create(cr, uid, {
|
||||
'name': product.name,
|
||||
'account_id': stock_input_acc,
|
||||
@@ -133,7 +134,7 @@ class product_product(osv.osv):
|
||||
'credit': amount_diff,
|
||||
'move_id': move_id
|
||||
})
|
||||
elif diff < 0:
|
||||
elif diff < 0:
|
||||
if not stock_output_acc:
|
||||
stock_output_acc = product.product_tmpl_id.\
|
||||
property_stock_account_output.id
|
||||
@@ -158,13 +159,15 @@ class product_product(osv.osv):
|
||||
'account_id': account_variation_id,
|
||||
'debit': amount_diff,
|
||||
'move_id': move_id
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
self.write(cr, uid, rec_id, {'standard_price': new_price})
|
||||
|
||||
return move_ids
|
||||
|
||||
def view_header_get(self, cr, user, view_id, view_type, context):
|
||||
def view_header_get(self, cr, user, view_id, view_type, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
res = super(product_product, self).view_header_get(cr, user, view_id, view_type, context)
|
||||
if res: return res
|
||||
if (context.get('location', False)):
|
||||
@@ -280,12 +283,14 @@ class product_product(osv.osv):
|
||||
res[prod_id] -= amount
|
||||
return res
|
||||
|
||||
def _product_available(self, cr, uid, ids, field_names=None, arg=False, context={}):
|
||||
def _product_available(self, cr, uid, ids, field_names=None, arg=False, context=None):
|
||||
""" Finds the incoming and outgoing quantity of product.
|
||||
@return: Dictionary of values
|
||||
"""
|
||||
if not field_names:
|
||||
field_names = []
|
||||
if context is None:
|
||||
context = {}
|
||||
res = {}
|
||||
for id in ids:
|
||||
res[id] = {}.fromkeys(field_names, 0.0)
|
||||
@@ -323,7 +328,7 @@ class product_product(osv.osv):
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
res = super(product_product,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu)
|
||||
if context == None:
|
||||
if context is None:
|
||||
context = {}
|
||||
if ('location' in context) and context['location']:
|
||||
location_info = self.pool.get('stock.location').browse(cr, uid, context['location'])
|
||||
@@ -348,7 +353,7 @@ class product_product(osv.osv):
|
||||
if location_info.usage == 'inventory':
|
||||
if fields.get('virtual_available'):
|
||||
res['fields']['virtual_available']['string'] = _('Future P&L')
|
||||
if fields.get('qty_available'):
|
||||
if fields.get('qty_available'):
|
||||
res['fields']['qty_available']['string'] = _('P&L Qty')
|
||||
|
||||
if location_info.usage == 'procurement':
|
||||
@@ -362,10 +367,9 @@ class product_product(osv.osv):
|
||||
res['fields']['virtual_available']['string'] = _('Future Productions')
|
||||
if fields.get('qty_available'):
|
||||
res['fields']['qty_available']['string'] = _('Produced Qty')
|
||||
|
||||
return res
|
||||
product_product()
|
||||
|
||||
product_product()
|
||||
|
||||
class product_template(osv.osv):
|
||||
_name = 'product.template'
|
||||
@@ -407,10 +411,11 @@ class product_template(osv.osv):
|
||||
string='Stock Output Account', method=True, view_load=True,
|
||||
help='This account will be used, instead of the default one, to value output stock'),
|
||||
}
|
||||
|
||||
product_template()
|
||||
|
||||
|
||||
class product_category(osv.osv):
|
||||
|
||||
_inherit = 'product.category'
|
||||
_columns = {
|
||||
'property_stock_journal': fields.property('account.journal',
|
||||
@@ -425,14 +430,14 @@ class product_category(osv.osv):
|
||||
type='many2one', relation='account.account',
|
||||
string='Stock Output Account', method=True, view_load=True,
|
||||
help='This account will be used to value the output stock'),
|
||||
'property_stock_variation': fields.property('account.account',
|
||||
'property_stock_variation': fields.property('account.account',
|
||||
type='many2one',
|
||||
relation='account.account',
|
||||
string="Stock Variation Account",
|
||||
method=True, view_load=True,
|
||||
method=True, view_load=True,
|
||||
help="This account will be used in product when valuation type is real-time valuation ",),
|
||||
}
|
||||
|
||||
product_category()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -32,6 +32,6 @@
|
||||
<field eval="False" name="value"/>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</openerp>
|
||||
@@ -86,7 +86,7 @@
|
||||
<field name="partner_id" context="{'contact_display':'partner'}"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By...">
|
||||
<group expand="1" string="Group By...">
|
||||
<filter name="group_partner" string="Partner" icon="terp-personal" context="{'group_by':'partner_id'}"/>
|
||||
<filter name="group_product" string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id'}"/>
|
||||
<filter name="group_picking" string="Packing" icon="terp-accessories-archiver" context="{'group_by':'picking_id'}"/>
|
||||
|
||||
@@ -37,6 +37,7 @@ class report_stock_picking(osv.osv):
|
||||
'product_uos_qty': fields.float('# of Products', readonly=True),
|
||||
'product_id': fields.many2one('product.product', 'Product', readonly=True),
|
||||
'date': fields.date('Date', readonly=True),
|
||||
'avg_days_late': fields.float('Avg Due Days', digits=(16,2), readonly=True, group_operator="avg"),
|
||||
'avg_days_to_deliver': fields.float('Avg Days to Deliver', digits=(16,2), readonly=True, group_operator="avg",
|
||||
help="Number of Avg Days to deliver"),
|
||||
'state': fields.selection([('draft', 'Draft'),('auto', 'Waiting'),('confirmed', 'Confirmed'),('assigned', 'Available'),('done', 'Done'),('cancel', 'Cancelled')], 'State'),
|
||||
@@ -71,8 +72,7 @@ class report_stock_picking(osv.osv):
|
||||
sp.address_id as partner_id,
|
||||
to_date(to_char(sp.create_date, 'MM-dd-YYYY'),'MM-dd-YYYY') as date,
|
||||
count(sm.id) as nbr,
|
||||
count(distinct sp.id) as nbp,
|
||||
sum(sm.product_qty) as product_qty,
|
||||
sum(sm.product_qty*u.factor) as product_qty,
|
||||
sum(sm.product_uos_qty) as product_uos_qty,
|
||||
sm.product_id as product_id,
|
||||
sm.location_dest_id as location_dest_id,
|
||||
@@ -83,9 +83,11 @@ class report_stock_picking(osv.osv):
|
||||
sp.invoice_state,
|
||||
sp.company_id as company_id,
|
||||
avg(extract('epoch' from (sp.date_done-sp.create_date)))/(3600*24) as avg_days_to_deliver,
|
||||
avg(extract('epoch' from (sp.date_done-sp.min_date)))/(3600*24) as avg_days_late,
|
||||
sp.state
|
||||
from stock_move as sm
|
||||
left join stock_picking as sp ON (sm.picking_id=sp.id)
|
||||
from stock_picking as sp
|
||||
Inner join stock_move as sm ON (sm.picking_id=sp.id)
|
||||
Inner join product_uom u on (u.id=sm.product_uom)
|
||||
group by sp.type,
|
||||
sp.create_date,
|
||||
sp.address_id,
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
<field name="type" invisible="1"/>
|
||||
<field name="invoice_state" invisible="1"/>
|
||||
<field name="state" invisible="1"/>
|
||||
<field name="product_qty" sum="# of Products" />
|
||||
<field name="nbp" sum="# of Pickings" />
|
||||
<field name="nbr" sum="# of Lines" />
|
||||
<field name="avg_days_to_deliver" avg='Avg Days to Deliver'/>
|
||||
<field name="product_qty" sum="# of Products" />
|
||||
<field name="avg_days_to_deliver" avg='Avg Days to Deliver'/>
|
||||
<field name="avg_days_late" avg='Avg Due Days'/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -69,37 +69,39 @@
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Todo" icon="terp-gtk-go-back-rtl" domain="[('state','in',('draft','auto','confirmed','assigned'))]"/>
|
||||
<filter string="Done" icon="terp-dialog-close" domain="[('state','=','done')]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="partner_id"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By...">
|
||||
<group expand="1" string="Group By...">
|
||||
<filter string="Partner" name="Partner" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
<filter string="Company" icon="terp-go-home" domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
|
||||
<filter string="Shipping Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'type'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Shipping Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'type'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
||||
<filter string="Invoice Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'invoice_state'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Company" icon="terp-go-home" domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Day" icon="terp-go-today" domain="[]" context="{'group_by':'day'}"/>
|
||||
<filter string="Month" icon="terp-go-month" domain="[]" context="{'group_by':'month'}"/>
|
||||
<filter string="Year" icon="terp-go-year" domain="[]" context="{'group_by':'year'}"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended options..." groups="base.group_extended">
|
||||
<field name="type"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="min_date"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="max_date"/>
|
||||
<newline/>
|
||||
<field name="product_id"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="type"/>
|
||||
<field name="invoice_state"/>
|
||||
<separator orientation="vertical"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
|
||||
<newline/>
|
||||
<field name="order_date"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="date_done"/>
|
||||
<field name="min_date"/>
|
||||
<field name="max_date"/>
|
||||
</group>
|
||||
|
||||
</search>
|
||||
|
||||
+143
-128
@@ -20,15 +20,13 @@
|
||||
|
||||
from datetime import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
import time
|
||||
|
||||
from osv import fields, osv
|
||||
from tools import config
|
||||
from tools.translate import _
|
||||
import math
|
||||
import netsvc
|
||||
import time
|
||||
import tools
|
||||
|
||||
import decimal_precision as dp
|
||||
|
||||
|
||||
@@ -39,12 +37,12 @@ class stock_incoterms(osv.osv):
|
||||
_name = "stock.incoterms"
|
||||
_description = "Incoterms"
|
||||
_columns = {
|
||||
'name': fields.char('Name', size=64, required=True,help="Incoterms are series of sales terms.They are used to divide transaction costs and responsibilities between buyer and seller and reflect state-of-the-art transportation practices."),
|
||||
'code': fields.char('Code', size=3, required=True,help="Code for Incoterms"),
|
||||
'name': fields.char('Name', size=64, required=True, help="Incoterms are series of sales terms.They are used to divide transaction costs and responsibilities between buyer and seller and reflect state-of-the-art transportation practices."),
|
||||
'code': fields.char('Code', size=3, required=True, help="Code for Incoterms"),
|
||||
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the incoterms without removing it."),
|
||||
}
|
||||
_defaults = {
|
||||
'active': lambda *a: True,
|
||||
'active': True,
|
||||
}
|
||||
|
||||
stock_incoterms()
|
||||
@@ -54,11 +52,12 @@ class stock_journal(osv.osv):
|
||||
_description = "Stock Journal"
|
||||
_columns = {
|
||||
'name': fields.char('Stock Journal', size=32, required=True),
|
||||
'user_id': fields.many2one('res.users','Responsible'),
|
||||
'user_id': fields.many2one('res.users', 'Responsible'),
|
||||
}
|
||||
_defaults = {
|
||||
'user_id': lambda s,c,u,ctx: u
|
||||
'user_id': lambda s, c, u, ctx: u
|
||||
}
|
||||
|
||||
stock_journal()
|
||||
|
||||
#----------------------------------------------------------
|
||||
@@ -72,22 +71,24 @@ class stock_location(osv.osv):
|
||||
_parent_order = 'id'
|
||||
_order = 'parent_left'
|
||||
|
||||
def name_get(self, cr, uid, ids, context={}):
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
res = []
|
||||
if context is None:
|
||||
context = {}
|
||||
if not len(ids):
|
||||
return []
|
||||
reads = self.read(cr, uid, ids, ['name','location_id'], context)
|
||||
res = []
|
||||
reads = self.read(cr, uid, ids, ['name','location_id'], context=context)
|
||||
for record in reads:
|
||||
name = record['name']
|
||||
if context.get('full',False):
|
||||
if record['location_id']:
|
||||
name = record['location_id'][1]+' / '+name
|
||||
name = record['location_id'][1] + ' / ' + name
|
||||
res.append((record['id'], name))
|
||||
else:
|
||||
res.append((record['id'], name))
|
||||
return res
|
||||
|
||||
def _complete_name(self, cr, uid, ids, name, args, context):
|
||||
def _complete_name(self, cr, uid, ids, name, args, context=None):
|
||||
""" Forms complete name of location from parent location to child location.
|
||||
@return: Dictionary of values
|
||||
"""
|
||||
@@ -102,7 +103,7 @@ class stock_location(osv.osv):
|
||||
res[m.id] = _get_one_full_name(m)
|
||||
return res
|
||||
|
||||
def _product_qty_available(self, cr, uid, ids, field_names, arg, context={}):
|
||||
def _product_qty_available(self, cr, uid, ids, field_names, arg, context=None):
|
||||
""" Finds real and virtual quantity for product available at particular location.
|
||||
@return: Dictionary of values
|
||||
"""
|
||||
@@ -121,7 +122,7 @@ class stock_location(osv.osv):
|
||||
res[loc]['stock_virtual'] = prod.virtual_available
|
||||
return res
|
||||
|
||||
def product_detail(self, cr, uid, id, field, context={}):
|
||||
def product_detail(self, cr, uid, id, field, context=None):
|
||||
""" Finds detail of product like price type, currency and then calculates its price.
|
||||
@param field: Field name
|
||||
@return: Calculated price
|
||||
@@ -130,6 +131,8 @@ class stock_location(osv.osv):
|
||||
res[id] = {}
|
||||
final_value = 0.0
|
||||
field_to_read = 'virtual_available'
|
||||
if context is None:
|
||||
context = {}
|
||||
if field == 'stock_real_value':
|
||||
field_to_read = 'qty_available'
|
||||
cr.execute('select distinct product_id from stock_move where (location_id=%s) or (location_dest_id=%s)', (id, id))
|
||||
@@ -138,20 +141,18 @@ class stock_location(osv.osv):
|
||||
# Choose the right filed standard_price to read
|
||||
# Take the user company
|
||||
price_type_id = self.pool.get('res.users').browse(cr,uid,uid).company_id.property_valuation_price_type.id
|
||||
pricetype = self.pool.get('product.price.type').browse(cr, uid, price_type_id)
|
||||
pricetype = self.pool.get('product.price.type').browse(cr, uid, price_type_id, context=context)
|
||||
for r in result:
|
||||
c = (context or {}).copy()
|
||||
c['location'] = id
|
||||
product = self.pool.get('product.product').read(cr, uid, r['product_id'], [field_to_read], context=c)
|
||||
# Compute the amount_unit in right currency
|
||||
|
||||
context['currency_id'] = self.pool.get('res.users').browse(cr,uid,uid).company_id.currency_id.id
|
||||
amount_unit = self.pool.get('product.product').browse(cr,uid,r['product_id']).price_get(pricetype.field, context)[r['product_id']]
|
||||
|
||||
final_value += (product[field_to_read] * amount_unit)
|
||||
return final_value
|
||||
|
||||
def _product_value(self, cr, uid, ids, field_names, arg, context={}):
|
||||
def _product_value(self, cr, uid, ids, field_names, arg, context=None):
|
||||
""" Calculates real and virtual stock value of a product.
|
||||
@param field_names: Name of field
|
||||
@return: Dictionary of values
|
||||
@@ -211,20 +212,20 @@ class stock_location(osv.osv):
|
||||
'scrap_location': fields.boolean('Scrap Location', help='Check this box if the current location is a place for destroyed items'),
|
||||
}
|
||||
_defaults = {
|
||||
'active': lambda *a: 1,
|
||||
'usage': lambda *a: 'internal',
|
||||
'allocation_method': lambda *a: 'fifo',
|
||||
'chained_location_type': lambda *a: 'none',
|
||||
'chained_auto_packing': lambda *a: 'manual',
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.location', context=c),
|
||||
'posx': lambda *a: 0,
|
||||
'posy': lambda *a: 0,
|
||||
'posz': lambda *a: 0,
|
||||
'icon': lambda *a: False,
|
||||
'scrap_location': lambda *a: False,
|
||||
'active': True,
|
||||
'usage': 'internal',
|
||||
'allocation_method': 'fifo',
|
||||
'chained_location_type': 'none',
|
||||
'chained_auto_packing': 'manual',
|
||||
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.location', context=c),
|
||||
'posx': 0,
|
||||
'posy': 0,
|
||||
'posz': 0,
|
||||
'icon': False,
|
||||
'scrap_location': False,
|
||||
}
|
||||
|
||||
def chained_location_get(self, cr, uid, location, partner=None, product=None, context={}):
|
||||
def chained_location_get(self, cr, uid, location, partner=None, product=None, context=None):
|
||||
""" Finds chained location
|
||||
@param location: Location id
|
||||
@param partner: Partner id
|
||||
@@ -241,7 +242,7 @@ class stock_location(osv.osv):
|
||||
return result, location.chained_auto_packing, location.chained_delay, location.chained_journal_id and location.chained_journal_id.id or False, location.chained_company_id and location.chained_company_id.id or False, location.chained_picking_type
|
||||
return result
|
||||
|
||||
def picking_type_get(self, cr, uid, from_location, to_location, context={}):
|
||||
def picking_type_get(self, cr, uid, from_location, to_location, context=None):
|
||||
""" Gets type of picking.
|
||||
@param from_location: Source location
|
||||
@param to_location: Destination location
|
||||
@@ -250,14 +251,12 @@ class stock_location(osv.osv):
|
||||
result = 'internal'
|
||||
if (from_location.usage=='internal') and (to_location and to_location.usage in ('customer', 'supplier')):
|
||||
result = 'delivery'
|
||||
elif (from_location.usage in ('supplier', 'customer')) and (to_location.usage=='internal'):
|
||||
elif (from_location.usage in ('supplier', 'customer')) and (to_location.usage == 'internal'):
|
||||
result = 'in'
|
||||
return result
|
||||
|
||||
def _product_get_all_report(self, cr, uid, ids, product_ids=False,
|
||||
context=None):
|
||||
return self._product_get_report(cr, uid, ids, product_ids, context,
|
||||
recursive=True)
|
||||
def _product_get_all_report(self, cr, uid, ids, product_ids=False, context=None):
|
||||
return self._product_get_report(cr, uid, ids, product_ids, context, recursive=True)
|
||||
|
||||
def _product_get_report(self, cr, uid, ids, product_ids=False,
|
||||
context=None, recursive=False):
|
||||
@@ -325,7 +324,7 @@ class stock_location(osv.osv):
|
||||
result['total_price'] = total_price
|
||||
return result
|
||||
|
||||
def _product_get_multi_location(self, cr, uid, ids, product_ids=False, context={},
|
||||
def _product_get_multi_location(self, cr, uid, ids, product_ids=False, context=None,
|
||||
states=['done'], what=('in', 'out')):
|
||||
"""
|
||||
@param product_ids: Ids of product
|
||||
@@ -334,6 +333,8 @@ class stock_location(osv.osv):
|
||||
@return:
|
||||
"""
|
||||
product_obj = self.pool.get('product.product')
|
||||
if context is None:
|
||||
context = {}
|
||||
context.update({
|
||||
'states': states,
|
||||
'what': what,
|
||||
@@ -341,22 +342,22 @@ class stock_location(osv.osv):
|
||||
})
|
||||
return product_obj.get_product_available(cr, uid, product_ids, context=context)
|
||||
|
||||
def _product_get(self, cr, uid, id, product_ids=False, context={}, states=['done']):
|
||||
def _product_get(self, cr, uid, id, product_ids=False, context=None, states=['done']):
|
||||
"""
|
||||
@param product_ids:
|
||||
@param states:
|
||||
@return:
|
||||
"""
|
||||
ids = id and [id] or []
|
||||
return self._product_get_multi_location(cr, uid, ids, product_ids, context, states)
|
||||
return self._product_get_multi_location(cr, uid, ids, product_ids, context=context, states=states)
|
||||
|
||||
def _product_all_get(self, cr, uid, id, product_ids=False, context={}, states=['done']):
|
||||
def _product_all_get(self, cr, uid, id, product_ids=False, context=None, states=['done']):
|
||||
# build the list of ids of children of the location given by id
|
||||
ids = id and [id] or []
|
||||
location_ids = self.search(cr, uid, [('location_id', 'child_of', ids)])
|
||||
return self._product_get_multi_location(cr, uid, location_ids, product_ids, context, states)
|
||||
|
||||
def _product_virtual_get(self, cr, uid, id, product_ids=False, context={}, states=['done']):
|
||||
def _product_virtual_get(self, cr, uid, id, product_ids=False, context=None, states=['done']):
|
||||
return self._product_all_get(cr, uid, id, product_ids, context, ['confirmed', 'waiting', 'assigned', 'done'])
|
||||
|
||||
#
|
||||
@@ -366,7 +367,7 @@ class stock_location(osv.osv):
|
||||
# Returns:
|
||||
# [ (tracking_id, product_qty, location_id) ]
|
||||
#
|
||||
def _product_reserve(self, cr, uid, ids, product_id, product_qty, context={}):
|
||||
def _product_reserve(self, cr, uid, ids, product_id, product_qty, context=None):
|
||||
"""
|
||||
@param product_id: Id of product
|
||||
@param product_qty: Quantity of product
|
||||
@@ -374,6 +375,8 @@ class stock_location(osv.osv):
|
||||
"""
|
||||
result = []
|
||||
amount = 0.0
|
||||
if context is None:
|
||||
context = {}
|
||||
for id in self.search(cr, uid, [('location_id', 'child_of', ids)]):
|
||||
cr.execute("select product_uom,sum(product_qty) as product_qty from stock_move where location_dest_id=%s and location_id<>%s and product_id=%s and state='done' group by product_uom", (id, id, product_id))
|
||||
results = cr.dictfetchall()
|
||||
@@ -418,7 +421,7 @@ class stock_tracking(osv.osv):
|
||||
return (10 - (sum % 10)) % 10
|
||||
checksum = staticmethod(checksum)
|
||||
|
||||
def make_sscc(self, cr, uid, context={}):
|
||||
def make_sscc(self, cr, uid, context=None):
|
||||
sequence = self.pool.get('ir.sequence').get(cr, uid, 'stock.lot.tracking')
|
||||
return sequence + str(self.checksum(sequence))
|
||||
|
||||
@@ -430,9 +433,9 @@ class stock_tracking(osv.osv):
|
||||
'date': fields.datetime('Created Date', required=True),
|
||||
}
|
||||
_defaults = {
|
||||
'active': lambda *a: 1,
|
||||
'active': 1,
|
||||
'name': make_sscc,
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
}
|
||||
|
||||
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
|
||||
@@ -444,7 +447,7 @@ class stock_tracking(osv.osv):
|
||||
ids += self.search(cr, user, [('name', operator, name)]+ args, limit=limit, context=context)
|
||||
return self.name_get(cr, user, ids, context)
|
||||
|
||||
def name_get(self, cr, uid, ids, context={}):
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
if not len(ids):
|
||||
return []
|
||||
res = [(r['id'], r['name']+' ['+(r['serial'] or '')+']') for r in self.read(cr, uid, ids, ['name', 'serial'], context)]
|
||||
@@ -455,7 +458,6 @@ class stock_tracking(osv.osv):
|
||||
|
||||
stock_tracking()
|
||||
|
||||
|
||||
#----------------------------------------------------------
|
||||
# Stock Picking
|
||||
#----------------------------------------------------------
|
||||
@@ -463,7 +465,7 @@ class stock_picking(osv.osv):
|
||||
_name = "stock.picking"
|
||||
_description = "Picking List"
|
||||
|
||||
def _set_maximum_date(self, cr, uid, ids, name, value, arg, context):
|
||||
def _set_maximum_date(self, cr, uid, ids, name, value, arg, context=None):
|
||||
""" Calculates planned date if it is greater than 'value'.
|
||||
@param name: Name of field
|
||||
@param value: Value of field
|
||||
@@ -485,7 +487,7 @@ class stock_picking(osv.osv):
|
||||
cr.execute(sql_str)
|
||||
return True
|
||||
|
||||
def _set_minimum_date(self, cr, uid, ids, name, value, arg, context):
|
||||
def _set_minimum_date(self, cr, uid, ids, name, value, arg, context=None):
|
||||
""" Calculates planned date if it is less than 'value'.
|
||||
@param name: Name of field
|
||||
@param value: Value of field
|
||||
@@ -496,7 +498,7 @@ class stock_picking(osv.osv):
|
||||
return False
|
||||
if isinstance(ids, (int, long)):
|
||||
ids = [ids]
|
||||
for pick in self.browse(cr, uid, ids, context):
|
||||
for pick in self.browse(cr, uid, ids, context=context):
|
||||
sql_str = """update stock_move set
|
||||
date_planned='%s'
|
||||
where
|
||||
@@ -506,7 +508,7 @@ class stock_picking(osv.osv):
|
||||
cr.execute(sql_str)
|
||||
return True
|
||||
|
||||
def get_min_max_date(self, cr, uid, ids, field_name, arg, context={}):
|
||||
def get_min_max_date(self, cr, uid, ids, field_name, arg, context=None):
|
||||
""" Finds minimum and maximum dates for picking.
|
||||
@return: Dictionary of values
|
||||
"""
|
||||
@@ -589,16 +591,16 @@ class stock_picking(osv.osv):
|
||||
}
|
||||
_defaults = {
|
||||
'name': lambda self, cr, uid, context: '/',
|
||||
'active': lambda *a: 1,
|
||||
'state': lambda *a: 'draft',
|
||||
'move_type': lambda *a: 'direct',
|
||||
'type': lambda *a: 'in',
|
||||
'invoice_state': lambda *a: 'none',
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.picking', context=c)
|
||||
'active': 1,
|
||||
'state': 'draft',
|
||||
'move_type': 'direct',
|
||||
'type': 'in',
|
||||
'invoice_state': 'none',
|
||||
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.picking', context=c)
|
||||
}
|
||||
|
||||
def copy(self, cr, uid, id, default=None, context={}):
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
if default is None:
|
||||
default = {}
|
||||
default = default.copy()
|
||||
@@ -606,16 +608,15 @@ class stock_picking(osv.osv):
|
||||
if ('name' not in default) or (picking_obj.name=='/'):
|
||||
seq_obj_name = 'stock.picking.' + picking_obj.type
|
||||
default['name'] = self.pool.get('ir.sequence').get(cr, uid, seq_obj_name)
|
||||
|
||||
return super(stock_picking, self).copy(cr, uid, id, default, context)
|
||||
|
||||
def onchange_partner_in(self, cr, uid, context, partner_id=None):
|
||||
def onchange_partner_in(self, cr, uid, context=None, partner_id=None):
|
||||
return {}
|
||||
|
||||
def action_explode(self, cr, uid, moves, context={}):
|
||||
def action_explode(self, cr, uid, moves, context=None):
|
||||
return moves
|
||||
|
||||
def action_confirm(self, cr, uid, ids, context={}):
|
||||
def action_confirm(self, cr, uid, ids, context=None):
|
||||
""" Confirms picking.
|
||||
@return: True
|
||||
"""
|
||||
@@ -627,7 +628,7 @@ class stock_picking(osv.osv):
|
||||
todo.append(r.id)
|
||||
todo = self.action_explode(cr, uid, todo, context)
|
||||
if len(todo):
|
||||
self.pool.get('stock.move').action_confirm(cr, uid, todo, context)
|
||||
self.pool.get('stock.move').action_confirm(cr, uid, todo, context=context)
|
||||
return True
|
||||
|
||||
def test_auto_picking(self, cr, uid, ids):
|
||||
@@ -749,7 +750,7 @@ class stock_picking(osv.osv):
|
||||
ok = ok and (move.state in ('cancel', 'done', 'assigned'))
|
||||
return ok
|
||||
|
||||
def action_cancel(self, cr, uid, ids, context={}):
|
||||
def action_cancel(self, cr, uid, ids, context=None):
|
||||
""" Changes picking state to cancel.
|
||||
@return: True
|
||||
"""
|
||||
@@ -771,7 +772,7 @@ class stock_picking(osv.osv):
|
||||
self.write(cr, uid, ids, {'state': 'done', 'date_done': time.strftime('%Y-%m-%d %H:%M:%S')})
|
||||
return True
|
||||
|
||||
def action_move(self, cr, uid, ids, context={}):
|
||||
def action_move(self, cr, uid, ids, context=None):
|
||||
""" Changes move state to assigned.
|
||||
@return: True
|
||||
"""
|
||||
@@ -780,7 +781,6 @@ class stock_picking(osv.osv):
|
||||
for move in pick.move_lines:
|
||||
if move.state == 'assigned':
|
||||
todo.append(move.id)
|
||||
|
||||
if len(todo):
|
||||
self.pool.get('stock.move').action_done(cr, uid, todo,
|
||||
context=context)
|
||||
@@ -1007,7 +1007,7 @@ class stock_picking(osv.osv):
|
||||
}, context=context)
|
||||
return res
|
||||
|
||||
def test_done(self, cr, uid, ids, context={}):
|
||||
def test_done(self, cr, uid, ids, context=None):
|
||||
ok = False
|
||||
for pick in self.browse(cr, uid, ids, context=context):
|
||||
if not pick.move_lines:
|
||||
@@ -1019,7 +1019,7 @@ class stock_picking(osv.osv):
|
||||
ok = True
|
||||
return ok
|
||||
|
||||
def test_cancel(self, cr, uid, ids, context={}):
|
||||
def test_cancel(self, cr, uid, ids, context=None):
|
||||
""" Test whether the move lines are canceled or not.
|
||||
@return: True or False
|
||||
"""
|
||||
@@ -1035,7 +1035,6 @@ class stock_picking(osv.osv):
|
||||
move_obj = self.pool.get('stock.move')
|
||||
if not context:
|
||||
context = {}
|
||||
|
||||
for pick in self.browse(cr, uid, ids, context=context):
|
||||
if pick.state in ['done','cancel']:
|
||||
raise osv.except_osv(_('Error'), _('You cannot remove the picking which is in %s state !')%(pick.state,))
|
||||
@@ -1051,7 +1050,7 @@ class stock_picking(osv.osv):
|
||||
|
||||
return super(stock_picking, self).unlink(cr, uid, ids, context=context)
|
||||
|
||||
def do_partial(self, cr, uid, ids, partial_datas, context={}):
|
||||
def do_partial(self, cr, uid, ids, partial_datas, context=None):
|
||||
""" Makes partial picking and moves done.
|
||||
@param partial_datas : Dictionary containing details of partial picking
|
||||
like partner_id, address_id, delivery_date,
|
||||
@@ -1059,7 +1058,6 @@ class stock_picking(osv.osv):
|
||||
@return: Dictionary of values
|
||||
"""
|
||||
res = {}
|
||||
|
||||
move_obj = self.pool.get('stock.move')
|
||||
product_obj = self.pool.get('product.product')
|
||||
currency_obj = self.pool.get('res.currency')
|
||||
@@ -1074,7 +1072,6 @@ class stock_picking(osv.osv):
|
||||
for pick in self.browse(cr, uid, ids, context=context):
|
||||
new_picking = None
|
||||
new_moves = []
|
||||
|
||||
complete, too_many, too_few = [], [], []
|
||||
move_product_qty = {}
|
||||
for move in pick.move_lines:
|
||||
@@ -1187,13 +1184,14 @@ class stock_picking(osv.osv):
|
||||
|
||||
delivered_pack = self.browse(cr, uid, delivered_pack_id, context=context)
|
||||
res[pick.id] = {'delivered_picking': delivered_pack.id or False}
|
||||
|
||||
return res
|
||||
|
||||
stock_picking()
|
||||
|
||||
|
||||
class stock_production_lot(osv.osv):
|
||||
def name_get(self, cr, uid, ids, context={}):
|
||||
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
if not ids:
|
||||
return []
|
||||
reads = self.read(cr, uid, ids, ['name', 'prefix', 'ref'], context)
|
||||
@@ -1211,7 +1209,7 @@ class stock_production_lot(osv.osv):
|
||||
_name = 'stock.production.lot'
|
||||
_description = 'Production lot'
|
||||
|
||||
def _get_stock(self, cr, uid, ids, field_name, arg, context={}):
|
||||
def _get_stock(self, cr, uid, ids, field_name, arg, context=None):
|
||||
""" Gets stock of products for locations
|
||||
@return: Dictionary of values
|
||||
"""
|
||||
@@ -1233,9 +1231,10 @@ class stock_production_lot(osv.osv):
|
||||
where
|
||||
location_id IN %s and prodlot_id IN %s group by prodlot_id''',(tuple(locations),tuple(ids),))
|
||||
res.update(dict(cr.fetchall()))
|
||||
|
||||
return res
|
||||
|
||||
def _stock_search(self, cr, uid, obj, name, args, context):
|
||||
def _stock_search(self, cr, uid, obj, name, args, context=None):
|
||||
""" Searches Ids of products
|
||||
@return: Ids of locations
|
||||
"""
|
||||
@@ -1263,7 +1262,7 @@ class stock_production_lot(osv.osv):
|
||||
'company_id': fields.many2one('res.company','Company',select=1),
|
||||
}
|
||||
_defaults = {
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'name': lambda x, y, z, c: x.pool.get('ir.sequence').get(y, z, 'stock.lot.serial'),
|
||||
'product_id': lambda x, y, z, c: c.get('product_id', False),
|
||||
}
|
||||
@@ -1289,7 +1288,7 @@ class stock_production_lot_revision(osv.osv):
|
||||
|
||||
_defaults = {
|
||||
'author_id': lambda x, y, z, c: z,
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d'),
|
||||
'date': time.strftime('%Y-%m-%d'),
|
||||
}
|
||||
|
||||
stock_production_lot_revision()
|
||||
@@ -1304,7 +1303,7 @@ stock_production_lot_revision()
|
||||
#
|
||||
class stock_move(osv.osv):
|
||||
|
||||
def _getSSCC(self, cr, uid, context={}):
|
||||
def _getSSCC(self, cr, uid, context=None):
|
||||
cr.execute('select id from stock_tracking where create_uid=%s order by id desc limit 1', (uid,))
|
||||
res = cr.fetchone()
|
||||
return (res and res[0]) or False
|
||||
@@ -1313,7 +1312,7 @@ class stock_move(osv.osv):
|
||||
_order = 'date_expected desc, id'
|
||||
_log_create = False
|
||||
|
||||
def name_get(self, cr, uid, ids, context={}):
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
res = []
|
||||
for line in self.browse(cr, uid, ids, context):
|
||||
res.append((line.id, (line.product_id.code or '/')+': '+line.location_id.name+' > '+line.location_dest_id.name))
|
||||
@@ -1393,7 +1392,7 @@ class stock_move(osv.osv):
|
||||
'You try to assign a lot which is not from the same product',
|
||||
['prodlot_id'])]
|
||||
|
||||
def _default_location_destination(self, cr, uid, context={}):
|
||||
def _default_location_destination(self, cr, uid, context=None):
|
||||
""" Gets default address of partner for destination location
|
||||
@return: Address id or False
|
||||
"""
|
||||
@@ -1409,7 +1408,7 @@ class stock_move(osv.osv):
|
||||
return property_out and property_out.id or False
|
||||
return False
|
||||
|
||||
def _default_location_source(self, cr, uid, context={}):
|
||||
def _default_location_source(self, cr, uid, context=None):
|
||||
""" Gets default address of partner for source location
|
||||
@return: Address id or False
|
||||
"""
|
||||
@@ -1425,24 +1424,24 @@ class stock_move(osv.osv):
|
||||
_defaults = {
|
||||
'location_id': _default_location_source,
|
||||
'location_dest_id': _default_location_destination,
|
||||
'state': lambda *a: 'draft',
|
||||
'priority': lambda *a: '1',
|
||||
'product_qty': lambda *a: 1.0,
|
||||
'scraped' : lambda *a: False,
|
||||
'date_planned': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'state': 'draft',
|
||||
'priority': '1',
|
||||
'product_qty': 1.0,
|
||||
'scraped' : False,
|
||||
'date_planned': time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.move', context=c),
|
||||
'date_expected': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'date_expected': time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
}
|
||||
|
||||
def copy(self, cr, uid, id, default=None, context={}):
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
if default is None:
|
||||
default = {}
|
||||
default = default.copy()
|
||||
return super(stock_move, self).copy(cr, uid, id, default, context)
|
||||
return super(stock_move, self).copy(cr, uid, id, default, context=context)
|
||||
|
||||
def _auto_init(self, cursor, context):
|
||||
res = super(stock_move, self)._auto_init(cursor, context)
|
||||
def _auto_init(self, cursor, context=None):
|
||||
res = super(stock_move, self)._auto_init(cursor, context=context)
|
||||
cursor.execute('SELECT indexname \
|
||||
FROM pg_indexes \
|
||||
WHERE indexname = \'stock_move_location_id_location_dest_id_product_id_state\'')
|
||||
@@ -1535,7 +1534,7 @@ class stock_move(osv.osv):
|
||||
result['location_dest_id'] = loc_dest_id
|
||||
return {'value': result}
|
||||
|
||||
def _chain_compute(self, cr, uid, moves, context={}):
|
||||
def _chain_compute(self, cr, uid, moves, context=None):
|
||||
""" Finds whether the location has chained location type or not.
|
||||
@param moves: Stock moves
|
||||
@return: Dictionary containing destination location with chained location type.
|
||||
@@ -1561,7 +1560,7 @@ class stock_move(osv.osv):
|
||||
result[m.picking_id].append( (m, dest) )
|
||||
return result
|
||||
|
||||
def action_confirm(self, cr, uid, ids, context={}):
|
||||
def action_confirm(self, cr, uid, ids, context=None):
|
||||
""" Confirms stock move.
|
||||
@return: List of ids.
|
||||
"""
|
||||
@@ -1570,10 +1569,12 @@ class stock_move(osv.osv):
|
||||
self.write(cr, uid, ids, {'state': 'confirmed'})
|
||||
i = 0
|
||||
|
||||
def create_chained_picking(self, cr, uid, moves, context):
|
||||
def create_chained_picking(self, cr, uid, moves, context=None):
|
||||
new_moves = []
|
||||
res_obj = self.pool.get('res.company')
|
||||
for picking, todo in self._chain_compute(cr, uid, moves, context).items():
|
||||
if context is None:
|
||||
context = {}
|
||||
for picking, todo in self._chain_compute(cr, uid, moves, context=context).items():
|
||||
ptype = todo[0][1][5] and todo[0][1][5] or self.pool.get('stock.location').picking_type_get(cr, uid, todo[0][0].location_dest_id, todo[0][1][0])
|
||||
pick_name = ''
|
||||
if ptype == 'delivery':
|
||||
@@ -1643,13 +1644,15 @@ class stock_move(osv.osv):
|
||||
#
|
||||
# Duplicate stock.move
|
||||
#
|
||||
def check_assign(self, cr, uid, ids, context={}):
|
||||
def check_assign(self, cr, uid, ids, context=None):
|
||||
""" Checks the product type and accordingly writes the state.
|
||||
@return: No. of moves done
|
||||
"""
|
||||
done = []
|
||||
count = 0
|
||||
pickings = {}
|
||||
if context is None:
|
||||
context = {}
|
||||
for move in self.browse(cr, uid, ids, context=context):
|
||||
if move.product_id.type == 'consu':
|
||||
if move.state in ('confirmed', 'waiting'):
|
||||
@@ -1699,12 +1702,14 @@ class stock_move(osv.osv):
|
||||
#
|
||||
# Cancel move => cancel others move and pickings
|
||||
#
|
||||
def action_cancel(self, cr, uid, ids, context={}):
|
||||
def action_cancel(self, cr, uid, ids, context=None):
|
||||
""" Cancels the moves and if all moves are cancelled it cancels the picking.
|
||||
@return: True
|
||||
"""
|
||||
if not len(ids):
|
||||
return True
|
||||
if context is None:
|
||||
context = {}
|
||||
pickings = {}
|
||||
for move in self.browse(cr, uid, ids):
|
||||
if move.state in ('confirmed', 'waiting', 'assigned', 'draft'):
|
||||
@@ -1737,6 +1742,9 @@ class stock_move(osv.osv):
|
||||
acc_variation = accounts['property_stock_variation']
|
||||
journal_id = accounts['stock_journal']
|
||||
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
if not acc_src:
|
||||
raise osv.except_osv(_('Error!'), _('There is no stock input account defined ' \
|
||||
'for this product: "%s" (id: %d)') % \
|
||||
@@ -1768,8 +1776,7 @@ class stock_move(osv.osv):
|
||||
# amount = q * move.product_id.standard_price
|
||||
return journal_id, acc_src, acc_dest, acc_variation, amount
|
||||
|
||||
|
||||
def action_done(self, cr, uid, ids, context={}):
|
||||
def action_done(self, cr, uid, ids, context=None):
|
||||
""" Makes the move done and if all moves are done, it will finish the picking.
|
||||
@return:
|
||||
"""
|
||||
@@ -1777,8 +1784,10 @@ class stock_move(osv.osv):
|
||||
picking_ids = []
|
||||
product_uom_obj = self.pool.get('product.uom')
|
||||
price_type_obj = self.pool.get('product.price.type')
|
||||
product_obj=self.pool.get('product.product')
|
||||
product_obj = self.pool.get('product.product')
|
||||
move_obj = self.pool.get('account.move')
|
||||
if context is None:
|
||||
context = {}
|
||||
for move in self.browse(cr, uid, ids):
|
||||
if move.picking_id:
|
||||
picking_ids.append(move.picking_id.id)
|
||||
@@ -1854,11 +1863,11 @@ class stock_move(osv.osv):
|
||||
for (id,name) in picking_obj.name_get(cr, uid, picking_ids):
|
||||
message = _('Document') + " '" + name + "' "+ _("is processed")
|
||||
self.log(cr, uid, id, message)
|
||||
|
||||
return True
|
||||
|
||||
def create_account_move(self, cr, uid, move,account_id,account_variation,amount, context=None):
|
||||
|
||||
def create_account_move(self, cr, uid, move,account_id, account_variation, amount, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
partner_id = move.picking_id.address_id and (move.picking_id.address_id.partner_id and move.picking_id.address_id.partner_id.id or False) or False
|
||||
lines=[(0, 0, {
|
||||
'name': move.name,
|
||||
@@ -1941,6 +1950,8 @@ class stock_move(osv.osv):
|
||||
@return: Splited move lines
|
||||
"""
|
||||
|
||||
if context is None:
|
||||
context = {}
|
||||
if quantity <= 0:
|
||||
raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !'))
|
||||
|
||||
@@ -2001,7 +2012,6 @@ class stock_move(osv.osv):
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
if quantity <= 0:
|
||||
raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !'))
|
||||
|
||||
@@ -2032,7 +2042,6 @@ class stock_move(osv.osv):
|
||||
else:
|
||||
current_move = self.copy(cr, uid, move.id, default_val)
|
||||
res += [current_move]
|
||||
|
||||
update_val = {}
|
||||
update_val['product_qty'] = quantity_rest
|
||||
update_val['product_uos_qty'] = uos_qty_rest
|
||||
@@ -2041,7 +2050,6 @@ class stock_move(osv.osv):
|
||||
else:
|
||||
quantity_rest = quantity
|
||||
uos_qty_rest = uos_qty
|
||||
|
||||
if move.product_id.track_production and location_id:
|
||||
res += self.split_lines(cr, uid, [move.id], quantity_rest, split_by_qty=1, context=context)
|
||||
else:
|
||||
@@ -2053,11 +2061,11 @@ class stock_move(osv.osv):
|
||||
}
|
||||
|
||||
self.write(cr, uid, [move.id], update_val)
|
||||
|
||||
self.action_done(cr, uid, res)
|
||||
|
||||
return res
|
||||
|
||||
def do_partial(self, cr, uid, ids, partial_datas, context={}):
|
||||
def do_partial(self, cr, uid, ids, partial_datas, context=None):
|
||||
""" Makes partial pickings and moves done.
|
||||
@param partial_datas: Dictionary containing details of partial picking
|
||||
like partner_id, address_id, delivery_date, delivery
|
||||
@@ -2075,9 +2083,11 @@ class stock_move(osv.osv):
|
||||
partner_id = partial_datas.get('partner_id', False)
|
||||
address_id = partial_datas.get('address_id', False)
|
||||
delivery_date = partial_datas.get('delivery_date', False)
|
||||
|
||||
new_moves = []
|
||||
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
complete, too_many, too_few = [], [], []
|
||||
move_product_qty = {}
|
||||
for move in self.browse(cr, uid, ids, context=context):
|
||||
@@ -2155,7 +2165,7 @@ class stock_move(osv.osv):
|
||||
complete.append(move)
|
||||
|
||||
for move in complete:
|
||||
self.action_done(cr, uid, [move.id], context)
|
||||
self.action_done(cr, uid, [move.id], context=context)
|
||||
if move.picking_id.id :
|
||||
# TOCHECK : Done picking if all moves are done
|
||||
cr.execute("""
|
||||
@@ -2176,7 +2186,6 @@ class stock_move(osv.osv):
|
||||
|
||||
stock_move()
|
||||
|
||||
|
||||
class stock_inventory(osv.osv):
|
||||
_name = "stock.inventory"
|
||||
_description = "Inventory"
|
||||
@@ -2190,12 +2199,11 @@ class stock_inventory(osv.osv):
|
||||
'company_id': fields.many2one('res.company','Company',required=True,select=1),
|
||||
}
|
||||
_defaults = {
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'state': lambda *a: 'draft',
|
||||
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'state': 'draft',
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.inventory', context=c)
|
||||
}
|
||||
|
||||
|
||||
def _inventory_line_hook(self, cr, uid, inventory_line, move_vals):
|
||||
""" Creates a stock move from an inventory line
|
||||
@param inventory_line:
|
||||
@@ -2208,6 +2216,8 @@ class stock_inventory(osv.osv):
|
||||
""" Finishes the inventory and writes its finished date
|
||||
@return: True
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
for inv in self.browse(cr, uid, ids):
|
||||
move_ids = []
|
||||
move_line = []
|
||||
@@ -2250,7 +2260,7 @@ class stock_inventory(osv.osv):
|
||||
self.write(cr, uid, [inv.id], {'state': 'done', 'date_done': time.strftime('%Y-%m-%d %H:%M:%S'), 'move_ids': [(6, 0, move_ids)]})
|
||||
return True
|
||||
|
||||
def action_cancel(self, cr, uid, ids, context={}):
|
||||
def action_cancel(self, cr, uid, ids, context=None):
|
||||
""" Cancels the stock move and change inventory state to draft.
|
||||
@return: True
|
||||
"""
|
||||
@@ -2259,7 +2269,7 @@ class stock_inventory(osv.osv):
|
||||
self.write(cr, uid, [inv.id], {'state': 'draft'})
|
||||
return True
|
||||
|
||||
def action_cancel_inventary(self, cr, uid, ids, context={}):
|
||||
def action_cancel_inventary(self, cr, uid, ids, context=None):
|
||||
""" Cancels both stock move and inventory
|
||||
@return: True
|
||||
"""
|
||||
@@ -2270,7 +2280,6 @@ class stock_inventory(osv.osv):
|
||||
|
||||
stock_inventory()
|
||||
|
||||
|
||||
class stock_inventory_line(osv.osv):
|
||||
_name = "stock.inventory.line"
|
||||
_description = "Inventory Line"
|
||||
@@ -2303,7 +2312,6 @@ class stock_inventory_line(osv.osv):
|
||||
|
||||
stock_inventory_line()
|
||||
|
||||
|
||||
#----------------------------------------------------------
|
||||
# Stock Warehouse
|
||||
#----------------------------------------------------------
|
||||
@@ -2320,8 +2328,9 @@ class stock_warehouse(osv.osv):
|
||||
'lot_output_id': fields.many2one('stock.location', 'Location Output', required=True, domain=[('usage','<>','view')]),
|
||||
}
|
||||
_defaults = {
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.inventory', context=c),
|
||||
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.inventory', context=c),
|
||||
}
|
||||
|
||||
stock_warehouse()
|
||||
|
||||
|
||||
@@ -2330,15 +2339,19 @@ stock_warehouse()
|
||||
class stock_picking_move_wizard(osv.osv_memory):
|
||||
_name = 'stock.picking.move.wizard'
|
||||
|
||||
def _get_picking(self, cr, uid, ctx):
|
||||
def _get_picking(self, cr, uid, ctx=None):
|
||||
if ctx is None:
|
||||
ctx = {}
|
||||
if ctx.get('action_id', False):
|
||||
return ctx['action_id']
|
||||
return False
|
||||
|
||||
def _get_picking_address(self, cr, uid, ctx):
|
||||
def _get_picking_address(self, cr, uid, context=None):
|
||||
picking_obj = self.pool.get('stock.picking')
|
||||
if ctx.get('action_id', False):
|
||||
picking = picking_obj.browse(cr, uid, [ctx['action_id']])[0]
|
||||
if context is None:
|
||||
context = {}
|
||||
if context.get('action_id', False):
|
||||
picking = picking_obj.browse(cr, uid, [context['action_id']])[0]
|
||||
return picking.address_id and picking.address_id.id or False
|
||||
return False
|
||||
|
||||
@@ -2384,7 +2397,6 @@ class report_products_to_received_planned(osv.osv):
|
||||
'planned_qty': fields.integer('Planned Qty'),
|
||||
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'report_products_to_received_planned')
|
||||
cr.execute("""
|
||||
@@ -2406,6 +2418,7 @@ class report_products_to_received_planned(osv.osv):
|
||||
group by stock.date_planned
|
||||
)
|
||||
""")
|
||||
|
||||
report_products_to_received_planned()
|
||||
|
||||
class report_delivery_products_planned(osv.osv):
|
||||
@@ -2442,5 +2455,7 @@ class report_delivery_products_planned(osv.osv):
|
||||
|
||||
)
|
||||
""")
|
||||
|
||||
report_delivery_products_planned()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
+42
-40
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<menuitem icon="terp-stock" id="menu_stock_root" name="Warehouse" sequence="5"/>
|
||||
<menuitem id="menu_stock_warehouse_mgmt" name="Warehouse Management" parent="menu_stock_root" sequence="1"/>
|
||||
<menuitem id="menu_stock_products_moves" name="Products Moves" parent="menu_stock_root" sequence="2"/>
|
||||
@@ -77,8 +78,8 @@
|
||||
<field name="state"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
</record>
|
||||
|
||||
<record id="view_inventory_form" model="ir.ui.view">
|
||||
<field name="name">stock.inventory.form</field>
|
||||
<field name="model">stock.inventory</field>
|
||||
@@ -129,6 +130,7 @@
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_inventory_form" model="ir.actions.act_window">
|
||||
<field name="name">Periodical Inventory</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
@@ -636,18 +638,18 @@
|
||||
<button
|
||||
name="%(stock.track_line)d"
|
||||
string="Split in production lots"
|
||||
groups="base.group_extended"
|
||||
groups="base.group_extended"
|
||||
type="action" icon="terp-stock_effects-object-colorize"
|
||||
states="draft,waiting,confirmed,assigned" />
|
||||
<field groups="base.group_extended" name="tracking_id"/>
|
||||
<button name="setlast_tracking" string="Put in current pack" type="object"
|
||||
attrs="{'invisible': [('tracking_id','<>',False)]}"
|
||||
icon="terp-stock_effects-object-colorize"
|
||||
groups="base.group_extended"
|
||||
attrs="{'invisible': [('tracking_id','<>',False)]}"
|
||||
icon="terp-stock_effects-object-colorize"
|
||||
groups="base.group_extended"
|
||||
states="draft,assigned,confirmed,done"/>
|
||||
<button name="%(split_into)d" string="Put in a new pack" type="action"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize"
|
||||
states="draft,assigned,confirmed,done"/>
|
||||
<field name="location_id"/>
|
||||
<field name="location_dest_id"/>
|
||||
@@ -686,14 +688,14 @@
|
||||
|
||||
<newline/>
|
||||
<label/>
|
||||
<button name="%(track_line)d" string="Split in production lots"
|
||||
<button name="%(track_line)d" string="Split in production lots"
|
||||
states="draft,waiting,confirmed,assigned"
|
||||
type="action" icon="terp-stock_effects-object-colorize"
|
||||
groups="base.group_extended" />
|
||||
<button name="%(move_scrap)d" string="Scrap" type="action" icon="gtk-justify-fill"/>
|
||||
<button name="%(split_into)d" string="Put in a new pack" type="action"
|
||||
states="draft,assigned,confirmed,done"
|
||||
groups="base.group_extended"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize" />
|
||||
<separator colspan="4" string="Move State"/>
|
||||
<field name="state"/>
|
||||
@@ -806,9 +808,9 @@
|
||||
<field name="prodlot_id" groups="base.group_extended"/>
|
||||
<field groups="base.group_extended" name="tracking_id"/>
|
||||
<button name="setlast_tracking" string="Put in current pack" type="object"
|
||||
attrs="{'invisible': [('tracking_id','<>',False)]}"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize"
|
||||
attrs="{'invisible': [('tracking_id','<>',False)]}"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize"
|
||||
states="draft,assigned,confirmed,done"/>
|
||||
<button name="%(split_into)d" string="Put in a new pack" type="action"
|
||||
icon="terp-stock_effects-object-colorize"
|
||||
@@ -855,13 +857,13 @@
|
||||
<field groups="base.group_extended" name="tracking_id"/>
|
||||
|
||||
<label/>
|
||||
<button name="%(track_line)d" string="Split in production lots"
|
||||
groups="base.group_extended"
|
||||
<button name="%(track_line)d" string="Split in production lots"
|
||||
groups="base.group_extended"
|
||||
states="draft,waiting,confirmed,assigned"
|
||||
type="action" icon="terp-stock_effects-object-colorize"/>
|
||||
<label/>
|
||||
<button name="%(split_into)d" string="Put in a new pack" type="action"
|
||||
groups="base.group_extended"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize"
|
||||
states="draft,assigned,confirmed,done"/>
|
||||
<separator colspan="4" string="Move State"/>
|
||||
@@ -1015,13 +1017,13 @@
|
||||
groups="base.group_extended"/>
|
||||
<field name="tracking_id" groups="base.group_extended"/>
|
||||
<button name="setlast_tracking" string="Put in current pack" type="object"
|
||||
attrs="{'invisible': [('tracking_id','<>',False)]}"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize"
|
||||
attrs="{'invisible': [('tracking_id','<>',False)]}"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize"
|
||||
states="draft,assigned,confirmed,done"/>
|
||||
<button name="%(split_into)d" string="Put in a new pack" type="action"
|
||||
icon="terp-stock_effects-object-colorize"
|
||||
groups="base.group_extended"
|
||||
groups="base.group_extended"
|
||||
states="draft,assigned,confirmed,done"/>
|
||||
<field name="location_id"/>
|
||||
<field name="date_planned"/>
|
||||
@@ -1055,12 +1057,12 @@
|
||||
<label/>
|
||||
<button name="%(track_line)d" string="Split in production lots" type="action" icon="terp-stock_effects-object-colorize"
|
||||
states="draft,assigned,confirmed,done"
|
||||
groups="base.group_extended"
|
||||
groups="base.group_extended"
|
||||
/>
|
||||
<label/>
|
||||
<button name="%(split_into)d" string="Put in a new pack" type="action"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize"
|
||||
states="draft,assigned,confirmed,done"/>
|
||||
<label/>
|
||||
<separator colspan="4" string="Move State"/>
|
||||
@@ -1214,11 +1216,11 @@
|
||||
states="draft,waiting,confirmed,assigned" />
|
||||
<field name="tracking_id" groups="base.group_extended"/>
|
||||
<button name="setlast_tracking" string="Put in current pack" type="object"
|
||||
groups="base.group_extended"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('tracking_id','<>',False)]}"
|
||||
states="draft,assigned,confirmed,done"/>
|
||||
<button name="%(split_into)d" string="Put in a new pack" type="action"
|
||||
groups="base.group_extended"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize"
|
||||
states="draft,assigned,confirmed,done"/>
|
||||
<field name="state"/>
|
||||
@@ -1252,7 +1254,7 @@
|
||||
<button groups="base.group_extended" name="267" string="Split in production lots" type="action" icon="terp-stock_effects-object-colorize"/>
|
||||
<label/>
|
||||
<button name="275" string="Split Stock Moves" type="action"
|
||||
groups="base.group_extended"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('tracking_id','<>',False)]}" states="draft,assigned,confirmed,done"/>
|
||||
<separator colspan="4" string="Move State"/>
|
||||
<field name="state"/>
|
||||
@@ -1399,16 +1401,16 @@
|
||||
states="draft,waiting,confirmed,assigned" />
|
||||
<field name="prodlot_id" groups="base.group_extended"/>
|
||||
<button name="%(track_line)d" string="Split in Production Lots" type="action"
|
||||
icon="gtk-justify-fill"
|
||||
icon="gtk-justify-fill"
|
||||
states="draft,waiting,confirmed,assigned"
|
||||
groups="base.group_extended"/>
|
||||
<field groups="base.group_extended" name="tracking_id"/>
|
||||
<button name="setlast_tracking" string="Put in current pack" type="object"
|
||||
groups="base.group_extended"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize" attrs="{'invisible': [('tracking_id','<>',False)]}"
|
||||
states="draft,assigned,confirmed,done"/>
|
||||
<button name="%(split_into)d" string="Put in a new pack" type="action"
|
||||
groups="base.group_extended"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize"
|
||||
states="draft,assigned,confirmed,done"/>
|
||||
<field name="location_id"/>
|
||||
@@ -1470,12 +1472,12 @@
|
||||
<group colspan="4" col="4">
|
||||
<label/>
|
||||
<button name="%(track_line)d"
|
||||
groups="base.group_extended"
|
||||
groups="base.group_extended"
|
||||
states="draft,waiting,confirmed,assigned"
|
||||
string="Split in production lots" type="action" icon="terp-stock_effects-object-colorize" colspan="2" />
|
||||
<label/>
|
||||
<button name="%(split_into)d" string="Put in a new pack" type="action"
|
||||
groups="base.group_extended"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize"
|
||||
states="draft,assigned,confirmed,done"/>
|
||||
</group>
|
||||
@@ -1568,12 +1570,12 @@
|
||||
groups="base.group_extended"/>
|
||||
<field name="tracking_id" groups="base.group_extended"/>
|
||||
<button name="setlast_tracking" string="Put in current pack" type="object"
|
||||
attrs="{'invisible': [('tracking_id','<>',False)]}"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize"
|
||||
attrs="{'invisible': [('tracking_id','<>',False)]}"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize"
|
||||
states="draft,assigned,confirmed,done"/>
|
||||
<button name="%(split_into)d" string="Put in a new pack" type="action"
|
||||
groups="base.group_extended"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize"
|
||||
states="draft,assigned,confirmed,done"/>
|
||||
<field name="date_planned"/>
|
||||
@@ -1618,18 +1620,18 @@
|
||||
<field groups="base.group_extended" name="tracking_id"/>
|
||||
<newline/>
|
||||
<label/>
|
||||
<button name="%(track_line)d" string="Split in production lots"
|
||||
<button name="%(track_line)d" string="Split in production lots"
|
||||
states="draft,waiting,confirmed,assigned"
|
||||
groups="base.group_extended"
|
||||
groups="base.group_extended"
|
||||
type="action" icon="terp-stock_effects-object-colorize"/>
|
||||
<label/>
|
||||
<button name="%(split_into)d" string="Put in a new pack" type="action"
|
||||
groups="base.group_extended"
|
||||
groups="base.group_extended"
|
||||
icon="terp-stock_effects-object-colorize"
|
||||
states="draft,assigned,confirmed,done"/>
|
||||
<label/>
|
||||
<button name="%(track_line)d" string="Split in production lots"
|
||||
groups="base.group_extended"
|
||||
<button name="%(track_line)d" string="Split in production lots"
|
||||
groups="base.group_extended"
|
||||
type="action" icon="terp-stock_effects-object-colorize"/>
|
||||
<separator colspan="4" string="Move State"/>
|
||||
<field name="state"/>
|
||||
@@ -1970,4 +1972,4 @@
|
||||
parent="menu_warehouse_config" />
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</openerp>
|
||||
@@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!--
|
||||
<wizard string="UPS xml file" model="stock.move.lot" name="stock.ups_xml" />
|
||||
-->
|
||||
|
||||
<wizard
|
||||
id="split_inventory_lots"
|
||||
model="stock.inventory.line"
|
||||
multi="True"
|
||||
name="stock.inventory.line.split"
|
||||
string="Split inventory lines"/>
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="wkf_picking" model="workflow">
|
||||
<field name="name">stock.picking.basic</field>
|
||||
<field name="osv">stock.picking</field>
|
||||
@@ -43,7 +44,7 @@
|
||||
<field name="kind">function</field>
|
||||
<field name="action">action_cancel()</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="act_cancel" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf_picking"/>
|
||||
<field name="name">cancel</field>
|
||||
@@ -51,7 +52,7 @@
|
||||
<field name="kind">function</field>
|
||||
<field name="action">action_cancel()</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="trans_draft_confirmed" model="workflow.transition">
|
||||
<field name="act_from" ref="act_draft"/>
|
||||
<field name="act_to" ref="act_confirmed"/>
|
||||
@@ -134,5 +135,6 @@
|
||||
<field name="act_to" ref="act_cancel"/>
|
||||
<field name="condition">test_cancel()</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
Reference in New Issue
Block a user