diff --git a/addons/account/__terp__.py b/addons/account/__terp__.py
index 4a19883ac4b..1c58efb161f 100644
--- a/addons/account/__terp__.py
+++ b/addons/account/__terp__.py
@@ -42,18 +42,9 @@
'security/account_security.xml',
'security/ir.model.access.csv',
'account_menuitem.xml',
- 'wizard/account_invoice_refund_view.xml',
- 'wizard/account_period_close_view.xml',
- 'wizard/account_fiscalyear_close_state.xml',
- 'wizard/account_chart_view.xml',
- 'wizard/account_move_bank_reconcile_view.xml',
- 'wizard/account_move_line_reconcile_select_view.xml',
- 'wizard/account_move_journal_view.xml',
-
'account_wizard.xml',
'account_view.xml',
'account_end_fy.xml',
-
'account_invoice_view.xml',
'account_report.xml',
'partner_view.xml',
diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml
index a765ee0ae64..4e042a77ca8 100644
--- a/addons/account/account_invoice_view.xml
+++ b/addons/account/account_invoice_view.xml
@@ -191,18 +191,14 @@
-
+
-
-
-
-
@@ -285,16 +281,13 @@
-
+
-
-
-
-
+
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 4723f2b890f..d865823e9cd 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -81,10 +81,6 @@
-
-
@@ -671,8 +667,9 @@
-
+
+
+
-
+
+
+
@@ -1082,11 +1079,8 @@
groups="group_account_user"/>
-
-
-
+
+
-
+
-
+ type="wizard"
+ sequence="1"/>
-
+
-
+
+
-
+
-
+
+
diff --git a/addons/account/invoice.py b/addons/account/invoice.py
index 47561e57aaf..e79774e36e4 100644
--- a/addons/account/invoice.py
+++ b/addons/account/invoice.py
@@ -1136,7 +1136,8 @@ class account_invoice_line(osv.osv):
'invoice_line_tax_id': fields.many2many('account.tax', 'account_invoice_line_tax', 'invoice_line_id', 'tax_id', 'Taxes', domain=[('parent_id','=',False)]),
'note': fields.text('Notes', translate=True),
'account_analytic_id': fields.many2one('account.analytic.account', 'Analytic Account'),
- 'company_id': fields.related('invoice_id','company_id',type='many2one',relation='res.company',string='Company',store=True)
+ 'company_id': fields.related('invoice_id','company_id',type='many2one',relation='res.company',string='Company',store=True),
+ 'partner_id': fields.related('invoice_id','partner_id',type='many2one',relation='res.partner',string='Partner',store=True)
}
_defaults = {
'quantity': lambda *a: 1,
diff --git a/addons/account/project/project_view.xml b/addons/account/project/project_view.xml
index a2be8716c1e..5954c4e80b0 100644
--- a/addons/account/project/project_view.xml
+++ b/addons/account/project/project_view.xml
@@ -202,7 +202,7 @@
form
-
+
diff --git a/addons/account/project/wizard/wizard_account_analytic_line.py b/addons/account/project/wizard/wizard_account_analytic_line.py
index e6ebd336c35..4d63aff05f5 100644
--- a/addons/account/project/wizard/wizard_account_analytic_line.py
+++ b/addons/account/project/wizard/wizard_account_analytic_line.py
@@ -39,7 +39,7 @@ def _action_open_window(self, cr, uid, data, context):
id = mod_obj.read(cr, uid, result, ['res_id'])
return {
- 'name': _('Analytic Entries'),
+ 'name': _('Analytic Entries by line'),
'view_type': 'form',
"view_mode": 'tree,form',
'res_model': 'account.analytic.line',
@@ -71,11 +71,11 @@ class account_analytic_line(wizard.interface):
}
states = {
- 'init': {
+ 'init': {
'actions': [],
'result': {'type': 'form', 'arch':form1, 'fields':form1_fields, 'state': [('end', 'Cancel','gtk-cancel'),('open', 'Open Entries','gtk-ok')]}
},
- 'open': {
+ 'open': {
'actions': [],
'result': {'type': 'action', 'action': _action_open_window, 'state':'end'}
}
diff --git a/addons/account/wizard/__init__.py b/addons/account/wizard/__init__.py
index 96ac24e02cd..7d6e7b1226d 100644
--- a/addons/account/wizard/__init__.py
+++ b/addons/account/wizard/__init__.py
@@ -19,14 +19,17 @@
#
##############################################################################
-# OLD Wizards
import wizard_automatic_reconcile
+import wizard_reconcile_select
import wizard_unreconcile_select
import wizard_reconcile
import wizard_unreconcile
+import wizard_refund
import wizard_pay_invoice
+import wizard_journal
import wizard_journal_select
+import wizard_bank_reconcile
import wizard_subscription_generate
import wizard_aged_trial_balance
@@ -35,8 +38,9 @@ import wizard_third_party_ledger
import wizard_account_balance_report
import wizard_partner_balance_report
+import wizard_period_close
import wizard_fiscalyear_close
-#import wizard_fiscalyear_close_state
+import wizard_fiscalyear_close_state
import wizard_open_closed_fiscalyear
import wizard_vat
@@ -44,6 +48,7 @@ import wizard_compare_account_balance_report
import wizard_invoice_state
import wizard_account_duplicate
+import wizard_account_chart
import wizard_move_line_select
import wizard_validate_account_move
@@ -57,12 +62,7 @@ import wizard_central_journal
import wizard_general_journal
import wizard_change_currency
-import account_invoice_refund
-import account_period_close
-import account_fiscalyear_close_state
-import account_chart
-import account_move_bank_reconcile
-import account_move_line_reconcile_select
-import account_move_journal
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/account/wizard/account_chart.py b/addons/account/wizard/account_chart.py
deleted file mode 100644
index fddb6bc0474..00000000000
--- a/addons/account/wizard/account_chart.py
+++ /dev/null
@@ -1,87 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-from osv import fields, osv
-from tools.translate import _
-import netsvc
-import pooler
-import time
-import tools
-import wizard
-
-class account_chart(osv.osv_memory):
- """
- For Chart of Accounrs
- """
-
- def _get_defaults(self, cr, uid, context):
-
- """Return default Fiscalyear value"""
-
- fiscalyear_obj = self.pool.get('account.fiscalyear')
- fiscalyear = fiscalyear_obj.find(cr, uid)
- return fiscalyear
-
- def _account_chart_open_window(self, cr, uid, ids, context):
- """
- Opens chart of Accounts
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: List of account chart’s IDs
- @return: dictionary of Open account chart window on given fiscalyear and all Entries or posted entries
- """
-
- for data in self.read(cr, uid, ids):
- mod_obj = self.pool.get('ir.model.data')
- act_obj = self.pool.get('ir.actions.act_window')
-
- result = mod_obj._get_id(cr, uid, 'account', 'action_account_tree')
- id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
- result = act_obj.read(cr, uid, [id], context=context)[0]
- result['context'] = str({'fiscalyear': data['fiscalyear'], \
- 'state': data['target_move']})
- if data['fiscalyear']:
- result['name'] += ':' + self.pool.get('account.fiscalyear').read(cr, uid, [data['fiscalyear']])[0]['code']
-
- return result
-
-
- _name = "account.chart"
- _description = "chart"
- _columns = {
- 'fiscalyear': fields.many2one('account.fiscalyear', \
- 'Fiscal year', required=True, \
- help = 'Keep empty for all open fiscal years'),
- 'target_move': fields.selection([
- ('all', 'All Entries'),
- ('posted', 'All Posted Entries'),
- ], 'Target Moves', required = True),
-
- }
- _defaults = {
- 'fiscalyear': _get_defaults,
- 'target_move': lambda * a: 'all'
- }
-
-account_chart()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/account/wizard/account_chart_view.xml b/addons/account/wizard/account_chart_view.xml
deleted file mode 100644
index ae89dfb9945..00000000000
--- a/addons/account/wizard/account_chart_view.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
- account.chart.form
- account.chart
- form
-
-
-
-
-
-
- Chart of Accounts
- account.chart
- form
- tree,form
-
- new
-
-
-
-
-
diff --git a/addons/account/wizard/account_fiscalyear_close_state.py b/addons/account/wizard/account_fiscalyear_close_state.py
deleted file mode 100644
index 8468bcf2635..00000000000
--- a/addons/account/wizard/account_fiscalyear_close_state.py
+++ /dev/null
@@ -1,70 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-from osv import fields, osv
-from tools.translate import _
-import netsvc
-import pooler
-import time
-import tools
-import wizard
-
-class account_fiscalyear_close_state(osv.osv_memory):
- """
- Closes Account Fiscalyear
- """
- _name = "account.fiscalyear.close.state"
- _description = "Fiscalyear Close state"
- _columns = {
- 'fy_id': fields.many2one('account.fiscalyear', \
- 'Fiscal Year to close', required=True),
- 'sure': fields.boolean('Check this box', required=False)
- }
-
- def _data_save(self, cr, uid, ids, context):
- """
- This function close account fiscalyear
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: List of Account fiscalyear close state’s IDs
-
- """
- for data in self.read(cr, uid, ids):
- if not data['sure']:
- raise osv.except_osv(_('UserError'), _('Closing of states \
-cancelled, please check the box !'))
- fy_id = data['fy_id']
-
- cr.execute('UPDATE account_journal_period ' \
- 'SET state = %s ' \
- 'WHERE period_id IN (SELECT id FROM account_period \
- WHERE fiscalyear_id = %s)',
- ('done', fy_id))
- cr.execute('UPDATE account_period SET state = %s ' \
- 'WHERE fiscalyear_id = %s', ('done', fy_id))
- cr.execute('UPDATE account_fiscalyear ' \
- 'SET state = %s WHERE id = %s', ('done', fy_id))
- return {}
-
-account_fiscalyear_close_state()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/account/wizard/account_fiscalyear_close_state.xml b/addons/account/wizard/account_fiscalyear_close_state.xml
deleted file mode 100644
index d6fe49c9b2c..00000000000
--- a/addons/account/wizard/account_fiscalyear_close_state.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
- account.fiscalyear.close.state.form
- account.fiscalyear.close.state
- form
-
-
-
-
-
-
- Close a Fiscal Year
- account.fiscalyear.close.state
- form
- tree,form
-
- new
-
-
-
-
-
-
diff --git a/addons/account/wizard/account_invoice_refund.py b/addons/account/wizard/account_invoice_refund.py
deleted file mode 100644
index 162d21a9654..00000000000
--- a/addons/account/wizard/account_invoice_refund.py
+++ /dev/null
@@ -1,214 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-from osv import fields, osv
-from tools.translate import _
-import netsvc
-import pooler
-import time
-import tools
-import wizard
-
-class account_invoice_refund(osv.osv_memory):
-
- """Refunds invoice."""
-
- _name = "account.invoice.refund"
- _description = "Invoice Refund"
- _columns = {
- 'date': fields.date('Operation date', required=False),
- 'period': fields.many2one('account.period', 'Force period', required=False),
- 'description': fields.char('Description', size=150, required=True),
- }
-
- def _compute_refund(self, cr, uid, ids, mode, context):
- """
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: the account invoice refund’s ID or list of IDs
-
- """
-
- inv_obj = self.pool.get('account.invoice')
- for form in self.read(cr, uid, ids):
- reconcile_obj = self.pool.get('account.move.reconcile')
- account_m_line_obj = self.pool.get('account.move.line')
- created_inv = []
- date = False
- period = False
- description = False
- for inv in inv_obj.browse(cr, uid, context['active_ids']):
- if inv.state in ['draft', 'proforma2', 'cancel']:
- raise osv.except_osv(_('Error !'), _('Can not %s draft/proforma/cancel invoice.') % (mode))
- if form['period'] :
- period = form['period']
- else:
- period = inv.period_id and inv.period_id.id or False
-
- if form['date'] :
- date = form['date']
- if not form['period'] :
- cr.execute("select name from ir_model_fields \
- where model = 'account.period' \
- and name = 'company_id'")
- result_query = cr.fetchone()
- if result_query:
- #in multi company mode
- cr.execute("""SELECT id
- from account_period where date('%s')
- between date_start AND date_stop \
- and company_id = %s limit 1 """,
- (form['date'], self.pool.get('res.users').browse(cr, uid, uid).company_id.id,))
- else:
- #in mono company mode
- cr.execute("""SELECT id
- from account_period where date('%s')
- between date_start AND date_stop \
- limit 1 """, (form['date'],))
- res = cr.fetchone()
- if res:
- period = res[0]
- else:
- date = inv.date_invoice
-
- if form['description'] :
- description = form['description']
- else:
- description = inv.name
-
- if not period:
- raise osv.except_osv(_('Data Insufficient !'), \
- _('No Period found on Invoice!'))
-
- refund_id = inv_obj.refund(cr, uid, [inv.id], date, period, description)
- refund = inv_obj.browse(cr, uid, refund_id[0])
- # we compute due date
- #!!!due date = date inv date on formdate
- inv_obj.write(cr, uid, [refund.id], {'date_due': date,
- 'check_total': inv.check_total})
- # to make the taxes calculated
- inv_obj.button_compute(cr, uid, refund_id)
-
- created_inv.append(refund_id[0])
- #if inv is paid we unreconcile
- if mode in ('cancel', 'modify'):
- movelines = inv.move_id.line_id
- #we unreconcile the lines
- to_reconcile_ids = {}
- for line in movelines :
- #if the account of the line is the as the one in the invoice
- #we reconcile
- if line.account_id.id == inv.account_id.id :
- to_reconcile_ids[line.account_id.id] = [line.id]
- if type(line.reconcile_id) != osv.orm.browse_null :
- reconcile_obj.unlink(cr, uid, line.reconcile_id.id)
- #we advance the workflow of the refund to open
- wf_service = netsvc.LocalService('workflow')
- wf_service.trg_validate(uid, 'account.invoice', \
- refund.id, 'invoice_open', cr)
- #we reload the browse record
- refund = inv_obj.browse(cr, uid, refund_id[0])
- #we match the line to reconcile
- for tmpline in refund.move_id.line_id :
- if tmpline.account_id.id == inv.account_id.id :
- to_reconcile_ids[tmpline.account_id.id].append(tmpline.id)
- for account in to_reconcile_ids :
- account_m_line_obj.reconcile(cr, uid, to_reconcile_ids[account],
- writeoff_period_id=period,
- writeoff_journal_id=inv.journal_id.id,
- writeoff_acc_id=inv.account_id.id
- )
- #we create a new invoice that is the copy of the original
- if mode == 'modify' :
- invoice = inv_obj.read(cr, uid, [inv.id],
- ['name', 'type', 'number', 'reference',
- 'comment', 'date_due', 'partner_id',
- 'address_contact_id', 'address_invoice_id',
- 'partner_insite', 'partner_contact',
- 'partner_ref', 'payment_term', 'account_id',
- 'currency_id', 'invoice_line', 'tax_line',
- 'journal_id', 'period_id'])
- invoice = invoice[0]
- del invoice['id']
- invoice_lines = self.pool.get('account.invoice.line').read(cr, uid, invoice['invoice_line'])
- invoice_lines = inv_obj._refund_cleanup_lines(cr, uid, invoice_lines)
- tax_lines = self.pool.get('account.invoice.tax').read(
- cr, uid, invoice['tax_line'])
- tax_lines = inv_obj._refund_cleanup_lines(cr, uid, tax_lines)
-
- invoice.update({
- 'type': inv.type,
- 'date_invoice': date,
- 'state': 'draft',
- 'number': False,
- 'invoice_line': invoice_lines,
- 'tax_line': tax_lines,
- 'period_id': period,
- 'name': description
- })
-
- #take the id part of the tuple returned for many2one fields
- for field in ('address_contact_id', 'address_invoice_id', 'partner_id',
- 'account_id', 'currency_id', 'payment_term', 'journal_id'):
- invoice[field] = invoice[field] and invoice[field][0]
-
- # create the new invoice
- inv_id = inv_obj.create(cr, uid, invoice, {})
- # we compute due date
- if inv.payment_term.id:
- data = inv_obj.onchange_payment_term_date_invoice(cr, uid, [inv_id], inv.payment_term.id, date)
- if 'value' in data and data['value']:
- inv_obj.write(cr, uid, [inv_id], data['value'])
- created_inv.append(inv_id)
-
- #we get the view id
- mod_obj = self.pool.get('ir.model.data')
- act_obj = self.pool.get('ir.actions.act_window')
- if inv.type == 'out_invoice':
- xml_id = 'action_invoice_tree1'
- elif inv.type == 'in_invoice':
- xml_id = 'action_invoice_tree2'
- elif type == 'out_refund':
- xml_id = 'action_invoice_tree3'
- else:
- xml_id = 'action_invoice_tree4'
- #we get the model
- result = mod_obj._get_id(cr, uid, 'account', xml_id)
- id = mod_obj.read(cr, uid, result, ['res_id'])['res_id']
- # we read the act window
- result = act_obj.read(cr, uid, id)
- result['res_id'] = created_inv
-
- return result
-
- def _invoice_refund(self, cr, uid, ids, context):
- return self._compute_refund(cr, uid, ids, 'refund', context)
-
- def _invoice_cancel(self, cr, uid, ids, context):
- return self._compute_refund(cr, uid, ids, 'cancel', context)
-
- def _invoice_modify(self, cr, uid, ids, context):
- return self._compute_refund(cr, uid, ids, 'modify', context)
-
-account_invoice_refund()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/account/wizard/account_invoice_refund_view.xml b/addons/account/wizard/account_invoice_refund_view.xml
deleted file mode 100644
index 0d2bb036c06..00000000000
--- a/addons/account/wizard/account_invoice_refund_view.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
- account.invoice.refund.form
- account.invoice.refund
- form
-
-
-
-
-
-
- Credit Note
- account.invoice.refund
- form
- tree,form
-
- new
-
-
-
-
\ No newline at end of file
diff --git a/addons/account/wizard/account_move_bank_reconcile.py b/addons/account/wizard/account_move_bank_reconcile.py
deleted file mode 100644
index a39f500eac8..00000000000
--- a/addons/account/wizard/account_move_bank_reconcile.py
+++ /dev/null
@@ -1,67 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-from osv import fields, osv
-from tools.translate import _
-import netsvc
-import pooler
-import time
-import tools
-import wizard
-
-class account_move_bank_reconcile(osv.osv_memory):
- """
- Bank Reconciliation
- """
- _name = "account.move.bank.reconcile"
- _description = "Move bank reconcile"
- _columns = {
- 'journal_id': fields.many2one('account.journal', 'Journal', required=True),
- }
-
- def _action_open_window(self, cr, uid, ids, context):
- """
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: account move bank reconcile’s ID or list of IDs
- @return: dictionary of Open account move line on given journal_id.
- """
- for data in self.read(cr, uid, ids):
- cr.execute('select default_credit_account_id \
- from account_journal where id=%s', (data['journal_id'],))
- account_id = cr.fetchone()[0]
- if not account_id:
- raise osv.except_osv(_('Error'), _('You have to define \
-the bank account\nin the journal definition for reconciliation.'))
- return {
- 'domain': "[('journal_id','=',%d), ('account_id','=',%d), ('state','<>','draft')]" % (data['journal_id'], account_id),
- 'name': _('Standard Encoding'),
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'account.move.line',
- 'view_id': False,
- 'context': "{'journal_id': %d}" % (data['journal_id'],),
- 'type': 'ir.actions.act_window'
- }
-
-account_move_bank_reconcile()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/wizard/account_move_bank_reconcile_view.xml b/addons/account/wizard/account_move_bank_reconcile_view.xml
deleted file mode 100644
index 5a542a7e270..00000000000
--- a/addons/account/wizard/account_move_bank_reconcile_view.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
- account.move.bank.reconcile.form
- account.move.bank.reconcile
- form
-
-
-
-
-
-
- Bank reconciliation
- account.move.bank.reconcile
- form
- tree,form
-
- new
-
-
-
-
diff --git a/addons/account/wizard/account_move_journal.py b/addons/account/wizard/account_move_journal.py
deleted file mode 100644
index 08aef8ca544..00000000000
--- a/addons/account/wizard/account_move_journal.py
+++ /dev/null
@@ -1,102 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-from osv import fields, osv
-from tools.translate import _
-import netsvc
-import pooler
-import time
-import tools
-import wizard
-
-
-class account_move_journal(osv.osv_memory):
-
- def _get_period(self, cr, uid, context={}):
- """Return default account period value"""
-
- ids = self.pool.get('account.period').find(cr, uid, context=context)
- period_id = False
- if len(ids):
- period_id = ids[0]
- return period_id
-
- def _action_open_window(self, cr, uid, ids, context={}):
- """
- This function Open action move line window on given period and Journal/Payment Mode
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: account move journal’s ID or list of IDs
- @return: dictionary of Open action move line window on given period and Journal/Payment Mode
-
- """
- for data in self.read(cr, uid, ids, ['journal_id', 'period_id']):
- cr.execute('select id,name from ir_ui_view where model=%s and type=%s', ('account.move.line', 'form'))
- view_res = cr.fetchone()
- journal_id = data['journal_id']
- period_id = data['period_id']
- jp = self.pool.get('account.journal.period')
- ids = jp.search(cr, uid, [('journal_id', '=', journal_id), \
- ('period_id', '=', period_id)])
-
- if not len(ids):
- name = self.pool.get('account.journal').read(cr, uid, [journal_id])[0]['name']
- state = self.pool.get('account.period').read(cr, uid, [period_id])[0]['state']
- if state == 'done':
- raise osv.except_osv(_('UserError'), _('This period is already closed !'))
- company = self.pool.get('account.period').read(cr, uid, [period_id])[0]['company_id'][0]
- jp.create(cr, uid, {'name': name, 'period_id': period_id, 'journal_id': journal_id, 'company_id': company})
-
- ids = jp.search(cr, uid, [('journal_id', '=', journal_id), ('period_id', '=', period_id)])
- jp = jp.browse(cr, uid, ids, context=context)[0]
- name = (jp.journal_id.code or '') + ':' + (jp.period_id.code or '')
- mod_obj = self.pool.get('ir.model.data')
- result = mod_obj._get_id(cr, uid, 'account', 'view_account_move_line_filter')
- res = mod_obj.read(cr, uid, result, ['res_id'])
-
- return {
- 'domain': "[('journal_id','=',%d), ('period_id','=',%d)]" % (journal_id, period_id),
- 'name': name,
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'account.move.line',
- 'view_id': view_res,
- 'context': "{'journal_id': %d, 'period_id': %d}" % (journal_id, period_id),
- 'type': 'ir.actions.act_window',
- 'search_view_id': res['res_id']
- }
-
- _name = "account.move.journal"
- _description = "Move journal"
-
- _columns = {
- 'journal_id': fields.many2one('account.journal', 'Journal/Payment Mode', required=True),
- 'period_id': fields.many2one('account.period', 'Period', required=True),
- }
-
- _defaults = {
- 'period_id': _get_period
- }
-
-account_move_journal()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/account/wizard/account_move_journal_view.xml b/addons/account/wizard/account_move_journal_view.xml
deleted file mode 100644
index e32148c9c69..00000000000
--- a/addons/account/wizard/account_move_journal_view.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
-
-
- account.move.journal.form
- account.move.journal
- form
-
-
-
-
-
-
- Making Entries by Line
- account.move.journal
- form
- tree,form
-
- new
-
-
-
-
-
-
diff --git a/addons/account/wizard/account_move_line_reconcile_select.py b/addons/account/wizard/account_move_line_reconcile_select.py
deleted file mode 100644
index f1a72e44b91..00000000000
--- a/addons/account/wizard/account_move_line_reconcile_select.py
+++ /dev/null
@@ -1,61 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-from osv import fields, osv
-from tools.translate import _
-import netsvc
-import pooler
-import time
-import tools
-import wizard
-
-class account_move_line_reconcile_select(osv.osv_memory):
- _name = "account.move.line.reconcile.select"
- _description = "Move line reconcile select"
- _columns = {
- 'account_id': fields.many2one('account.account', 'Account', \
- domain = [('reconcile', '=', 1)], required=True),
- }
-
- def _action_open_window(self, cr, uid, ids, context):
- """
- This function Open account move line window for reconcile on given account id
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: account move line reconcile select’s ID or list of IDs
- @return: dictionary of Open account move line window for reconcile on given account id
-
- """
- for data in self.read(cr, uid, ids):
-
- return {
- 'domain': "[('account_id','=',%d),('reconcile_id','=',False),('state','<>','draft')]" % data['account_id'],
- 'name': _('Reconciliation'),
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'view_id': False,
- 'res_model': 'account.move.line',
- 'type': 'ir.actions.act_window'
- }
-
-account_move_line_reconcile_select()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/wizard/account_move_line_reconcile_select_view.xml b/addons/account/wizard/account_move_line_reconcile_select_view.xml
deleted file mode 100644
index 2bb05b2e9ab..00000000000
--- a/addons/account/wizard/account_move_line_reconcile_select_view.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
- account.move.line.reconcile.select.form
- account.move.line.reconcile.select
- form
-
-
-
-
-
- Reconcile entries
- account.move.line.reconcile.select
- form
- tree,form
-
- new
-
-
-
-
-
-
-
-
diff --git a/addons/account/wizard/account_period_close.py b/addons/account/wizard/account_period_close.py
deleted file mode 100644
index 8ef38faf3cc..00000000000
--- a/addons/account/wizard/account_period_close.py
+++ /dev/null
@@ -1,61 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-from osv import fields, osv
-from tools.translate import _
-import netsvc
-import pooler
-import time
-import tools
-import wizard
-
-class account_period_close(osv.osv_memory):
- """
- close period
- """
- _name = "account.period.close"
- _description = "period close"
- _columns = {
- 'sure': fields.boolean('Check this box', required=False),
- }
-
- def _data_save(self, cr, uid, ids, context):
- """
- This function close period
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: account period close’s ID or list of IDs
- """
-
- mode = 'done'
- for form in self.read(cr, uid, ids):
- if form['sure']:
- for id in context['active_ids']:
- cr.execute('update account_journal_period set state=%s \
- where period_id=%s', (mode, id))
- cr.execute('update account_period set state=%s \
- where id=%s', (mode, id))
- return {}
-
-account_period_close()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/account/wizard/account_period_close_view.xml b/addons/account/wizard/account_period_close_view.xml
deleted file mode 100644
index fc8c5273a79..00000000000
--- a/addons/account/wizard/account_period_close_view.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
- account.period.close.form
- account.period.close
- form
-
-
-
-
-
-
- Close a Period
- account.period.close
- form
- tree,form
-
- new
-
-
-
-
\ No newline at end of file
diff --git a/addons/account/wizard/wizard_account_chart.py b/addons/account/wizard/wizard_account_chart.py
new file mode 100644
index 00000000000..ca8153f3ce7
--- /dev/null
+++ b/addons/account/wizard/wizard_account_chart.py
@@ -0,0 +1,80 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+
+import wizard
+import pooler
+
+class wizard_account_chart(wizard.interface):
+ _account_chart_arch = '''
+ '''
+
+ _account_chart_fields = {
+ 'fiscalyear': {
+ 'string': 'Fiscal year',
+ 'type': 'many2one',
+ 'relation': 'account.fiscalyear',
+ 'help': 'Keep empty for all open fiscal years',
+ },
+ 'target_move': {
+ 'string': 'Target Moves',
+ 'type': 'selection',
+ 'selection': [('all','All Entries'),('posted','All Posted Entries')],
+ 'required': True,
+ 'default': lambda *a:"all",
+ },
+ }
+
+ def _get_defaults(self, cr, uid, data, context):
+ fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
+ data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
+ return data['form']
+
+
+ def _account_chart_open_window(self, cr, uid, data, context):
+ mod_obj = pooler.get_pool(cr.dbname).get('ir.model.data')
+ act_obj = pooler.get_pool(cr.dbname).get('ir.actions.act_window')
+
+ result = mod_obj._get_id(cr, uid, 'account', 'action_account_tree')
+ id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
+ result = act_obj.read(cr, uid, [id], context=context)[0]
+ result['context'] = str({'fiscalyear': data['form']['fiscalyear'],'state':data['form']['target_move']})
+ if data['form']['fiscalyear']:
+ result['name']+=':'+pooler.get_pool(cr.dbname).get('account.fiscalyear').read(cr,uid,[data['form']['fiscalyear']])[0]['code']
+ return result
+
+ states = {
+ 'init': {
+ 'actions': [_get_defaults],
+ 'result': {'type': 'form', 'arch':_account_chart_arch, 'fields':_account_chart_fields, 'state': [('end', 'Cancel'), ('open', 'Open Charts')]}
+ },
+ 'open': {
+ 'actions': [],
+ 'result': {'type': 'action', 'action':_account_chart_open_window, 'state':'end'}
+ }
+ }
+wizard_account_chart('account.chart')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/account/wizard/wizard_bank_reconcile.py b/addons/account/wizard/wizard_bank_reconcile.py
new file mode 100644
index 00000000000..c081657304a
--- /dev/null
+++ b/addons/account/wizard/wizard_bank_reconcile.py
@@ -0,0 +1,67 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+
+import wizard
+from tools.translate import _
+
+_journal_form = '''
+''' % ('Bank reconciliation',)
+
+_journal_fields = {
+ 'journal_id': {'string':'Journal', 'type':'many2one', 'relation':'account.journal', 'required':True},
+}
+
+def _action_open_window(self, cr, uid, data, context):
+ form = data['form']
+ cr.execute('select default_credit_account_id from account_journal where id=%s', (form['journal_id'],))
+ account_id = cr.fetchone()[0]
+ if not account_id:
+ raise wizard.except_wizard(_('Error'), _('You have to define the bank account\nin the journal definition for reconciliation.'))
+ return {
+ 'domain': "[('journal_id','=',%d), ('account_id','=',%d), ('state','<>','draft')]" % (form['journal_id'],account_id),
+ 'name': _('Standard Encoding'),
+
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'account.move.line',
+ 'view_id': False,
+ 'context': "{'journal_id':%d}" % (form['journal_id'],),
+ 'type': 'ir.actions.act_window'
+ }
+
+class wiz_journal(wizard.interface):
+ states = {
+ 'init': {
+ 'actions': [],
+ 'result': {'type': 'form', 'arch':_journal_form, 'fields':_journal_fields, 'state':[('end','Cancel'),('open','Open for bank reconciliation')]}
+ },
+ 'open': {
+ 'actions': [],
+ 'result': {'type': 'action', 'action': _action_open_window, 'state':'end'}
+ }
+ }
+wiz_journal('account.move.bank.reconcile')
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/account/wizard/wizard_fiscalyear_close_state.py b/addons/account/wizard/wizard_fiscalyear_close_state.py
new file mode 100644
index 00000000000..2f8331f2d3e
--- /dev/null
+++ b/addons/account/wizard/wizard_fiscalyear_close_state.py
@@ -0,0 +1,71 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+
+import wizard
+import osv
+import pooler
+from tools.translate import _
+
+_transaction_form = '''
+'''
+
+_transaction_fields = {
+ 'fy_id': {'string':'Fiscal Year to close', 'type':'many2one', 'relation': 'account.fiscalyear','required':True, 'domain':[('state','=','draft')]},
+ 'sure': {'string':'Check this box', 'type':'boolean'},
+}
+
+def _data_save(self, cr, uid, data, context):
+ if not data['form']['sure']:
+ raise wizard.except_wizard(_('UserError'), _('Closing of states cancelled, please check the box !'))
+ pool = pooler.get_pool(cr.dbname)
+
+ fy_id = data['form']['fy_id']
+
+ cr.execute('UPDATE account_journal_period ' \
+ 'SET state = %s ' \
+ 'WHERE period_id IN (SELECT id FROM account_period WHERE fiscalyear_id = %s)',
+ ('done',fy_id))
+ cr.execute('UPDATE account_period SET state = %s ' \
+ 'WHERE fiscalyear_id = %s', ('done',fy_id))
+ cr.execute('UPDATE account_fiscalyear ' \
+ 'SET state = %s WHERE id = %s', ('done', fy_id))
+ return {}
+
+class wiz_journal_close_state(wizard.interface):
+ states = {
+ 'init': {
+ 'actions': [],
+ 'result': {'type': 'form', 'arch':_transaction_form, 'fields':_transaction_fields, 'state':[('end','Cancel'),('close','Close states')]}
+ },
+ 'close': {
+ 'actions': [_data_save],
+ 'result': {'type': 'state', 'state':'end'}
+ }
+ }
+wiz_journal_close_state('account.fiscalyear.close.state')
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/account/wizard/wizard_journal.py b/addons/account/wizard/wizard_journal.py
new file mode 100644
index 00000000000..fd2b012863e
--- /dev/null
+++ b/addons/account/wizard/wizard_journal.py
@@ -0,0 +1,99 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+
+import wizard
+from osv import osv
+import pooler
+from tools.translate import _
+
+_journal_form = '''
+'''
+
+def _period_get(self, cr, uid, datas, ctx={}):
+ try:
+ pool = pooler.get_pool(cr.dbname)
+ ids = pool.get('account.period').find(cr, uid, context=ctx)
+ return {'period_id': ids[0]}
+ except:
+ return {}
+
+_journal_fields = {
+ 'journal_id': {'string':'Journal', 'type':'many2one', 'relation':'account.journal', 'required':True},
+ 'period_id': {
+ 'string':'Period',
+ 'type':'many2one',
+ 'relation':'account.period',
+ 'required':True,
+ }
+}
+
+def _action_open_window(self, cr, uid, data, context):
+ form = data['form']
+ cr.execute('select id,name from ir_ui_view where model=%s and type=%s', ('account.move.line', 'form'))
+ view_res = cr.fetchone()
+ jp = pooler.get_pool(cr.dbname).get('account.journal.period')
+ ids = jp.search(cr, uid, [('journal_id','=',form['journal_id']), ('period_id','=',form['period_id'])])
+ if not len(ids):
+ name = pooler.get_pool(cr.dbname).get('account.journal').read(cr, uid, [form['journal_id']])[0]['name']
+ state = pooler.get_pool(cr.dbname).get('account.period').read(cr, uid, [form['period_id']])[0]['state']
+ if state == 'done':
+ raise wizard.except_wizard(_('UserError'), _('This period is already closed !'))
+ company = pooler.get_pool(cr.dbname).get('account.period').read(cr, uid, [form['period_id']])[0]['company_id'][0]
+ jp.create(cr, uid, {'name':name, 'period_id': form['period_id'], 'journal_id':form['journal_id'], 'company_id':company})
+ ids = jp.search(cr, uid, [('journal_id','=',form['journal_id']), ('period_id','=',form['period_id'])])
+ jp = jp.browse(cr, uid, ids, context=context)[0]
+ name = (jp.journal_id.code or '') + ':' + (jp.period_id.code or '')
+
+ mod_obj = pooler.get_pool(cr.dbname).get('ir.model.data')
+ result = mod_obj._get_id(cr, uid, 'account', 'view_account_move_line_filter')
+ id = mod_obj.read(cr, uid, result, ['res_id'])
+ return {
+ 'domain': "[('journal_id','=',%d), ('period_id','=',%d)]" % (form['journal_id'],form['period_id']),
+ 'name': name,
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'account.move.line',
+ 'view_id': view_res,
+ 'context': "{'journal_id':%d, 'period_id':%d}" % (form['journal_id'],form['period_id']),
+ 'type': 'ir.actions.act_window',
+ 'search_view_id': id['res_id']
+ }
+
+class wiz_journal(wizard.interface):
+ states = {
+ 'init': {
+ 'actions': [_period_get],
+ 'result': {'type': 'form', 'arch':_journal_form, 'fields':_journal_fields, 'state':[('end','Cancel'),('open','Open Journal')]}
+ },
+ 'open': {
+ 'actions': [],
+ 'result': {'type': 'action', 'action': _action_open_window, 'state':'end'}
+ }
+ }
+wiz_journal('account.move.journal')
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/account/wizard/wizard_period_close.py b/addons/account/wizard/wizard_period_close.py
new file mode 100644
index 00000000000..d6ba73683f2
--- /dev/null
+++ b/addons/account/wizard/wizard_period_close.py
@@ -0,0 +1,57 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+
+import wizard
+
+_transaction_form = '''
+'''
+
+_transaction_fields = {
+ 'sure': {'string':'Check this box', 'type':'boolean'},
+}
+
+def _data_save(self, cr, uid, data, context):
+ mode = 'done'
+ if data['form']['sure']:
+ for id in data['ids']:
+ cr.execute('update account_journal_period set state=%s where period_id=%s', (mode, id))
+ cr.execute('update account_period set state=%s where id=%s', (mode, id))
+ return {}
+
+class wiz_journal_close(wizard.interface):
+ states = {
+ 'init': {
+ 'actions': [],
+ 'result': {'type': 'form', 'arch':_transaction_form, 'fields':_transaction_fields, 'state':[('end','Cancel'),('close','Close Period')]}
+ },
+ 'close': {
+ 'actions': [_data_save],
+ 'result': {'type': 'state', 'state':'end'}
+ }
+ }
+wiz_journal_close('account.period.close')
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/account/wizard/wizard_reconcile.py b/addons/account/wizard/wizard_reconcile.py
index 6d7de403f79..9debe7afbef 100644
--- a/addons/account/wizard/wizard_reconcile.py
+++ b/addons/account/wizard/wizard_reconcile.py
@@ -19,13 +19,13 @@
#
##############################################################################
-from datetime import datetime
-from tools.translate import _
+import wizard
import netsvc
+import time
import osv
import pooler
-import time
-import wizard
+from datetime import datetime
+from tools.translate import _
_transaction_form = '''
'''
_transaction_fields = {
- 'trans_nbr': {'string':'# of Transaction', 'type':'integer', 'readonly':True},
- 'credit': {'string':'Credit amount', 'type':'float', 'readonly':True},
- 'debit': {'string':'Debit amount', 'type':'float', 'readonly':True},
- 'writeoff': {'string':'Write-Off amount', 'type':'float', 'readonly':True},
+ 'trans_nbr': {'string':'# of Transaction', 'type':'integer', 'readonly':True},
+ 'credit': {'string':'Credit amount', 'type':'float', 'readonly':True},
+ 'debit': {'string':'Debit amount', 'type':'float', 'readonly':True},
+ 'writeoff': {'string':'Write-Off amount', 'type':'float', 'readonly':True},
}
def _trans_rec_get(self, cr, uid, data, context=None):
@@ -83,12 +83,12 @@ def _trans_rec_reconcile(self, cr, uid, data, context=None):
journal_id = form.get('journal_id', False)
context['comment'] = form.get('comment', False)
context['analytic_id'] = form.get('analytic_id', False)
- account_move_line_obj.reconcile(cr, uid, data['ids'], 'manual', account_id,
+ account_move_line_obj.reconcile(cr, uid, data['ids'], 'manual', account_id,
period_id, journal_id, context=context)
return {}
def _partial_check(self, cr, uid, data, context):
- if _trans_rec_get(self, cr, uid, data, context)['writeoff'] == 0:
+ if _trans_rec_get(self,cr,uid, data, context)['writeoff'] == 0:
return 'init_full'
return 'init_partial'
@@ -104,11 +104,11 @@ _transaction_add_form = '''
'''
_transaction_add_fields = {
- 'journal_id': {'string': 'Write-Off Journal', 'type': 'many2one', 'relation':'account.journal', 'required':True},
- 'writeoff_acc_id': {'string':'Write-Off account', 'type':'many2one', 'relation':'account.account', 'required':True},
- 'date_p': {'string':'Date', 'type':'date'},
- 'comment': {'string':'Comment', 'type':'char', 'size': 64, 'required':True},
- 'analytic_id': {'string':'Analytic Account', 'type': 'many2one', 'relation':'account.analytic.account'},
+ 'journal_id': {'string': 'Write-Off Journal', 'type': 'many2one', 'relation':'account.journal', 'required':True},
+ 'writeoff_acc_id': {'string':'Write-Off account', 'type':'many2one', 'relation':'account.account', 'required':True},
+ 'date_p': {'string':'Date','type':'date'},
+ 'comment': {'string':'Comment','type':'char', 'size': 64, 'required':True},
+ 'analytic_id': {'string':'Analytic Account', 'type': 'many2one', 'relation':'account.analytic.account'},
}
def _trans_rec_addendum(self, cr, uid, data, context={}):
@@ -119,27 +119,27 @@ def _trans_rec_addendum(self, cr, uid, data, context={}):
class wiz_reconcile(wizard.interface):
states = {
'init': {
- 'actions': [],
+ 'actions': [],
'result': {'type': 'choice', 'next_state': _partial_check}
- },
+ },
'init_full': {
- 'actions': [_trans_rec_get],
- 'result': {'type': 'form', 'arch':_transaction_form, 'fields':_transaction_fields, 'state':[('end', 'Cancel'), ('reconcile', 'Reconcile')]}
- },
+ 'actions': [_trans_rec_get],
+ 'result': {'type': 'form', 'arch':_transaction_form, 'fields':_transaction_fields, 'state':[('end','Cancel'),('reconcile','Reconcile')]}
+ },
'init_partial': {
- 'actions': [_trans_rec_get],
- 'result': {'type': 'form', 'arch':_transaction_form, 'fields':_transaction_fields, 'state':[('end', 'Cancel'), ('addendum', 'Reconcile With Write-Off'), ('partial', 'Partial Reconcile')]}
- },
+ 'actions': [_trans_rec_get],
+ 'result': {'type': 'form', 'arch':_transaction_form, 'fields':_transaction_fields, 'state':[('end','Cancel'),('addendum','Reconcile With Write-Off'),('partial','Partial Reconcile')]}
+ },
'addendum': {
- 'actions': [_trans_rec_addendum],
- 'result': {'type': 'form', 'arch':_transaction_add_form, 'fields':_transaction_add_fields, 'state':[('end', 'Cancel'), ('reconcile', 'Reconcile')]}
- },
+ 'actions': [_trans_rec_addendum],
+ 'result': {'type': 'form', 'arch':_transaction_add_form, 'fields':_transaction_add_fields, 'state':[('end','Cancel'),('reconcile','Reconcile')]}
+ },
'reconcile': {
- 'actions': [_trans_rec_reconcile],
+ 'actions': [_trans_rec_reconcile],
'result': {'type': 'state', 'state':'end'}
- },
+ },
'partial': {
- 'actions': [_trans_rec_reconcile_partial],
+ 'actions': [_trans_rec_reconcile_partial],
'result': {'type': 'state', 'state':'end'}
}
}
diff --git a/addons/account/wizard/wizard_reconcile_select.py b/addons/account/wizard/wizard_reconcile_select.py
new file mode 100644
index 00000000000..594020debd4
--- /dev/null
+++ b/addons/account/wizard/wizard_reconcile_select.py
@@ -0,0 +1,61 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+
+import wizard
+from tools.translate import _
+
+
+_journal_form = '''
+''' % ('Reconciliation',)
+
+_journal_fields = {
+ 'account_id': {'string':'Account', 'type':'many2one', 'relation':'account.account','domain': [('reconcile','=',1)], 'required':True},
+}
+
+def _action_open_window(self, cr, uid, data, context):
+ return {
+ 'domain': "[('account_id','=',%d),('reconcile_id','=',False),('state','<>','draft')]" % data['form']['account_id'],
+ 'name': _('Reconciliation'),
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'view_id': False,
+ 'res_model': 'account.move.line',
+ 'type': 'ir.actions.act_window'
+ }
+
+class wiz_rec_select(wizard.interface):
+ states = {
+ 'init': {
+ 'actions': [],
+ 'result': {'type': 'form', 'arch':_journal_form, 'fields':_journal_fields, 'state':[('end','Cancel'),('open','Open for reconciliation')]}
+ },
+ 'open': {
+ 'actions': [],
+ 'result': {'type': 'action', 'action': _action_open_window, 'state':'end'}
+ }
+ }
+wiz_rec_select('account.move.line.reconcile.select')
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/account/wizard/wizard_refund.py b/addons/account/wizard/wizard_refund.py
new file mode 100644
index 00000000000..42526f3cc0a
--- /dev/null
+++ b/addons/account/wizard/wizard_refund.py
@@ -0,0 +1,226 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+
+import wizard
+import pooler
+import osv
+import netsvc
+import time
+from tools.translate import _
+
+sur_form = '''
+'''
+
+sur_fields = {
+ 'date': {'string':'Operation date','type':'date', 'required':'False'},
+ 'period':{'string': 'Force period', 'type': 'many2one',
+ 'relation': 'account.period', 'required': False},
+ 'description':{'string':'Description', 'type':'char', 'required':'True'},
+ }
+
+
+class wiz_refund(wizard.interface):
+
+ def _invoice_refund(self, cr, uid, data, context):
+ return self._compute_refund(cr, uid, data, 'refund', context)
+
+ def _invoice_cancel(self, cr, uid, data, context):
+ return self._compute_refund(cr, uid, data, 'cancel', context)
+
+ def _invoice_modify(self, cr, uid, data, context):
+ return self._compute_refund(cr, uid, data, 'modify', context)
+
+ def _compute_refund(self, cr, uid, data, mode, context):
+ form = data['form']
+ pool = pooler.get_pool(cr.dbname)
+ reconcile_obj = pool.get('account.move.reconcile')
+ account_m_line_obj = pool.get('account.move.line')
+ created_inv = []
+ date = False
+ period = False
+ description = False
+ for inv in pool.get('account.invoice').browse(cr, uid, data['ids']):
+ if inv.state in ['draft', 'proforma2', 'cancel']:
+ raise wizard.except_wizard(_('Error !'), _('Can not %s draft/proforma/cancel invoice.') % (mode))
+ if form['period'] :
+ period = form['period']
+ else:
+ period = inv.period_id and inv.period_id.id or False
+
+ if form['date'] :
+ date = form['date']
+ if not form['period'] :
+ cr.execute("select name from ir_model_fields where model='account.period' and name='company_id'")
+ result_query = cr.fetchone()
+ if result_query:
+ #in multi company mode
+ cr.execute("""SELECT id
+ from account_period where date('%s')
+ between date_start AND date_stop and company_id = %s limit 1 """,
+ (form['date'],pool.get('res.users').browse(cr,uid,uid).company_id.id,))
+ else:
+ #in mono company mode
+ cr.execute("""SELECT id
+ from account_period where date('%s')
+ between date_start AND date_stop limit 1 """,
+ (form['date'],))
+ res = cr.fetchone()
+ if res:
+ period = res[0]
+ else:
+ date = inv.date_invoice
+
+ if form['description'] :
+ description = form['description']
+ else:
+ description = inv.name
+
+ if not period:
+ raise wizard.except_wizard(_('Data Insufficient !'), _('No Period found on Invoice!'))
+
+ refund_id = pool.get('account.invoice').refund(cr, uid, [inv.id],date, period, description)
+ refund = pool.get('account.invoice').browse(cr, uid, refund_id[0])
+ # we compute due date
+ #!!!due date = date inv date on formdate
+ pool.get('account.invoice').write(cr, uid, [refund.id],{'date_due':date,'check_total':inv.check_total})
+ # to make the taxes calculated
+ pool.get('account.invoice').button_compute(cr, uid, refund_id)
+
+ created_inv.append(refund_id[0])
+ #if inv is paid we unreconcile
+ if mode in ('cancel','modify'):
+ movelines = inv.move_id.line_id
+ #we unreconcile the lines
+ to_reconcile_ids = {}
+ for line in movelines :
+ #if the account of the line is the as the one in the invoice
+ #we reconcile
+ if line.account_id.id == inv.account_id.id :
+ to_reconcile_ids[line.account_id.id] =[line.id]
+ if type(line.reconcile_id) != osv.orm.browse_null :
+ reconcile_obj.unlink(cr,uid, line.reconcile_id.id)
+ #we advance the workflow of the refund to open
+ wf_service = netsvc.LocalService('workflow')
+ wf_service.trg_validate(uid, 'account.invoice', refund.id, 'invoice_open', cr)
+ #we reload the browse record
+ refund = pool.get('account.invoice').browse(cr, uid, refund_id[0])
+ #we match the line to reconcile
+ for tmpline in refund.move_id.line_id :
+ if tmpline.account_id.id == inv.account_id.id :
+ to_reconcile_ids[tmpline.account_id.id].append(tmpline.id)
+ for account in to_reconcile_ids :
+ account_m_line_obj.reconcile(cr, uid, to_reconcile_ids[account],
+ writeoff_period_id=period,
+ writeoff_journal_id=inv.journal_id.id,
+ writeoff_acc_id=inv.account_id.id
+ )
+ #we create a new invoice that is the copy of the original
+ if mode == 'modify' :
+ invoice = pool.get('account.invoice').read(cr, uid, [inv.id],
+ ['name', 'type', 'number', 'reference',
+ 'comment', 'date_due', 'partner_id', 'address_contact_id',
+ 'address_invoice_id', 'partner_insite','partner_contact',
+ 'partner_ref', 'payment_term', 'account_id', 'currency_id',
+ 'invoice_line', 'tax_line', 'journal_id','period_id'
+ ]
+ )
+ invoice = invoice[0]
+ del invoice['id']
+ invoice_lines = pool.get('account.invoice.line').read(cr, uid, invoice['invoice_line'])
+ invoice_lines = pool.get('account.invoice')._refund_cleanup_lines(cr, uid, invoice_lines)
+ tax_lines = pool.get('account.invoice.tax').read(
+ cr, uid, invoice['tax_line'])
+ tax_lines = pool.get('account.invoice')._refund_cleanup_lines(cr, uid, tax_lines)
+
+ invoice.update({
+ 'type': inv.type,
+ 'date_invoice': date,
+ 'state': 'draft',
+ 'number': False,
+ 'invoice_line': invoice_lines,
+ 'tax_line': tax_lines,
+ 'period_id': period,
+ 'name':description
+ })
+
+ #take the id part of the tuple returned for many2one fields
+ for field in ('address_contact_id', 'address_invoice_id', 'partner_id',
+ 'account_id', 'currency_id', 'payment_term', 'journal_id'):
+ invoice[field] = invoice[field] and invoice[field][0]
+
+ # create the new invoice
+ inv_id = pool.get('account.invoice').create(cr, uid, invoice,{})
+ # we compute due date
+ if inv.payment_term.id:
+ data = pool.get('account.invoice').onchange_payment_term_date_invoice(cr, uid, [inv_id],inv.payment_term.id,date)
+ if 'value' in data and data['value']:
+ pool.get('account.invoice').write(cr, uid, [inv_id],data['value'])
+ created_inv.append(inv_id)
+
+ #we get the view id
+ mod_obj = pool.get('ir.model.data')
+ act_obj = pool.get('ir.actions.act_window')
+ if inv.type == 'out_invoice':
+ xml_id = 'action_invoice_tree5'
+ elif inv.type == 'in_invoice':
+ xml_id = 'action_invoice_tree8'
+ elif type == 'out_refund':
+ xml_id = 'action_invoice_tree10'
+ else:
+ xml_id = 'action_invoice_tree12'
+ #we get the model
+ result = mod_obj._get_id(cr, uid, 'account', xml_id)
+ id = mod_obj.read(cr, uid, result, ['res_id'])['res_id']
+ # we read the act window
+ result = act_obj.read(cr, uid, id)
+ result['res_id'] = created_inv
+
+ return result
+
+ states = {
+ 'init': {
+ 'actions': [],
+ 'result': {'type':'form', 'arch':sur_form, 'fields':sur_fields, 'state':[('end','Cancel'),('refund','Refund Invoice'),('cancel_invoice','Cancel Invoice'),('modify_invoice','Modify Invoice')]}
+ },
+ 'refund': {
+ 'actions': [],
+ 'result': {'type':'action', 'action':_invoice_refund, 'state':'end'},
+ },
+ 'cancel_invoice': {
+ 'actions': [],
+ 'result': {'type':'action', 'action':_invoice_cancel, 'state':'end'},
+ },
+ 'modify_invoice': {
+ 'actions': [],
+ 'result': {'type':'action', 'action':_invoice_modify, 'state':'end'},
+ },
+
+ }
+wiz_refund('account.invoice.refund')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/account/wizard/wizard_state_open.py b/addons/account/wizard/wizard_state_open.py
index f33c90231f4..9720f48e25e 100644
--- a/addons/account/wizard/wizard_state_open.py
+++ b/addons/account/wizard/wizard_state_open.py
@@ -47,7 +47,7 @@ class wiz_state_open(wizard.interface):
states = {
'init': {
'actions': [],
- 'result': {'type':'form', 'arch':form, 'fields': fields, 'state':[('end','No','gtk-no'),('yes','Yes','gtk-yes')]}
+ 'result': {'type':'form', 'arch':form, 'fields':fields, 'state':[('end','No','gtk-no'),('yes','Yes','gtk-yes')]}
},
'yes': {
'actions': [_change_inv_state],
diff --git a/addons/account_voucher/__terp__.py b/addons/account_voucher/__terp__.py
index 01874eeed77..b6843372f4c 100755
--- a/addons/account_voucher/__terp__.py
+++ b/addons/account_voucher/__terp__.py
@@ -43,8 +43,7 @@
"voucher_sequence.xml",
"account_report.xml",
"voucher_view.xml",
- "wizard/account_voucher_open_view.xml",
- #"voucher_wizard.xml",
+ "voucher_wizard.xml",
"account_view.xml",
],
'certificate': '0037580727101',
diff --git a/addons/account_voucher/wizard/__init__.py b/addons/account_voucher/wizard/__init__.py
index 237055f710d..136fd1d8ee9 100644
--- a/addons/account_voucher/wizard/__init__.py
+++ b/addons/account_voucher/wizard/__init__.py
@@ -19,5 +19,4 @@
#
##############################################################################
-
-import account_voucher_open
+import open_voucher
diff --git a/addons/account_voucher/wizard/account_voucher_open.py b/addons/account_voucher/wizard/account_voucher_open.py
deleted file mode 100644
index 508a2d1c275..00000000000
--- a/addons/account_voucher/wizard/account_voucher_open.py
+++ /dev/null
@@ -1,76 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-from mx.DateTime import RelativeDateTime
-from osv import fields, osv
-from tools import config
-import ir
-import mx.DateTime
-import netsvc
-import pooler
-import time
-
-class account_voucher_open(osv.osv_memory):
- """
- Open Account Voucher
- """
- _name ="account.voucher.open"
- _description ="Open Voucher"
- _columns ={
- 'type':fields.selection([('pay_voucher','Cash Payment Voucher'),('bank_pay_voucher','Bank Payment Voucher'),('rec_voucher','Cash Receipt Voucher'),('bank_rec_voucher','Bank Receipt Voucher'),('cont_voucher','Contra Voucher'),( 'journal_sale_vou','Journal Sale Voucher'),('journal_pur_voucher','Journal Purchase Voucher')], 'Voucher Type', required=True),
- 'state':fields.selection([('draft','Draft'),
- ('proforma','Pro-forma'),
- ('posted','Posted'),
- ('cancel','Cancel')], 'State', required=True),
- 'period_ids':fields.many2many('account.period', 'account_period_rel', 'voucher_id', 'period_id', 'Periods')
- }
- def _action_open_window(self, cr, uid, ids, context):
- """
- Open account voucher form.
- @param cr: the current row, from the database cursor.
- @param uid: the current user’s ID for security checks.
- @param id: List of account voucher open’s IDs.
- @param return:dictionary of account voucher on given state ,type and account period id.
- """
-
- for form in self.read(cr, uid, ids):
- periods = []
- if not form['period_ids']:
- period = self.pool.get('account.period')
- year = self.pool.get('account.fiscalyear')
- year = year.find(cr, uid)
- periods = period.search(cr, uid, [('fiscalyear_id','=',year)])
- else:
- periods = form['period_ids']
-
- return {
- 'domain': "[('type','=','%s'), ('state','=','%s'), ('period_id','in',%s)]" % (form['type'], form['state'], periods),
- 'name': "%s - %s" % (form['type'],form['state']),
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'account.voucher',
- 'view_id': False,
- 'context': "{'type':'%s', 'state':'%s', 'period_id':%s}" % (form['type'], form['state'], periods),
- 'type': 'ir.actions.act_window'
- }
-account_voucher_open()
-
-
diff --git a/addons/account_voucher/wizard/account_voucher_open_view.xml b/addons/account_voucher/wizard/account_voucher_open_view.xml
deleted file mode 100644
index 5e71b20c6f4..00000000000
--- a/addons/account_voucher/wizard/account_voucher_open_view.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
-
- account.voucher.open.form
- account.voucher.open
- form
-
-
-
-
-
-
- Open a Voucher Entry
- account.voucher.open
- form
- tree,form
-
- new
-
-
-
-
-
\ No newline at end of file
diff --git a/addons/account_voucher/wizard/open_voucher.py b/addons/account_voucher/wizard/open_voucher.py
new file mode 100644
index 00000000000..5a3892e1a14
--- /dev/null
+++ b/addons/account_voucher/wizard/open_voucher.py
@@ -0,0 +1,104 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+
+import wizard
+from tools.translate import _
+import pooler
+
+_voucher_form = '''
+'''
+
+_types = {
+ 'pay_voucher':'Cash Payment Voucher',
+ 'bank_pay_voucher':'Bank Payment Voucher',
+ 'rec_voucher':'Cash Receipt Voucher',
+ 'bank_rec_voucher':'Bank Receipt Voucher',
+ 'cont_voucher':'Contra Voucher',
+ 'journal_sale_vou':'Journal Sale Voucher',
+ 'journal_pur_voucher':'Journal Purchase Voucher'
+}
+_states = {
+ 'draft':'Draft',
+ 'proforma':'Pro-forma',
+ 'posted':'Posted',
+ 'cancel':'Cancel'
+}
+
+_voucher_fields = {
+ 'type': {'string':'Voucher Type', 'type':'selection', 'selection':[
+ ('pay_voucher','Cash Payment Voucher'),
+ ('bank_pay_voucher','Bank Payment Voucher'),
+ ('rec_voucher','Cash Receipt Voucher'),
+ ('bank_rec_voucher','Bank Receipt Voucher'),
+ ('cont_voucher','Contra Voucher'),
+ ('journal_sale_vou','Journal Sale Voucher'),
+ ('journal_pur_voucher','Journal Purchase Voucher')], 'required':True},
+ 'state': {'string':'State', 'type':'selection', 'selection':[
+ ('draft','Draft'),
+ ('proforma','Pro-forma'),
+ ('posted','Posted'),
+ ('cancel','Cancel')], 'required':True},
+ 'period_ids': {'string':'Periods', 'type':'many2many', 'relation':'account.period'},
+}
+
+def _action_open_window(self, cr, uid, data, context):
+ form = data['form']
+ periods = []
+
+ if not form['period_ids'][0][2]:
+ pool = pooler.get_pool(cr.dbname)
+ period = pool.get('account.period')
+ year = pool.get('account.fiscalyear')
+
+ year = year.find(cr, uid)
+ periods = period.search(cr, uid, [('fiscalyear_id','=',year)])
+ else:
+ periods = form['period_ids'][0][2]
+
+ return {
+ 'domain': "[('type','=','%s'), ('state','=','%s'), ('period_id','in',%s)]" % (form['type'], form['state'], periods),
+ 'name': "%s - %s" % (_types[form['type']], _states[form['state']]),
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'account.voucher',
+ 'view_id': False,
+ 'context': "{'type':'%s', 'state':'%s', 'period_id':%s}" % (form['type'], form['state'], periods),
+ 'type': 'ir.actions.act_window'
+ }
+
+class OpenVoucherEntries(wizard.interface):
+ states = {
+ 'init': {
+ 'actions': [],
+ 'result': {'type': 'form', 'arch':_voucher_form, 'fields':_voucher_fields, 'state':[('end','Cancel'),('open','Open Voucher Entries')]}
+ },
+ 'open': {
+ 'actions': [],
+ 'result': {'type': 'action', 'action': _action_open_window, 'state':'end'}
+ }
+ }
+OpenVoucherEntries('account.voucher.open')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/auction/__terp__.py b/addons/auction/__terp__.py
index c3f9058f070..83064640266 100644
--- a/addons/auction/__terp__.py
+++ b/addons/auction/__terp__.py
@@ -34,16 +34,6 @@
'init_xml': ['auction_sequence.xml'],
'update_xml': [
'security/ir.model.access.csv',
- 'wizard/auction_lots_able_view.xml',
- 'wizard/auction_lots_enable_view.xml',
- 'wizard/auction_lots_make_invoice_buyer_view.xml',
- 'wizard/auction_lots_make_invoice_view.xml',
- 'wizard/auction_taken_view.xml',
- 'wizard/auction_lots_auction_move_view.xml',
- 'wizard/auction_pay_buy_view.xml',
- 'wizard/auction_payer_sel_view.xml',
- 'wizard/auction_lots_sms_send_view.xml',
-
'auction_view.xml',
'auction_report.xml',
'auction_wizard.xml'
diff --git a/addons/auction/auction.py b/addons/auction/auction.py
index 979f2c6cf42..0ece4690d9f 100644
--- a/addons/auction/auction.py
+++ b/addons/auction/auction.py
@@ -478,15 +478,13 @@ class auction_lots(osv.osv):
result = [ (r['id'], str(r['obj_num'])+' - '+r['name']) for r in self.read(cr, user, ids, ['name','obj_num'])]
return result
- def name_search(self, cr, user, name, args=None, operator='ilike', context={}):
- if not args:
- args = []
+ def name_search(self, cr, user, name, args=[], operator='ilike', context={}):
try:
- ids = self.search(cr, user, [('obj_num','=',int(name))] + args)
+ ids = self.search(cr, user, [('obj_num','=',int(name))]+ args)
except:
ids = []
if not ids:
- ids = self.search(cr, user, [('name',operator,name)] + args)
+ ids = self.search(cr, user, [('name',operator,name)]+ args)
return self.name_get(cr, user, ids)
def _sum_taxes_by_type_and_id(self, taxes):
diff --git a/addons/auction/auction_view.xml b/addons/auction/auction_view.xml
index ee1004ab0f3..2189253f3ce 100644
--- a/addons/auction/auction_view.xml
+++ b/addons/auction/auction_view.xml
@@ -3,8 +3,7 @@
-
-
+
=======================================================
Auction Management/Configuration/artist
=======================================================
@@ -204,7 +203,6 @@
-
@@ -279,7 +277,7 @@
-
+
@@ -332,6 +330,7 @@
+
@@ -341,7 +340,9 @@
+
+
diff --git a/addons/auction/auction_wizard.xml b/addons/auction/auction_wizard.xml
index ab1b051add5..0a93799cc20 100644
--- a/addons/auction/auction_wizard.xml
+++ b/addons/auction/auction_wizard.xml
@@ -1,8 +1,8 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- -->
+
+
+
+
diff --git a/addons/auction/wizard/__init__.py b/addons/auction/wizard/__init__.py
index b82dcda5307..ec07ef6e04f 100644
--- a/addons/auction/wizard/__init__.py
+++ b/addons/auction/wizard/__init__.py
@@ -19,27 +19,24 @@
#
##############################################################################
-#import wizard_aie_send
-#import wizard_aie_send_result
-#import wizard_lots_buyer_map
-#import wizard_lots_cancel
-#import wizard_lots_invoice
-#import wizard_lots_numerotate
-#import wizard_lots_pay
-#import wizard_pay
-#import wizard_lot_date_move
-#import wizard_transfer_unsold_object
-#import auction_catalog_flagey
-
-import auction_lots_able
-import auction_lots_enable
-import auction_lots_make_invoice_buyer
-import auction_lots_make_invoice
-import auction_taken
-import auction_lots_auction_move
-import auction_pay_buy
-import auction_payer_sel
-import auction_lots_sms_send
-
+import wizard_aie_send
+import wizard_aie_send_result
+import wizard_lots_buyer_map
+import wizard_lots_cancel
+import wizard_lots_invoice
+import wizard_lots_numerotate
+import wizard_lots_pay
+import wizard_pay
+import wizard_lots_sms
+import wizard_lot_date_move
+import wizard_auction_journal
+import wizard_auction_invoice_buyer
+import wizard_transfer_unsold_object
+import auction_wizard_enable_taken
+import auction_wizard_able_taken
+import auction_catalog_flagey
+#import wizard_lots_barcode
+import wizard_emporte
+import wizard_payer
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/auction/wizard/auction_lots_able.py b/addons/auction/wizard/auction_lots_able.py
deleted file mode 100644
index 8ddeeca8055..00000000000
--- a/addons/auction/wizard/auction_lots_able.py
+++ /dev/null
@@ -1,44 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-from osv import fields, osv
-from tools.translate import _
-import netsvc
-import pooler
-import time
-import tools
-import wizard
-
-class auction_lots_able(osv.osv_memory):
-
- _name = "auction.lots.able"
- _description = "Lots able"
-
- def confirm_able(self, cr, uid, ids, context={}):
- """
- This function Update auction lots object and set taken away field true.
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: List of auction lots able’s IDs.
- """
- self.pool.get('auction.lots').write(cr, uid, context['active_ids'], {'ach_emp':True})
- return {}
-
-auction_lots_able()
diff --git a/addons/auction/wizard/auction_lots_able_view.xml b/addons/auction/wizard/auction_lots_able_view.xml
deleted file mode 100644
index c0ac577a8d7..00000000000
--- a/addons/auction/wizard/auction_lots_able_view.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
- auction.lots.able.form
- auction.lots.able
- form
-
-
-
-
-
-
- Mark as taken away
- auction.lots.able
- form
- tree,form
-
- new
- {'record_id' : active_id}
-
-
-
-
-
- Mark as taken away
- client_action_multi
-
- action
- auction.lots
-
-
-
diff --git a/addons/auction/wizard/auction_lots_auction_move.py b/addons/auction/wizard/auction_lots_auction_move.py
deleted file mode 100644
index 28146198b3f..00000000000
--- a/addons/auction/wizard/auction_lots_auction_move.py
+++ /dev/null
@@ -1,84 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-from osv import fields, osv
-from tools.translate import _
-import netsvc
-import pooler
-import time
-import tools
-import wizard
-
-class auction_lots_auction_move(osv.osv_memory):
-
- _name = "auction.lots.auction.move"
- _description = "Auction move "
- _columns= {
- 'auction_id':fields.many2one('auction.dates', 'Auction Date', required=True),
- }
-
- def _top(self, cr, uid, ids, context={}):
- refs = self.pool.get('auction.lots')
- rec_ids = refs.browse(cr, uid, context['active_ids'])
- for rec in rec_ids:
- if not rec.auction_id:
- raise osv.except_osv('Error !', 'You can not move a lot that has no auction date')
- return {}
-
- def auction_move_set(self, cr, uid, ids, context={}):
- """
- This Function update auction date on auction lots to given auction date.
- erase the auction lots's object adjudication price and its buyer and change state to draft.
- create new entry in auction lot history.
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: List of auction lots auction move’s IDs.
- """
- for datas in self.read(cr, uid, ids):
- if not (datas['auction_id'] and len(context['active_ids'])) :
- return {}
- refs = self.pool.get('auction.lots')
- rec_ids = refs.browse(cr, uid, context['active_ids'])
- line_ids = self.pool.get('auction.bid_line').search(cr, uid, [('lot_id', 'in', context['active_ids'])])
- # pooler.get_pool(cr.dbname).get('auction.bid_line').unlink(cr, uid, line_ids)
- for rec in rec_ids:
- new_id = self.pool.get('auction.lot.history').create(cr, uid, {
- 'auction_id': rec.auction_id.id,
- 'lot_id': rec.id,
- 'price': rec.obj_ret
- })
- up_auction = self.pool.get('auction.lots').write(cr, uid, [rec.id], {
- 'auction_id':datas['auction_id'],
- 'obj_ret': None,
- 'obj_price': None,
- 'ach_login': None,
- 'ach_uid': None,
- 'ach_inv_id': None,
- 'sel_inv_id': None,
- 'obj_num': None,
- 'state': 'draft'})
- return {}
-
-auction_lots_auction_move()
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/auction/wizard/auction_lots_auction_move_view.xml b/addons/auction/wizard/auction_lots_auction_move_view.xml
deleted file mode 100644
index 0e81697c51b..00000000000
--- a/addons/auction/wizard/auction_lots_auction_move_view.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-
- auction.lots.auction.move.form
- auction.lots.auction.move
- form
-
-
-
-
-
-
- Change Auction Date
- auction.lots.auction.move
- form
- tree,form
-
- new
- {'record_id' : active_id}
-
-
-
-
-
- Change Auction Date
- client_action_multi
-
- action
- auction.lots
-
-
-
-
diff --git a/addons/auction/wizard/auction_lots_enable.py b/addons/auction/wizard/auction_lots_enable.py
deleted file mode 100644
index e8aa5edadf5..00000000000
--- a/addons/auction/wizard/auction_lots_enable.py
+++ /dev/null
@@ -1,47 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-from osv import fields, osv
-from tools.translate import _
-import netsvc
-import pooler
-import time
-import tools
-import wizard
-
-class auction_lots_enable(osv.osv_memory):
-
- _name = "auction.lots.enable"
- _description = "Lots Enable"
- _columns= {
- 'confirm_en':fields.integer('Catalog Number')
- }
-
- def confirm_enable(self, cr, uid, ids, context={}):
- """
- This function Update auction lots object and set taken away field False.
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: List of auction lots enable’s IDs.
- """
- self.pool.get('auction.lots').write(cr, uid, context['active_id'], {'ach_emp':False})
- return {}
-
-auction_lots_enable()
diff --git a/addons/auction/wizard/auction_lots_enable_view.xml b/addons/auction/wizard/auction_lots_enable_view.xml
deleted file mode 100644
index ce99308798c..00000000000
--- a/addons/auction/wizard/auction_lots_enable_view.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-
- auction.lots.enable.form
- auction.lots.enable
- form
-
-
-
-
-
-
- Unmark as taken away
- auction.lots.enable
- form
- tree,form
-
- new
- {'record_id' : active_id}
-
-
-
-
-
- Unmark as taken away
- client_action_multi
-
- action
- auction.lots
-
-
-
-
-
diff --git a/addons/auction/wizard/auction_lots_make_invoice.py b/addons/auction/wizard/auction_lots_make_invoice.py
deleted file mode 100644
index 693826d71a0..00000000000
--- a/addons/auction/wizard/auction_lots_make_invoice.py
+++ /dev/null
@@ -1,93 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-from osv import fields, osv
-from tools.translate import _
-import netsvc
-import pooler
-import time
-import tools
-import wizard
-
-class auction_lots_make_invoice(osv.osv_memory):
-
- def _value_amount(self, cr, uid, context={}):
- """
- For Amount default value
- @return:default auction lots amount value in amount fields.
- """
- lots= self.pool.get('auction.lots').browse(cr, uid, context['active_ids'])
- amount_total=0.0
- for lot in lots:
- amount_total+=lot.seller_price
- return amount_total
-
- def _value_object(self, cr, uid, context={}):
- """
- For object default value.
- @return:length of id in Object field.
- """
- object = len(context['active_ids'])
- return object
-
- def makeInvoices(self, cr, uid, ids, context):
- """
- seller invoice :Create an invoice.
- @param cr: the current row, from the database cursor.
- @param uid: the current user’s ID for security checks.
- @param ids: List of Auction lots make invoice’s IDs
- @return: dictionary of account invoice form.
- """
- for data in self.read(cr, uid, ids):
- order_obj = self.pool.get('auction.lots')
- mod_obj = self.pool.get('ir.model.data')
- result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
- id = mod_obj.read(cr, uid, result, ['res_id'])
- newinv = []
- ids = order_obj.seller_trans_create(cr, uid, context['active_ids'], context)
- cr.commit()
- return {
- 'domain': "[('id','in', ["+','.join(map(str, ids))+"])]",
- 'name': 'Seller invoices',
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'account.invoice',
- 'view_id': False,
- 'context': "{'type':'out_refund'}",
- 'type': 'ir.actions.act_window',
- 'search_view_id': id['res_id']
- }
-
- _name = "auction.lots.make.invoice"
- _description = "Make invoice"
- _columns= {
- 'amount': fields.float('Invoiced Amount', required =True, readonly=True),
- 'objects':fields.integer('# of objects', required =True, readonly=True),
- 'number':fields.char('Invoice Number', size=64),
-
- }
- _defaults={
- 'amount':_value_amount,
- 'objects':_value_object,
- 'number':lambda *a: False,
-
- }
-
-auction_lots_make_invoice()
diff --git a/addons/auction/wizard/auction_lots_make_invoice_buyer.py b/addons/auction/wizard/auction_lots_make_invoice_buyer.py
deleted file mode 100644
index 01eec83efe8..00000000000
--- a/addons/auction/wizard/auction_lots_make_invoice_buyer.py
+++ /dev/null
@@ -1,109 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-from osv import fields, osv
-from tools.translate import _
-import netsvc
-import pooler
-import time
-import tools
-import wizard
-
-class auction_lots_make_invoice_buyer(osv.osv_memory):
-
- def _value_amount(self, cr, uid, context={}):
- """
- For Amount default value
- @return:default auction lots amount value in amount fields.
- """
- lots= self.pool.get('auction.lots').browse(cr, uid, context['active_ids'])
- amount_total=0.0
- for lot in lots:
- amount_total+=lot.buyer_price
- return amount_total
-
- def _value_object(self, cr, uid, context={}):
- """
- For object default value.
- @return:length of id in Object field.
- """
- object = len(context['active_ids'])
- return object
-
- def _value_buyer_id(self, cr, uid, context={}):
- """
- For default buyer id value
- @return:auction lots buyer id in buyer id field.
- """
- lots= self.pool.get('auction.lots').browse(cr, uid, context['active_ids'])
- for lot in lots:
- buyer=lot and lot.ach_uid.id or False
- return buyer
-
- def makeInvoices(self, cr, uid, ids, context):
- """
- Create an invoice for selected lots (IDS) to BUYER_ID .
- @param cr: the current row, from the database cursor.
- @param uid: the current user’s ID for security checks.
- @param ids: List of Auction lots make invoice buyer’s IDs
- @return: dictionary of account invoice form.
- """
- newinv = []
- for data in self.read(cr, uid, ids):
-
- order_obj = self.pool.get('auction.lots')
- mod_obj = self.pool.get('ir.model.data')
- result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
- id = mod_obj.read(cr, uid, result, ['res_id'])
- lots = order_obj.browse(cr, uid, context['active_ids'])
- invoice_number = data['number']
- for lot in lots:
- up_auction = self.pool.get('auction.lots').write(cr, uid, [lot.id], {'ach_uid':data['buyer_id']})
- ids = order_obj.lots_invoice(cr, uid, context['active_ids'], context, data['number'])
- cr.commit()
- return {
- 'domain': "[('id','in', ["+','.join(map(str, ids))+"])]",
- 'name': 'Buyer invoices',
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'account.invoice',
- 'view_id': False,
- 'context': "{'type':'in_refund'}",
- 'type': 'ir.actions.act_window',
- 'search_view_id': id['res_id']
- }
-
- _name = "auction.lots.make.invoice.buyer"
- _description = "Make invoice buyer "
- _columns= {
- 'amount': fields.float('Invoiced Amount', required =True, readonly=True),
- 'objects':fields.integer('# of objects', required =True, readonly=True),
- 'number':fields.char('Invoice Number', size=64),
- 'buyer_id':fields.many2one('res.partner', 'Buyer', required=True),
- }
- _defaults={
- 'amount':_value_amount,
- 'objects':_value_object,
- 'number':lambda *a: False,
- 'buyer_id':_value_buyer_id
-
- }
-
-auction_lots_make_invoice_buyer()
diff --git a/addons/auction/wizard/auction_lots_make_invoice_buyer_view.xml b/addons/auction/wizard/auction_lots_make_invoice_buyer_view.xml
deleted file mode 100644
index a813ca6c609..00000000000
--- a/addons/auction/wizard/auction_lots_make_invoice_buyer_view.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
- auction.lots.make.invoice.buyer.form
- auction.lots.make.invoice.buyer
- form
-
-
-
-
-
-
- Invoice Buyer objects
- auction.lots.make.invoice.buyer
- form
- tree,form
-
- new
- {'record_id' : active_id}
-
-
-
-
-
- Invoice Buyer objects
- client_action_multi
-
- action
- auction.lots
-
-
-
-
-
-
diff --git a/addons/auction/wizard/auction_lots_make_invoice_view.xml b/addons/auction/wizard/auction_lots_make_invoice_view.xml
deleted file mode 100644
index 4e06d8e15cc..00000000000
--- a/addons/auction/wizard/auction_lots_make_invoice_view.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-
- auction.lots.make.invoice.form
- auction.lots.make.invoice
- form
-
-
-
-
-
-
- Invoice Seller objects
- auction.lots.make.invoice
- form
- tree,form
-
- new
- {'record_id' : active_id}
-
-
-
-
-
- Invoice Seller objects
- client_action_multi
-
- action
- auction.lots
-
-
-
-
diff --git a/addons/auction/wizard/auction_lots_sms_send.py b/addons/auction/wizard/auction_lots_sms_send.py
deleted file mode 100644
index 40322cb8b23..00000000000
--- a/addons/auction/wizard/auction_lots_sms_send.py
+++ /dev/null
@@ -1,67 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-from osv import fields, osv
-from tools.translate import _
-import netsvc
-import pooler
-import time
-import tools
-import wizard
-
-class auction_lots_sms_send(osv.osv_memory):
-
- _name = "auction.lots.sms.send"
- _description = "Sms send "
- _columns= {
- 'app_id':fields.char('API ID', size=64, required=True),
- 'user':fields.char('Login', size=64, required=True),
- 'password':fields.char('Password', size=64, required=True),
- 'text':fields.text('SMS Message', required=True)
- }
-
- def sms_send(self, cr, uid, ids, context):
-
- for datas in self.read(cr, uid, ids):
- lots = self.pool.get('auction.lots').read(cr, uid, context['active_ids'], ['obj_num','obj_price','ach_uid'])
- print "lots",lots, [l['ach_uid'][0] for l in lots if l['ach_uid']]
- res = self.pool.get('res.partner').read(cr, uid, [l['ach_uid'][0] for l in lots if l['ach_uid']], ['gsm'], context)
-
- nbr = 0
- for r in res:
- add = self.pool.get('res.partner').address_get(cr, uid, [r['id']])['default']
- addr = self.pool.get('res.partner.address').browse(cr, uid, add)
- to = addr.mobile
- if to:
- tools.smssend(data['user'], data['password'], data['app_id'], unicode(data['text'], 'utf-8').encode('latin1'), to)
- nbr += 1
- return {'sms_sent': nbr}
-
- if to:
- tools.smssend(data['user'], data['password'], data['app_id'], unicode(data['text'], 'utf-8').encode('latin1'), to)
- nbr += 1
- return {'sms_sent': nbr}
-#
-auction_lots_sms_send()
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/auction/wizard/auction_lots_sms_send_view.xml b/addons/auction/wizard/auction_lots_sms_send_view.xml
deleted file mode 100644
index b3c49077534..00000000000
--- a/addons/auction/wizard/auction_lots_sms_send_view.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
- auction.lots.sms.send.form
- auction.lots.sms.send
- form
-
-
-
-
-
-
- SMS Send
- auction.lots.sms.send
- form
- tree,form
-
- new
- {'record_id' : active_id}
-
-
-
-
-
- SMS Send
- client_action_multi
-
- action
- auction.lots
-
-
-
-
diff --git a/addons/auction/wizard/auction_pay_buy.py b/addons/auction/wizard/auction_pay_buy.py
deleted file mode 100644
index b1d31532939..00000000000
--- a/addons/auction/wizard/auction_pay_buy.py
+++ /dev/null
@@ -1,105 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-from osv import fields, osv
-from tools.translate import _
-import netsvc
-import pooler
-import time
-import tools
-import wizard
-
-class auction_pay_buy(osv.osv_memory):
-
- def _start(self, cr, uid, context):
- rec = self.pool.get('auction.lots').browse(cr, uid, context['active_ids'], context)
- amount1 = 0.0
- for r in rec:
- amount1+= r.buyer_price
- if r.is_ok:
- raise osv.except_osv('Error !', 'Some lots of the selection are already paid.')
- return amount1
-
- def _value_buyer_id(self, cr, uid, context={}):
- """
- For default buyer id value
- @return:auction lots buyer id in buyer id field.
- """
- lots= self.pool.get('auction.lots').browse(cr, uid, context['active_ids'])
- for lot in lots:
- buyer=lot and lot.ach_uid.id or False
- return buyer
-
- def pay_and_reconcile(self, cr, uid, ids, context):
- for datas in self.read(cr, uid, ids):
- if not abs(datas['total'] - (datas['amount'] + datas['amount2'] + datas['amount3'])) <0.01:
- rest = datas['total']-(datas['amount'] + datas['amount2'] + datas['amount3'])
- raise osv.except_osv('Payment aborted !', 'You should pay all the total: "%.2f" are missing to accomplish the payment.' %(round(rest, 2)))
-
- lots = self.pool.get('auction.lots').browse(cr, uid, context['active_ids'], context)
- ref_bk_s = self.pool.get('account.bank.statement.line')
-
- for lot in lots:
- if datas['buyer_id']:
- self.pool.get('auction.lots').write(cr, uid, [lot.id], {'ach_uid':datas['buyer_id']})
- if not lot.auction_id:
- raise osv.except_osv('Error !', 'No auction date for "%s": Please set one.'%(lot.name))
- self.pool.get('auction.lots').write(cr, uid, [lot.id], {'is_ok':True})
-
- for st, stamount in [('statement_id1', 'amount'), ('statement_id2', 'amount2'), ('statement_id3', 'amount3')]:
- if datas[st]:
- new_id = ref_bk_s.create(cr, uid, {
- 'name':'Buyer:'+ str(lot.ach_login or '')+', auction:'+ lots[0].auction_id.name,
- 'date': time.strftime('%Y-%m-%d'),
- 'partner_id': datas['buyer_id'] or False,
- 'type':'customer',
- 'statement_id': datas[st],
- 'account_id': lot.auction_id.acc_income.id,
- 'amount': datas[stamount]
- })
- for lot in lots:
- self.pool.get('auction.lots').write(cr, uid, [lot.id], {'statement_id':[(4, new_id)]})
- return {}
-
- _name = "auction.pay.buy"
- _description = "Pay buy"
- _columns= {
- 'amount': fields.float('Amount paid', digits= (16, int(tools.config['price_accuracy']))),
- 'buyer_id':fields.many2one('res.partner', 'Buyer'),
- 'statement_id1':fields.many2one('account.bank.statement', 'Statement', required=True),
- 'amount2': fields.float('Amount paid', digits= (16, int(tools.config['price_accuracy']))),
- 'statement_id2':fields.many2one('account.bank.statement', 'Statement'),
- 'amount3': fields.float('Amount paid', digits = (16, int(tools.config['price_accuracy']))),
- 'statement_id3':fields.many2one('account.bank.statement', 'Statement'),
- 'total': fields.float('Amount paid', digits = (16, int(tools.config['price_accuracy'])), readonly =True),
- }
- _defaults={
- 'amount' : _start,
- 'total' : _start,
- 'buyer_id' : _value_buyer_id
- }
-
-auction_pay_buy()
-
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/auction/wizard/auction_pay_buy_view.xml b/addons/auction/wizard/auction_pay_buy_view.xml
deleted file mode 100644
index dea8600b477..00000000000
--- a/addons/auction/wizard/auction_pay_buy_view.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
- auction.pay.buy.form
- auction.pay.buy
- form
-
-
-
-
-
-
- Pay objects of the buyer
- auction.pay.buy
- form
- tree,form
-
- new
- {'record_id' : active_id}
-
-
-
-
-
- Pay objects of the buyer
- client_action_multi
-
- action
- auction.lots
-
-
-
-
diff --git a/addons/auction/wizard/auction_pay_sel.py b/addons/auction/wizard/auction_pay_sel.py
deleted file mode 100644
index ff1e2e781e3..00000000000
--- a/addons/auction/wizard/auction_pay_sel.py
+++ /dev/null
@@ -1,51 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-from osv import fields, osv
-from tools.translate import _
-import netsvc
-import pooler
-import time
-import tools
-import wizard
-
-class auction_pay_sel(osv.osv_memory):
-
- _name = "auction.pay.sel"
- _description = "Pay Invoice"
- _columns= {
- 'amount': fields.float('Amount paid', digits= (16, int(tools.config['price_accuracy'])), required=True),
- 'dest_account_id':fields.many2one('account.account', 'Payment to Account', required=True, domain= [('type', '=', 'cash')]),
- 'journal_id':fields.many2one('account.journal', 'Journal', required=True),
- 'period_id':fields.many2one('account.period', 'Period', required=True),
- }
-
- def pay_and_reconcile(self, cr, uid, ids, context):
- lot = self.pool.get('auction.lots').browse(cr, uid, context['active_id'], context)
- for datas in self.read(cr, uid, ids):
- account_id = datas.get('writeoff_acc_id', False)
- period_id = datas.get('period_id', False)
- journal_id = datas.get('journal_id', False)
- if lot.sel_inv_id:
- p = self.pool.get('account.invoice').pay_and_reconcile(['lot.sel_inv_id.id'], datas['amount'], datas['dest_account_id'], journal_id, account_id, period_id, journal_id, context)
- # lots.sel_inv_id.pay_and_reconcile(cr,uid,data[id], form['amount'], form['dest_account_id'], journal_id, account_id, period_id, journal_id, context)
- return {}
-
-auction_pay_sel()
diff --git a/addons/auction/wizard/auction_pay_sel_view.xml b/addons/auction/wizard/auction_pay_sel_view.xml
deleted file mode 100644
index 2570b7a7a0a..00000000000
--- a/addons/auction/wizard/auction_pay_sel_view.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
- auction.pay.sel.form
- auction.pay.sel
- form
-
-
-
-
-
-
- Pay objects of the seller
- auction.pay.sel
- form
- tree,form
-
- new
-
-
-
-
diff --git a/addons/auction/wizard/auction_payer_sel_view.xml b/addons/auction/wizard/auction_payer_sel_view.xml
deleted file mode 100644
index 9e8ca5ec5d2..00000000000
--- a/addons/auction/wizard/auction_payer_sel_view.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-
-
- auction.payer.form
- auction.payer
- form
-
-
-
-
-
-
- auction.payer.sel.form
- auction.payer.sel
- form
-
-
-
-
-
-
- Mark as paid for seller
- auction.payer.sel
- form
- tree,form
-
- new
- {'record_id' : active_id}
-
-
-
-
-
- Mark as paid for seller
- client_action_multi
-
- action
- auction.lots
-
-
-
-
diff --git a/addons/auction/wizard/auction_taken.py b/addons/auction/wizard/auction_taken.py
deleted file mode 100644
index 20ac6482317..00000000000
--- a/addons/auction/wizard/auction_taken.py
+++ /dev/null
@@ -1,57 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-from osv import fields, osv
-from tools.translate import _
-import netsvc
-import pooler
-import time
-import tools
-import wizard
-
-class auction_taken(osv.osv_memory):
- """
- Auction lots taken.
- """
- _name = "auction.taken"
- _description = "Auction taken"
- _columns = {
- 'lot_ids':fields.many2many('auction.lots', 'auction_taken_rel', 'taken_id', 'lot_id', 'Lots Emportes'),
-
- }
-
- def _to_xml(s):
- return s.replace('&','&').replace('<','<').replace('>','>')
-
- def process(self, cr, uid, ids, context):
- """
- Update Auction lots state to taken_away.
- @param cr: the current row, from the database cursor.
- @param uid: the current user’s ID for security checks.
- @param ids: List of Auction taken’s IDs
- @return: dictionary of lot_ids fields with empty list
- """
- for data in self.read(cr, uid, ids):
- lot_obj = self.pool.get('auction.lots')
- if data['lot_ids']:
- lot_obj.write(cr, uid, data['lot_ids'], {'state':'taken_away'})
- return {'lot_ids': []}
-
-auction_taken()
diff --git a/addons/auction/wizard/auction_taken_view.xml b/addons/auction/wizard/auction_taken_view.xml
deleted file mode 100644
index 626caa473ad..00000000000
--- a/addons/auction/wizard/auction_taken_view.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
-
- auction.taken.form
- auction.taken
- form
-
-
-
-
-
-
- Gestion emporte
- auction.taken
- form
- tree,form
-
- new
-
-
-
-
-
-
diff --git a/addons/mrp_repair/wizard/make_invoice.py b/addons/auction/wizard/auction_wizard_able_taken.py
similarity index 52%
rename from addons/mrp_repair/wizard/make_invoice.py
rename to addons/auction/wizard/auction_wizard_able_taken.py
index 983ebabac25..261cc47c48b 100644
--- a/addons/mrp_repair/wizard/make_invoice.py
+++ b/addons/auction/wizard/auction_wizard_able_taken.py
@@ -19,34 +19,43 @@
#
##############################################################################
+import wizard
import netsvc
-from osv import osv, fields
+import pooler
+take_form = """
+
+"""
-class make_invoice(osv.osv_memory):
- _name = 'mrp.repair.make_invoice'
- _description = 'Make Invoice'
-
- _columns = {
- 'group': fields.boolean('Group by partner invoice address'),
- }
+take_fields = {
+# 'confirm_en': {'string':'Catalog Number', 'type':'integer'},
+}
- def make_invoices(self, cr, uid, ids, context):
- inv = self.browse(cr, uid, ids[0])
- order_obj = self.pool.get('mrp.repair')
- newinv = order_obj.action_invoice_create(cr, uid, context['active_ids'], group=inv.group,context=context)
-
- return {
- 'domain': [('id','in', newinv.values())],
- 'name': 'Invoices',
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'account.invoice',
- 'view_id': False,
- 'context': "{'type':'out_invoice'}",
- 'type': 'ir.actions.act_window'
- }
+def _confirm_able(self,cr,uid,data,context={}):
+ res={}
+ pool = pooler.get_pool(cr.dbname)
+ pool.get('auction.lots').write(cr,uid,data['ids'],{'ach_emp':True})
+ return {}
+
+class able_take_away(wizard.interface):
+ states = {
+ 'init' : {
+ 'actions' : [],
+ 'result' : {
+ 'type' : 'form',
+ 'arch' : take_form,
+ 'fields' : take_fields,
+ 'state' : [('end', 'Cancel'),('go', 'Able Taken away')]}
+ },
+ 'go' : {
+ 'actions' : [_confirm_able],
+ 'result' : {'type' : 'state', 'state' : 'end'}
+ },
+}
+able_take_away('auction.lots.able')
-make_invoice()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/auction/wizard/auction_payer_sel.py b/addons/auction/wizard/auction_wizard_enable_taken.py
similarity index 51%
rename from addons/auction/wizard/auction_payer_sel.py
rename to addons/auction/wizard/auction_wizard_enable_taken.py
index 349f10d4dec..01f54ca28dc 100644
--- a/addons/auction/wizard/auction_payer_sel.py
+++ b/addons/auction/wizard/auction_wizard_enable_taken.py
@@ -19,42 +19,43 @@
#
##############################################################################
-from osv import fields, osv
-from tools.translate import _
+import wizard
import netsvc
import pooler
-import time
-import tools
-import wizard
+#field name="confirm_en"/>
-class auction_payer(osv.osv_memory):
+take_form = """
+
+"""
- _name = "auction.payer"
- _description = "Auction payer"
-
- def payer(self, cr, uid, ids, context):
- self.pool.get('auction.lots').write(cr, uid, context['active_ids'], {'is_ok':True, 'state':'paid'})
- return {}
-
-auction_payer()
+take_fields = {
+ 'confirm_en': {'string':'Catalog Number', 'type':'integer'},
+}
+
+def _confirm_enable(self,cr,uid,data,context={}):
+ pool = pooler.get_pool(cr.dbname)
+ pool.get('auction.lots').write(cr,uid,data['ids'],{'ach_emp':False})
+ return {}
+
+class enable_take_away(wizard.interface):
+ states = {
+ 'init' : {
+ 'actions' : [],
+ 'result' : {
+ 'type' : 'form',
+ 'arch' : take_form,
+ 'fields' : take_fields,
+ 'state' : [ ('end', 'Cancel'),('go', 'Enable Taken away')]}
+ },
+ 'go' : {
+ 'actions' : [_confirm_enable],
+ 'result' : {'type' : 'state', 'state' : 'end'}
+ },
+}
+enable_take_away('auction.lots.enable')
-class auction_payer_sel(osv.osv_memory):
- """
- For Mark as payment for seller
- """
- _name = "auction.payer.sel"
- _description = "Auction payment for seller"
-
- def payer_sel(self, cr, uid, ids, context):
- """
- This function Update auction lots object and seller paid true.
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: List of auction payer sel’s IDs.
- """
- self.pool.get('auction.lots').write(cr, uid, context['active_ids'], {'paid_vnd':True})
- return {}
-
-auction_payer_sel()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/auction/wizard/wizard_auction_invoice_buyer.py b/addons/auction/wizard/wizard_auction_invoice_buyer.py
new file mode 100644
index 00000000000..6cf12b5da22
--- /dev/null
+++ b/addons/auction/wizard/wizard_auction_invoice_buyer.py
@@ -0,0 +1,111 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+
+import wizard
+import netsvc
+import pooler
+
+invoice_form = '''
+'''
+
+invoice_fields = {
+ 'amount': {'string':'Invoiced Amount', 'type':'float', 'required':True, 'readonly':True},
+ 'objects': {'string':'# of objects', 'type':'integer', 'required':True, 'readonly':True},
+ 'number': {'string':'Invoice Number', 'type':'char'},
+ 'buyer_id':{'string': 'Buyer', 'type': 'many2one', 'relation':'res.partner'}
+
+}
+
+
+def _values(self,cr,uid, datas,context={}):
+ pool = pooler.get_pool(cr.dbname)
+ lots= pool.get('auction.lots').browse(cr,uid,datas['ids'])
+# price = 0.0
+ amount_total=0.0
+# pt_tax=pooler.get_pool(cr.dbname).get('account.tax')
+ for lot in lots:
+ buyer=lot and lot.ach_uid.id or False
+ amount_total+=lot.buyer_price
+# taxes = lot.product_id.taxes_id
+# if lot.author_right:
+# taxes.append(lot.author_right)
+# if lot.auction_id:
+# taxes += lot.auction_id.buyer_costs
+# tax=pt_tax.compute(cr,uid,taxes,lot.obj_price,1)
+# for t in tax:
+# amount_total+=t['amount']
+# amount_total+=lot.obj_price
+ # up_auction=pooler.get_pool(cr.dbname).get('auction.lots').write(cr,uid,[lot.id],{'ach_uid':datas['form']['buyer_id']})
+ invoice_number = False
+ return {'objects':len(datas['ids']), 'amount':amount_total, 'number':invoice_number,'buyer_id':buyer}
+
+
+def _makeInvoices(self, cr, uid, data, context):
+ newinv = []
+ pool = pooler.get_pool(cr.dbname)
+ order_obj = pool.get('auction.lots')
+ mod_obj = pool.get('ir.model.data')
+ result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
+ id = mod_obj.read(cr, uid, result, ['res_id'])
+ lots= order_obj.browse(cr,uid,data['ids'])
+ invoice_number=data['form']['number']
+ for lot in lots:
+ up_auction=pooler.get_pool(cr.dbname).get('auction.lots').write(cr,uid,[lot.id],{'ach_uid':data['form']['buyer_id']})
+ ids = order_obj.lots_invoice(cr, uid, data['ids'],context,data['form']['number'])
+# ids = order_obj.lots_invoice(cr, uid, data['ids'],context,invoice_number)
+ cr.commit()
+ return {
+ 'domain': "[('id','in', ["+','.join(map(str, ids))+"])]",
+ 'name': 'Buyer invoices',
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'account.invoice',
+ 'view_id': False,
+ 'context': "{'type':'in_refund'}",
+ 'type': 'ir.actions.act_window',
+ 'search_view_id': id['res_id']
+ }
+ return {}
+
+class make_invoice(wizard.interface):
+ states = {
+ 'init' : {
+ 'actions' : [_values],
+ 'result' : {'type' : 'form',
+ 'arch' : invoice_form,
+ 'fields' : invoice_fields,
+ 'state' : [('end', 'Cancel'),('invoice', 'Create invoices')]}
+ },
+ 'invoice' : {
+ 'actions' : [],
+ 'result' : {'type' : 'action',
+ 'action' : _makeInvoices}
+ },
+ }
+make_invoice("auction.lots.make_invoice_buyer")
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/auction/wizard/wizard_auction_journal.py b/addons/auction/wizard/wizard_auction_journal.py
new file mode 100644
index 00000000000..79329592165
--- /dev/null
+++ b/addons/auction/wizard/wizard_auction_journal.py
@@ -0,0 +1,105 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+
+import wizard
+import netsvc
+import pooler
+
+
+
+invoice_form = '''
+'''
+
+invoice_fields = {
+ 'amount': {'string':'Invoiced Amount', 'type':'float', 'required':True, 'readonly':True},
+ 'objects': {'string':'# of objects', 'type':'integer', 'required':True, 'readonly':True},
+ 'number': {'string':'Invoice Number', 'type':'integer'},
+}
+
+def _values(self,cr,uid, datas,context={}):
+ lots= pooler.get_pool(cr.dbname).get('auction.lots').browse(cr,uid,datas['ids'])
+# service = netsvc.LocalService("object_proxy")
+# lots = service.execute(cr,uid, 'auction.lots', 'read', datas['ids'])
+# auction = service.execute(cr,uid, 'auction.dates', 'read', [lots[0]['auction_id'][0]])[0]
+ price = 0.0
+ amount_total=0.0
+ pt_tax=pooler.get_pool(cr.dbname).get('account.tax')
+ for lot in lots:
+ # taxes = lot.product_id.taxes_id
+ # if lot.bord_vnd_id.tax_id:
+ # taxes.append(lot.bord_vnd_id.tax_id)
+ # if lot.auction_id:
+ # taxes += lot.auction_id.seller_costs
+ # tax=pt_tax.compute(cr,uid,taxes,lot.obj_price,1)
+ # for t in tax:
+ # amount_total+=t['amount']
+ # amount_total+=lot.obj_price
+ amount_total+=lot.seller_price
+#TODO: recuperer id next invoice (de la sequence)???
+ invoice_number = False
+ return {'objects':len(datas['ids']), 'amount':amount_total, 'number':invoice_number}
+
+def _makeInvoices(self, cr, uid, data, context):
+
+ pool = pooler.get_pool(cr.dbname)
+ order_obj = pool.get('auction.lots')
+ mod_obj = pool.get('ir.model.data')
+ result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
+ id = mod_obj.read(cr, uid, result, ['res_id'])
+ newinv = []
+ ids = order_obj.seller_trans_create(cr, uid, data['ids'],context)
+ cr.commit()
+ return {
+ 'domain': "[('id','in', ["+','.join(map(str, ids))+"])]",
+ 'name': 'Seller invoices',
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'account.invoice',
+ 'view_id': False,
+ 'context': "{'type':'out_refund'}",
+ 'type': 'ir.actions.act_window',
+ 'search_view_id': id['res_id']
+ }
+ return {}
+
+class make_invoice(wizard.interface):
+ states = {
+ 'init' : {
+ 'actions' : [_values],
+ 'result' : {'type' : 'form',
+ 'arch' : invoice_form,
+ 'fields' : invoice_fields,
+ 'state' : [('end', 'Cancel'),('invoice', 'Create invoices')]}
+ },
+ 'invoice' : {
+ 'actions' : [_makeInvoices],
+ 'result' : {'type' : 'action',
+ 'action' : _makeInvoices,
+ 'state' : 'end'}
+ },
+ }
+make_invoice("auction.lots.make_invoice")
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/auction/wizard/wizard_emporte.py b/addons/auction/wizard/wizard_emporte.py
new file mode 100644
index 00000000000..1172404e218
--- /dev/null
+++ b/addons/auction/wizard/wizard_emporte.py
@@ -0,0 +1,73 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+
+import wizard
+import netsvc
+
+import pooler
+from tools.misc import UpdateableStr
+
+
+# Dossier
+
+_lot_arch = """
+
+"""
+_lot_fields = {
+ 'lot_ids': {'string':'Lots Emportes','relation':'auction.lots','type':'many2many'}
+}
+
+def _to_xml(s):
+ return s.replace('&','&').replace('<','<').replace('>','>')
+
+def _process(self, cr, uid, data, context):
+ pool = pooler.get_pool(cr.dbname)
+ lot_obj = pool.get('auction.lots')
+ if data['form']['lot_ids']:
+ lot_obj.write(cr, uid, data['form']['lot_ids'][0][2], {'state':'taken_away'})
+ return {'lot_ids': []}
+
+class wizard_reprint(wizard.interface):
+ states = {
+ 'valid': {
+ 'actions': [_process],
+ 'result': {'type':'state', 'state':'init'}
+ },
+ 'init': {
+ 'actions': [],
+ 'result': {
+ 'type':'form',
+ 'arch': _lot_arch,
+ 'fields': _lot_fields,
+ 'state': [
+ ('valid',' OK ')
+ ],
+ }
+ }
+ }
+wizard_reprint('auction.taken')
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/auction/wizard/wizard_lot_date_move.py b/addons/auction/wizard/wizard_lot_date_move.py
new file mode 100644
index 00000000000..e6e13ea0ab2
--- /dev/null
+++ b/addons/auction/wizard/wizard_lot_date_move.py
@@ -0,0 +1,96 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+
+import wizard
+import netsvc
+import pooler
+import sql_db
+
+auction_move = '''
+'''
+
+auction_move_fields = {
+ 'auction_id': {'string':'Auction Date', 'type':'many2one', 'required':True, 'relation':'auction.dates'},
+}
+
+#def _auction_move_set(self, uid, datas):
+# if datas['form']['auction_id']:
+# cr = sql_db.db.cursor()
+# cr.execute('update auction_lots set auction_id=%s, obj_price=NULL, ach_login=NULL, ach_uid=NULL, ach_pay_id=NULL, ach_inv_id=NULL, state=%s where id in ('+','.join(map(str, datas['ids']))+')', (str(datas['form']['auction_id']), 'draft'))
+# cr.execute('delete from auction_bid_line where lot_id in ('+','.join(map(str, datas['ids']))+')')
+# cr.commit()
+# cr.close()
+# return {}
+def _top(self,cr,uid,datas,context={}):
+ refs = pooler.get_pool(cr.dbname).get('auction.lots')
+ rec_ids = refs.browse(cr,uid,datas['ids'])
+ for rec in rec_ids:
+ if not rec.auction_id:
+ raise wizard.except_wizard('Error !','You can not move a lot that has no auction date')
+ return {}
+def _auction_move_set(self,cr,uid,datas,context={}):
+ if not (datas['form']['auction_id'] and len(datas['ids'])) :
+ return {}
+ refs = pooler.get_pool(cr.dbname).get('auction.lots')
+ rec_ids = refs.browse(cr,uid,datas['ids'])
+
+ line_ids= pooler.get_pool(cr.dbname).get('auction.bid_line').search(cr,uid,[('lot_id','in',datas['ids'])])
+# pooler.get_pool(cr.dbname).get('auction.bid_line').unlink(cr, uid, line_ids)
+ for rec in rec_ids:
+ new_id=pooler.get_pool(cr.dbname).get('auction.lot.history').create(cr,uid,{
+ 'auction_id':rec.auction_id.id,
+ 'lot_id':rec.id,
+ 'price': rec.obj_ret
+ })
+ up_auction=pooler.get_pool(cr.dbname).get('auction.lots').write(cr,uid,[rec.id],{
+ 'auction_id':datas['form']['auction_id'],
+ 'obj_ret':None,
+ 'obj_price':None,
+ 'ach_login':None,
+ 'ach_uid':None,
+ 'ach_inv_id':None,
+ 'sel_inv_id':None,
+ 'obj_num':None,
+ 'state':'draft'})
+ return {}
+
+class wiz_auc_lots_auction_move(wizard.interface):
+ states = {
+ 'init': {
+ 'actions': [_top],
+ 'result': {'type': 'form', 'arch':auction_move, 'fields': auction_move_fields, 'state':[('set_date', 'Move to Auction date'),('end','Cancel')]}
+ },
+ 'set_date': {
+ 'actions': [_auction_move_set],
+ 'result': {'type': 'state', 'state':'end'}
+ }
+ }
+
+wiz_auc_lots_auction_move('auction.lots.auction_move')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/auction/wizard/wizard_lots_pay.py b/addons/auction/wizard/wizard_lots_pay.py
new file mode 100644
index 00000000000..a6b8f635ba4
--- /dev/null
+++ b/addons/auction/wizard/wizard_lots_pay.py
@@ -0,0 +1,103 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+
+import wizard
+import netsvc
+import netsvc
+import osv
+import time
+import pooler
+
+invoice_form = '''
+'''
+
+invoice_fields = {
+ 'amount': {'string': 'Amount paid', 'type':'float', 'required':True},
+ 'dest_account_id': {'string':'Payment to Account', 'type':'many2one', 'required':True, 'relation':'account.account', 'domain':[('type','=','cash')]},
+ 'journal_id': {'string': 'Journal', 'type': 'many2one', 'relation':'account.journal', 'required':True},
+ 'period_id': {'string': 'Period', 'type': 'many2one', 'relation':'account.period', 'required':True},
+}
+#def pay_n_check(self, cr, uid, data, context):
+#
+# auction = pool.get('auction.lots').browse(cr,uid,data['id'],context)
+# try:
+#
+# for lot in auction:
+#
+# if not lot.auction_id :
+# raise osv.except_osv("Error","No payment defined for this auction.")
+# i=1
+# tot= 0
+# for payment in auction:
+# if not payment.journal_id :
+# raise osv.except_osv("Error","No journal defined for the payment line %d" % (i,))
+# if not payment.ach_inv_id.amount :
+# raise osv.except_osv("Error","No amount defined for the payment line %d." % (i,))
+# i+=1
+# tot+= payment.ach_inv_id.amount
+# if abs(float(tot)) - abs(float(lot.obj_ret)) > 10**-6:
+# raise osv.except_osv("Error","The amount paid does not match the total amount")
+# else:
+# for lot in auction:
+# if not lot.journal_id :
+# raise osv.except_osv("Error","Please choose a journal for the auction ("+lot.name+").")
+# pool.get('auction.lots').create(cr,uid,{
+# 'auction_id': lot.auction.id,
+# 'journal_id': lot.journal_id,
+#
+# })
+# except osv.except_osv, e:
+# raise wizard.except_wizard(e.name, e.name)
+# return True
+def _pay_and_reconcile(self, cr, uid, data, context):
+
+ pool = pooler.get_pool(cr.dbname)
+ lot = pool.get('auction.lots').browse(cr,uid,data['id'],context)
+ form = data['form']
+ account_id = form.get('writeoff_acc_id', False)
+ period_id = form.get('period_id', False)
+ journal_id = form.get('journal_id', False)
+ if lot.sel_inv_id:
+ p=pool.get('account.invoice').pay_and_reconcile(['lot.sel_inv_id.id'], form['amount'], form['dest_account_id'], journal_id, account_id, period_id, journal_id, context)
+# lots.sel_inv_id.pay_and_reconcile(cr,uid,data[id], form['amount'], form['dest_account_id'], journal_id, account_id, period_id, journal_id, context)
+ return {}
+
+
+class wiz_auc_lots_pay(wizard.interface):
+ states = {
+ 'init': {
+ 'actions': [],
+ 'result': {'type': 'form', 'arch':invoice_form, 'fields': invoice_fields, 'state':[ ('pay','Pay'), ('end','Cancel')]}
+ },
+ 'pay': {
+ 'actions': [_pay_and_reconcile],
+ 'result': {'type': 'state', 'state':'end'}
+ }}
+wiz_auc_lots_pay('auction.pay.sel');
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/auction/wizard/wizard_lots_sms.py b/addons/auction/wizard/wizard_lots_sms.py
new file mode 100644
index 00000000000..dc60a9bd24d
--- /dev/null
+++ b/addons/auction/wizard/wizard_lots_sms.py
@@ -0,0 +1,150 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+
+import wizard
+import netsvc
+
+import urllib
+
+sms_send_form = '''
+''' % ('SMS - Gateway: clickatell', 'Bulk SMS send')
+
+sms_send_fields = {
+ 'app_id': {'string':'API ID', 'type':'char', 'required':True},
+ 'user': {'string':'Login', 'type':'char', 'required':True},
+ 'password': {'string':'Password', 'type':'char', 'required':True},
+ 'text': {'string':'SMS Message', 'type':'text', 'required':True, 'value':'Les lots [lots] vous ont etes adjuges. -- Rops'}
+}
+##############################################################################
+#
+# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
+# Fabien Pinckaers
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+##############################################################################
+
+import wizard
+import netsvc
+import pooler
+
+sms_send_form = '''
+''' % ('SMS - Gateway: clickatell','Bulk SMS send')
+
+sms_send_fields = {
+ 'app_id': {'string':'API ID', 'type':'char', 'required':True},
+ 'user': {'string':'Login', 'type':'char', 'required':True},
+ 'password': {'string':'Password', 'type':'char', 'required':True},
+ 'text': {'string':'SMS Message', 'type':'text', 'required':True}
+}
+
+def _sms_send(self, cr, uid, data, context):
+ service = netsvc.LocalService("object_proxy")
+ lots = service.execute(cr.dbname,uid, 'auction.lots', 'read', data['ids'], ['obj_num','obj_price','ach_uid'])
+ res = service.execute(cr.dbname,uid, 'res.partner', 'read', [l['ach_uid'] for l in lots if l['ach_uid']], ['gsm'])
+ #res = service.execute(cr.dbname, uid, 'res.partner', 'read', data['ids'], ['gsm'])
+# service = netsvc.LocalService("object_proxy")
+# pool=pooler.get_pool(cr.dbname)
+# lots=pool.get('auction.lots').browse(cr,uid,data['id'],context)
+# r=lots.ach_uid.id
+ nbr = 0
+ for r in res:
+ to = r['mobile']
+ if to:
+ tools.smssend(data['form']['user'], data['form']['password'], data['form']['app_id'], unicode(data['form']['text'], 'utf-8').encode('latin1'), to)
+ nbr += 1
+ return {'sms_sent': nbr}
+
+ if to:
+ tools.smssend(data['form']['user'], data['form']['password'], data['form']['app_id'], unicode(data['form']['text'], 'utf-8').encode('latin1'), to)
+ nbr += 1
+ return {'sms_sent': nbr}
+#
+#def _sms_send(self, uid, datas):
+# service = netsvc.LocalService("object_proxy")
+# pool=pooler.ger_pool(cr.dbname)
+# lots=pool.get('auction.lots').browse(cr,uid,datas['ids'],context)
+# #lots = service.execute(uid, 'auction.lots', 'read', datas['ids'], ['obj_num','obj_price','ach_uid'])
+# #part = service.execute(uid, 'res.partner', 'read', [l['ach_uid'] for l in lots if l['ach_uid']], ['gsm'])
+#
+# part =ach_uid.id
+# part = map(lambda x: (x.id,x.mobile), part)
+# for l in lots:
+# part.append(str(l.obj_num)+'-%dEUR' % int(l.obj_price))
+#
+# for p in part.values():
+# to = p.mobile
+# if to:
+# params = urllib.urlencode({'user': datas['form']['user'], 'password': datas['form']['password'], 'api_id': datas['form']['app_id'], 'text':unicode(datas['form']['text'].replace('[lots]',', '.join(p['lots'])), 'utf-8').encode('latin1'), 'to':to})
+# f = urllib.urlopen("http://196.7.150.220/http/sendmsg", params)
+# nbr+=1
+# return {'sms_sent':nbr}
+
+class lots_sms(wizard.interface):
+ states = {
+ 'init': {
+ 'actions': [],
+ 'result': {'type': 'form', 'arch':sms_send_form, 'fields': sms_send_fields, 'state':[('send','Send SMS'), ('end','Cancel')]}
+ },
+ 'send': {
+ 'actions': [_sms_send],
+ 'result': {'type': 'state', 'state':'end'}
+ }
+ }
+lots_sms('auction.lots.sms_send');
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/auction/wizard/wizard_pay.py b/addons/auction/wizard/wizard_pay.py
new file mode 100644
index 00000000000..ff68c2b5b8d
--- /dev/null
+++ b/addons/auction/wizard/wizard_pay.py
@@ -0,0 +1,109 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+
+import wizard
+import netsvc
+import netsvc
+import osv
+import time
+import pooler
+pay_form = '''
+'''
+
+def _start(self,cr,uid,data,context):
+ pool = pooler.get_pool(cr.dbname)
+ rec=pool.get('auction.lots').browse(cr,uid,data['ids'],context)
+ amount1=0.0
+ for r in rec:
+ amount1+=r.buyer_price
+ buyer= r and r.ach_uid.id or False
+ if r.is_ok:
+ raise wizard.except_wizard('Error !', 'Some lots of the selection are already paid.')
+ return {'amount':amount1, 'total':amount1,'buyer_id':buyer}
+
+pay_fields = {
+ 'amount': {'string': 'Amount paid', 'type':'float'},
+ 'buyer_id': {'string': 'Buyer', 'type': 'many2one', 'relation':'res.partner'},
+ 'statement_id1': {'string':'Statement', 'type':'many2one', 'required':True, 'relation':'account.bank.statement'},
+ 'amount2': {'string': 'Amount paid', 'type':'float'},
+ 'statement_id2': {'string':'Statement', 'type':'many2one', 'relation':'account.bank.statement'},
+ 'amount3': {'string': 'Amount paid', 'type':'float'},
+ 'statement_id3': {'string':'Statement', 'type':'many2one', 'relation':'account.bank.statement'},
+ 'total': {'string': 'Amount to paid', 'type':'float','readonly':True}
+}
+
+def _pay_and_reconcile(self, cr, uid, data, context):
+ if not abs(data['form']['total'] - (data['form']['amount']+data['form']['amount2']+data['form']['amount3']))<0.01:
+ rest=data['form']['total']-(data['form']['amount']+data['form']['amount2']+data['form']['amount3'])
+ raise wizard.except_wizard('Payment aborted !', 'You should pay all the total: "%.2f" are missing to accomplish the payment.' %(round(rest,2)))
+
+ pool = pooler.get_pool(cr.dbname)
+ lots = pool.get('auction.lots').browse(cr,uid,data['ids'],context)
+ ref_bk_s=pooler.get_pool(cr.dbname).get('account.bank.statement.line')
+
+ for lot in lots:
+ if data['form']['buyer_id']:
+ pool.get('auction.lots').write(cr,uid,[lot.id],{'ach_uid':data['form']['buyer_id']})
+ if not lot.auction_id:
+ raise wizard.except_wizard('Error !', 'No auction date for "%s": Please set one.'%(lot.name))
+ pool.get('auction.lots').write(cr,uid,[lot.id],{'is_ok':True})
+
+ for st,stamount in [('statement_id1','amount'),('statement_id2','amount2'),('statement_id3','amount3')]:
+ if data['form'][st]:
+ new_id=ref_bk_s.create(cr,uid,{
+ 'name':'Buyer:'+str(lot.ach_login or '')+', auction:'+ lots[0].auction_id.name,
+ 'date': time.strftime('%Y-%m-%d'),
+ 'partner_id':data['form']['buyer_id'] or False,
+ 'type':'customer',
+ 'statement_id':data['form'][st],
+ 'account_id':lot.auction_id.acc_income.id,
+ 'amount':data['form'][stamount]
+ })
+ for lot in lots:
+ pool.get('auction.lots').write(cr,uid,[lot.id],{'statement_id':[(4,new_id)]})
+ return {}
+
+
+class wiz_auc_lots_pay(wizard.interface):
+ states = {
+ 'init': {
+ 'actions': [_start],
+ 'result': {'type': 'form', 'arch':pay_form, 'fields': pay_fields, 'state':[('end','Cancel'),('pay','Pay')]}
+ },
+ 'pay': {
+ 'actions': [_pay_and_reconcile],
+ 'result': {'type': 'state', 'state':'end'}
+ }}
+wiz_auc_lots_pay('auction.pay.buy')
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/auction/wizard/wizard_payer.py b/addons/auction/wizard/wizard_payer.py
new file mode 100644
index 00000000000..6e224fbadad
--- /dev/null
+++ b/addons/auction/wizard/wizard_payer.py
@@ -0,0 +1,79 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+
+import wizard
+import netsvc
+import netsvc
+import osv
+import time
+import pooler
+
+pay_form = '''
+'''
+pay_fields = {
+}
+
+
+pay_form1 = '''
+'''
+pay_fields1 = {
+}
+def _payer(self, cr, uid, data, context):
+ pool = pooler.get_pool(cr.dbname)
+ pool.get('auction.lots').write(cr,uid,data['ids'],{'is_ok':True, 'state':'paid'})
+ return {}
+
+
+def _payer_sel(self, cr, uid, data, context):
+ pool = pooler.get_pool(cr.dbname)
+ pool.get('auction.lots').write(cr,uid,data['ids'],{'paid_vnd':True})
+ return {}
+
+
+class wiz_auc_pay(wizard.interface):
+ states = {
+ 'init': {
+ 'actions': [],
+ 'result': {'type': 'form', 'arch':pay_form, 'fields': pay_fields, 'state':[('end','Cancel'),('pay','Pay')]}
+ },
+ 'pay': {
+ 'actions': [_payer],
+ 'result': {'type': 'state', 'state':'end'}
+ }}
+wiz_auc_pay('auction.payer')
+
+
+class wiz_auc_pay_sel(wizard.interface):
+ states = {
+ 'init': {
+ 'actions': [],
+ 'result': {'type': 'form', 'arch':pay_form1, 'fields': pay_fields1, 'state':[('end','Cancel'),('pay2','Pay')]}
+ },
+ 'pay2': {
+ 'actions': [_payer_sel],
+ 'result': {'type': 'state', 'state':'end'}
+ }}
+wiz_auc_pay_sel('auction.payer.sel')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/base_module_record/base_module_record.py b/addons/base_module_record/base_module_record.py
index 91ba7b8782c..1bea209cd78 100644
--- a/addons/base_module_record/base_module_record.py
+++ b/addons/base_module_record/base_module_record.py
@@ -111,15 +111,19 @@ class base_module_record(osv.osv):
return obj.module+'.'+obj.name, obj.noupdate
def _create_record(self, cr, uid, doc, model, data, record_id, noupdate=False):
+
+ data_pool = self.pool.get('ir.model.data')
+ model_pool = self.pool.get(model)
+
record = doc.createElement('record')
record.setAttribute("id", record_id)
record.setAttribute("model", model)
record_list = [record]
- lids = self.pool.get('ir.model.data').search(cr, uid, [('model','=',model)])
- res = self.pool.get('ir.model.data').read(cr, uid, lids[:1], ['module'])
+ lids = data_pool.search(cr, uid, [('model','=',model)])
+ res = data_pool.read(cr, uid, lids[:1], ['module'])
if res:
self.depends[res[0]['module']]=True
- fields = self.pool.get(model).fields_get(cr, uid)
+ fields = model_pool.fields_get(cr, uid)
for key,val in data.items():
if not (val or (fields[key]['type']=='boolean')):
continue
@@ -142,9 +146,11 @@ class base_module_record(osv.osv):
id,update = self._get_id(cr, uid, fields[key]['relation'], val)
noupdate = noupdate or update
if not id:
+ relation_pool = self.pool.get(fields[key]['relation'])
+
field.setAttribute("model", fields[key]['relation'])
- fld_nm = self.pool.get(fields[key]['relation'])._rec_name
- name = self.pool.get(fields[key]['relation']).read(cr, uid, val,[fld_nm])[fld_nm] or False
+ fld_nm = relation_pool._rec_name
+ name = relation_pool.read(cr, uid, val,[fld_nm])[fld_nm] or False
field.setAttribute("search", str([(str(fld_nm) ,'=', name)]))
else:
field.setAttribute("ref", id)
@@ -152,10 +158,10 @@ class base_module_record(osv.osv):
elif fields[key]['type'] in ('one2many',):
for valitem in (val or []):
if valitem[0] in (0,1):
- if key in self.pool.get(model)._columns:
- fname = self.pool.get(model)._columns[key]._fields_id
+ if key in model_pool._columns:
+ fname = model_pool._columns[key]._fields_id
else:
- fname = self.pool.get(model)._inherit_fields[key][2]._fields_id
+ fname = model_pool._inherit_fields[key][2]._fields_id
valitem[2][fname] = record_id
newid,update = self._get_id(cr, uid, fields[key]['relation'], valitem[1])
if not newid:
@@ -190,14 +196,18 @@ class base_module_record(osv.osv):
def _create_yaml_record(self, cr, uid, model, data, record_id):
record={'model': model, 'id': str(record_id)}
- lids = self.pool.get('ir.model.data').search(cr, uid, [('model','=',model)])
- res = self.pool.get('ir.model.data').read(cr, uid, lids[:1], ['module'])
+
+ model_pool = self.pool.get(model)
+ data_pool = self.pool.get('ir.model.data')
+
+ lids = data_pool.search(cr, uid, [('model','=',model)])
+ res = data_pool.read(cr, uid, lids[:1], ['module'])
attrs={}
if res:
self.depends[res[0]['module']]=True
- fields = self.pool.get(model).fields_get(cr, uid)
+ fields = model_pool.fields_get(cr, uid)
defaults={}
- defaults[model] = self.pool.get(model).default_get(cr, uid, data)
+ defaults[model] = model_pool.default_get(cr, uid, data)
for key,val in data.items():
if ((key in defaults[model]) and (val == defaults[model][key])) and not(fields[key].get('required',False)):
continue
@@ -210,19 +220,19 @@ class base_module_record(osv.osv):
elif fields[key]['type'] in ('integer','float'):
attrs[key] = val
elif fields[key]['type'] in ('many2one',):
- if type(val) in (type(''),type(u'')):
+ if type(val) in (type(''), type(u'')):
id = val
else:
- id,update = self._get_id(cr, uid, fields[key]['relation'], val)
+ id, update = self._get_id(cr, uid, fields[key]['relation'], val)
attrs[key] = str(id)
elif fields[key]['type'] in ('one2many',):
items=[[]]
for valitem in (val or []):
if valitem[0] in (0,1):
- if key in self.pool.get(model)._columns:
- fname = self.pool.get(model)._columns[key]._fields_id
+ if key in model_pool._columns:
+ fname = model_pool._columns[key]._fields_id
else:
- fname = self.pool.get(model)._inherit_fields[key][2]._fields_id
+ fname = model_pool._inherit_fields[key][2]._fields_id
valitem[2][fname] = record_id
newid,update = self._get_id(cr, uid, fields[key]['relation'], valitem[1])
if not newid:
diff --git a/addons/crm/__terp__.py b/addons/crm/__terp__.py
index bf14aab0eb6..26d80adaf68 100644
--- a/addons/crm/__terp__.py
+++ b/addons/crm/__terp__.py
@@ -66,7 +66,7 @@ between mails and Open ERP.""",
'wizard/crm_phonecall2phonecall.xml',
'wizard/phonecall2meeting.xml',
'wizard/phonecall2partner_view.xml',
- 'wizard/phonecall2opportunity.xml',
+ 'wizard/crm_phonecall_to_opportunity_view.xml',
'wizard/crm_opportunity_to_meeting_view.xml',
'wizard/crm_opportunity_to_phonecall_view.xml',
'crm_wizard.xml',
diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py
index 6424030dc66..63bb4670711 100644
--- a/addons/crm/crm_lead.py
+++ b/addons/crm/crm_lead.py
@@ -65,7 +65,7 @@ class crm_lead(osv.osv):
_columns = {
'categ_id': fields.many2one('crm.case.categ', 'Lead Source', domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.opportunity')]"),
'type_id': fields.many2one('crm.case.resource.type', 'Lead Type', domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.lead')]"),
- 'partner_name': fields.char("Lead Name", size=64),
+ 'partner_name': fields.char("Contact Name", size=64),
'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'),
'date_closed': fields.datetime('Closed', readonly=True),
@@ -78,6 +78,7 @@ class crm_lead(osv.osv):
method=True, type="integer", store=True),
'day_close': fields.function(_compute_closeday, string='Days to Close', \
method=True, type="integer", store=True),
+ 'function_name' : fields.char('Function', size=64),
}
_defaults = {
diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml
index c884ad7afc7..9b040763809 100644
--- a/addons/crm/crm_lead_view.xml
+++ b/addons/crm/crm_lead_view.xml
@@ -42,7 +42,7 @@
-
-
+
+
project.task.caldav.form1project.task
@@ -58,8 +58,8 @@
-
-
+
+
project.task.caldav.form2project.task
@@ -68,8 +68,10 @@
-
+-->
-
+
project.task.caldav.form3project.task
@@ -94,6 +96,6 @@
-
+
diff --git a/addons/project_issue/__terp__.py b/addons/project_issue/__terp__.py
index 05a94ba809b..03ec9e22285 100644
--- a/addons/project_issue/__terp__.py
+++ b/addons/project_issue/__terp__.py
@@ -30,7 +30,11 @@
""",
'author': 'Tiny',
'website': 'http://www.openerp.com',
- 'depends': ['crm','project'],
+ 'depends': [
+ 'crm',
+ 'project',
+ 'hr_timesheet_sheet',
+ ],
'init_xml': [
'project_issue_data.xml'
],
diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py
index cfb6961d112..7877e76a8dd 100644
--- a/addons/project_issue/project_issue.py
+++ b/addons/project_issue/project_issue.py
@@ -76,8 +76,6 @@ class project_issue(osv.osv):
_columns = {
'date_closed': fields.datetime('Closed', readonly=True),
'date': fields.datetime('Date'),
- 'ref' : fields.reference('Reference', selection=crm._links_get, size=128),
- 'ref2' : fields.reference('Reference 2', selection=crm._links_get, size=128),
'canal_id': fields.many2one('res.partner.canal', 'Channel',help="The channels represent the different communication modes available with the customer." \
" With each commercial opportunity, you can indicate the canall which is this opportunity source."),
'planned_revenue': fields.float('Planned Revenue'),
@@ -95,12 +93,16 @@ class project_issue(osv.osv):
'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="[('object_id.model', '=', 'project.issue')]"),
'project_id':fields.many2one('project.project', 'Project'),
'duration': fields.float('Duration'),
- 'probability': fields.float('Probability (%)'),
'task_id': fields.many2one('project.task', 'Task', domain="[('project_id','=',project_id)]"),
'day_open': fields.function(_compute_openday, string='Days to Open', \
method=True, type="integer", store=True),
'day_close': fields.function(_compute_closeday, string='Days to Close', \
method=True, type="integer", store=True),
+ 'assigned_to' : fields.many2one('res.users', 'Assigned to'),
+ 'timesheet_ids' : fields.one2many('hr.analytic.timesheet', 'issue_id', 'Timesheets'),
+ 'analytic_account_id' : fields.many2one('account.analytic.account', 'Analytic Account',
+ domain="[('partner_id', '=', partner_id)]",
+ required=True),
}
def _get_project(self, cr, uid, context):
@@ -134,11 +136,25 @@ class project_issue(osv.osv):
return {'value':{'probability':stage.probability}}
_defaults = {
- 'project_id':_get_project,
- 'probability':lambda *a:0.0,
- 'planned_cost':lambda *a:0.0,
- 'planned_revenue':lambda *a:0.0,
- }
+ 'project_id':_get_project,
+ }
project_issue()
+class account_analytic_line(osv.osv):
+ _inherit = 'account.analytic.line'
+ _columns = {
+ 'create_date' : fields.datetime('Create Date', readonly=True),
+ }
+
+account_analytic_line()
+
+class hr_analytic_issue(osv.osv):
+ _inherit = 'hr.analytic.timesheet'
+
+ _columns = {
+ 'issue_id' : fields.many2one('project.issue', 'Issue'),
+ }
+
+hr_analytic_issue()
+
diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml
index 8d6bbae0b5a..57c1bf4fa43 100644
--- a/addons/project_issue/project_issue_view.xml
+++ b/addons/project_issue/project_issue_view.xml
@@ -1,308 +1,301 @@
+
+ Issue Categories
+ crm.case.categ
+ form
+
+ [('object_id.model', '=', 'project.issue')]
+ {'object_id':'project.issue'}
+
- # ------------------------------------------------------
- # Issue Categories
- # ------------------------------------------------------
+
+ Issue Stages
+ crm.case.stage
+ form
+
+ [('object_id.model', '=', 'project.issue')]
+ {'object_id':'project.issue'}
+
+
-
-
- Issue Categories
- crm.case.categ
- form
-
- [('object_id.model', '=', 'project.issue')]
- {'object_id':'project.issue'}
-
- # ------------------------------------------------------
- # Stage
- # ------------------------------------------------------
-
- Issue Stages
- crm.case.stage
- form
-
- [('object_id.model', '=', 'project.issue')]
- {'object_id':'project.issue'}
-
-
-
-
- Project Issue Tracker Form
- project.issue
- form
-
-
-
-
-
-
-
-
-
+
+ Project Issue Tracker Form
+ project.issue
+ form
+
+
+"""
+fields_msg = {}
+
+def _createInvoices(self, cr, uid, data, context={}):
+ list_inv = []
+ pool_obj = pooler.get_pool(cr.dbname)
+ obj_sale = pool_obj.get('sale.order')
+ data_sale = obj_sale.browse(cr,uid,data['ids'])
+ obj_lines = pool_obj.get('account.invoice.line')
+ for sale in data_sale:
+ address_contact = False
+ address_invoice = False
+ create_ids = []
+ ids_inv = []
+ if sale.order_policy == 'postpaid':
+ raise osv.except_osv(
+ _('Error'),
+ _("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, [], data['form']['product_id'],uom = False, partner_id = sale.partner_id.id, fposition_id=sale.fiscal_position.id)
+ line_id =obj_lines.create(cr, uid, {
+ 'name': val['value']['name'],
+ 'account_id':val['value']['account_id'],
+ 'price_unit': data['form']['amount'],
+ 'quantity': data['form']['qtty'],
+ 'discount': False,
+ 'uos_id': val['value']['uos_id'],
+ 'product_id':data['form']['product_id'],
+ 'invoice_line_tax_id': [(6,0,val['value']['invoice_line_tax_id'])],
+ 'account_analytic_id': sale.project_id and sale.project_id.id or False,
+ 'note':'',
+ })
+ create_ids.append(line_id)
+ inv = {
+ 'name': sale.name,
+ 'origin': sale.name,
+ 'type': 'out_invoice',
+ 'reference': False,
+ 'account_id': sale.partner_id.property_account_receivable.id,
+ 'partner_id': sale.partner_id.id,
+ 'address_invoice_id':sale.partner_invoice_id.id,
+ 'address_contact_id':sale.partner_order_id.id,
+ 'invoice_line': [(6,0,create_ids)],
+ 'currency_id' :sale.pricelist_id.currency_id.id,
+ 'comment': '',
+ 'payment_term':sale.payment_term.id,
+ 'fiscal_position': sale.partner_id.property_account_position.id
+ }
+ inv_obj = pool_obj.get('account.invoice')
+ inv_id = inv_obj.create(cr, uid, inv)
+
+ for inv in sale.invoice_ids:
+ ids_inv.append(inv.id)
+ ids_inv.append(inv_id)
+ obj_sale.write(cr,uid,sale.id,{'invoice_ids':[(6,0,ids_inv)]})
+ list_inv.append(inv_id)
+#
+# If invoice on picking: add the cost on the SO
+# If not, the advance will be deduced when generating the final invoice
+#
+ if sale.order_policy=='picking':
+ pool_obj.get('sale.order.line').create(cr, uid, {
+ 'order_id': sale.id,
+ 'name': val['value']['name'],
+ 'price_unit': -data['form']['amount'],
+ 'product_uom_qty': data['form']['qtty'],
+ 'product_uos_qty': data['form']['qtty'],
+ 'product_uos': val['value']['uos_id'],
+ 'product_uom': val['value']['uos_id'],
+ 'product_id':data['form']['product_id'],
+ 'discount': False,
+ 'tax_id': [(6,0,val['value']['invoice_line_tax_id'])],
+ }, context)
+ return {'invoice_ids':list_inv}
+
+class sale_advance_payment(wizard.interface):
+ def _open_invoice(self, cr, uid, data, context):
+ pool_obj = pooler.get_pool(cr.dbname)
+ mod_obj = pool_obj.get('ir.model.data')
+ result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
+ id = mod_obj.read(cr, uid, result, ['res_id'])
+ model_data_ids = pool_obj.get('ir.model.data').search(cr,uid,[('model','=','ir.ui.view'),('name','=','invoice_form')])
+ resource_id = pool_obj.get('ir.model.data').read(cr,uid,model_data_ids,fields=['res_id'])[0]['res_id']
+ return {
+ 'domain': "[('id','in', ["+','.join(map(str,data['form']['invoice_ids']))+"])]",
+ 'name': 'Invoices',
+ 'view_type': 'form',
+ 'view_mode': 'tree,form',
+ 'res_model': 'account.invoice',
+ 'views': [(False,'tree'),(resource_id,'form')],
+ 'context': "{'type':'out_invoice'}",
+ 'type': 'ir.actions.act_window',
+ 'search_view_id': id['res_id']
+ }
+
+ states = {
+ 'init' : {
+ 'actions' : [],
+ 'result' : {'type' : 'form' , 'arch' : form,'fields' : fields,'state' : [('end','Cancel','gtk-cancel'),('create','Create Advance Invoice','gtk-ok')]}
+ },
+ 'create': {
+ 'actions': [_createInvoices],
+ 'result': {'type' : 'form' ,'arch' : form_msg,'fields' : fields_msg, 'state':[('end','Close','gtk-close'),('open','Open Advance Invoice','gtk-open')]}
+ },
+ 'open': {
+ 'actions': [],
+ 'result': {'type':'action', 'action':_open_invoice, 'state':'end'}
+ }
+ }
+
+sale_advance_payment("sale.advance_payment_inv")
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/sale/wizard/sale_line_invoice.py b/addons/sale/wizard/sale_line_invoice.py
deleted file mode 100644
index 7dd7fef78cb..00000000000
--- a/addons/sale/wizard/sale_line_invoice.py
+++ /dev/null
@@ -1,100 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-from osv import fields, osv
-from service import web_services
-import wizard
-import netsvc
-import ir
-import pooler
-
-class sale_order_line_make_invoice(osv.osv_memory):
- _name = "sale.order.line.make.invoice"
- _description = "Sale OrderLine Make_invoice"
- _columns = {
- 'grouped': fields.boolean('Group the invoices'),
- }
- _default = {
- 'grouped' : lambda *a: False
- }
-
- def makeInvoices(self, cr, uid, ids, context):
- res = False
- invoices = {}
-
- #TODO: merge with sale.py/make_invoice
- def make_invoice(order, lines):
- a = order.partner_id.property_account_receivable.id
- if order.partner_id and order.partner_id.property_payment_term.id:
- pay_term = order.partner_id.property_payment_term.id
- else:
- pay_term = False
- inv = {
- 'name': order.name,
- 'origin': order.name,
- 'type': 'out_invoice',
- 'reference': "P%dSO%d" % (order.partner_id.id, order.id),
- 'account_id': a,
- 'partner_id': order.partner_id.id,
- 'address_invoice_id': order.partner_invoice_id.id,
- 'address_contact_id': order.partner_invoice_id.id,
- 'invoice_line': [(6,0,lines)],
- 'currency_id' : order.pricelist_id.currency_id.id,
- 'comment': order.note,
- 'payment_term': pay_term,
- 'fiscal_position': order.partner_id.property_account_position.id
- }
- inv_id = self.pool.get('account.invoice').create(cr, uid, inv)
- return inv_id
-
- for line in self.pool.get('sale.order.line').browse(cr,uid,context['active_ids']):
- if (not line.invoiced) and (line.state not in ('draft','cancel')):
- if not line.order_id.id in invoices:
- invoices[line.order_id.id] = []
- line_id = self.pool.get('sale.order.line').invoice_line_create(cr, uid,
- [line.id])
- for lid in line_id:
- invoices[line.order_id.id].append((line, lid))
- self.pool.get('sale.order.line').write(cr, uid, [line.id],
- {'invoiced': True})
- flag = True
- data_sale = self.pool.get('sale.order').browse(cr,uid,line.order_id.id)
- for line in data_sale.order_line:
- if not line.invoiced:
- flag = False
- break
- if flag:
- wf_service = netsvc.LocalService('workflow')
- wf_service.trg_validate(uid, 'sale.order', line.order_id.id, 'all_lines', cr)
- self.pool.get('sale.order').write(cr,uid,[line.order_id.id],{'state' : 'progress'})
-
- for result in invoices.values():
- order = result[0][0].order_id
- il = map(lambda x: x[1], result)
- res = make_invoice(order, il)
- cr.execute('INSERT INTO sale_order_invoice_rel \
- (order_id,invoice_id) values (%s,%s)', (order.id, res))
- return {}
-
-
-sale_order_line_make_invoice()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/sale/wizard/sale_line_invoice.xml b/addons/sale/wizard/sale_line_invoice.xml
deleted file mode 100644
index 823b5a04662..00000000000
--- a/addons/sale/wizard/sale_line_invoice.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
- Sale OrderLine Make Invoice
- sale.order.line.make.invoice
- form
-
-
-
-
-
-
-
-
-
-
-
-
- Make Invoices
- ir.actions.act_window
- sale.order.line.make.invoice
- form
- form
- new
- {'record_id' : active_id}
-
-
-
-
-
- Make Invoices
- client_action_multi
-
- action
- sale.order.line
-
-
-
-
\ No newline at end of file
diff --git a/addons/sale/wizard/sale_make_invoice_advance.py b/addons/sale/wizard/sale_make_invoice_advance.py
deleted file mode 100644
index 9a079c4f8ec..00000000000
--- a/addons/sale/wizard/sale_make_invoice_advance.py
+++ /dev/null
@@ -1,154 +0,0 @@
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-from osv import fields, osv
-from service import web_services
-from tools.translate import _
-import ir
-import netsvc
-import pooler
-import wizard
-
-
-class sale_advance_payment_inv(osv.osv_memory):
- _name = "sale.advance.payment.inv"
- _description = "Sale Advance Payment Invoice"
- _columns = {
- 'product_id': fields.many2one('product.product', 'Product', required=True),
- 'amount': fields.float('Unit Price', size=(16, 2), required=True),
- 'qtty': fields.float('Quantity', size=(16, 2), required=True),
- }
- _default = {
- 'qtty' : lambda *a: 1
- }
- def createInvoices(self, cr, uid, ids, context={}):
- list_inv = []
- obj_sale = self.pool.get('sale.order')
- obj_lines = self.pool.get('account.invoice.line')
- for sale_adv_obj in self.browse(cr, uid, ids):
- for sale in obj_sale.browse(cr, uid, context['active_ids']):
- address_contact = False
- address_invoice = False
- create_ids = []
- ids_inv = []
- if sale.order_policy == 'postpaid':
- raise osv.except_osv(
- _('Error'),
- _("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)
- line_id =obj_lines.create(cr, uid, {
- 'name': val['value']['name'],
- 'account_id': val['value']['account_id'],
- 'price_unit': sale_adv_obj.amount,
- 'quantity': sale_adv_obj.qtty,
- 'discount': False,
- 'uos_id': val['value']['uos_id'],
- 'product_id': sale_adv_obj.product_id.id,
- 'invoice_line_tax_id': [(6, 0, val['value']['invoice_line_tax_id'])],
- 'account_analytic_id': sale.project_id.id or False,
- #'note':'',
- })
- create_ids.append(line_id)
- inv = {
- 'name': sale.name,
- 'origin': sale.name,
- 'type': 'out_invoice',
- 'reference': False,
- 'account_id': sale.partner_id.property_account_receivable.id,
- 'partner_id': sale.partner_id.id,
- 'address_invoice_id':sale.partner_invoice_id.id,
- 'address_contact_id':sale.partner_order_id.id,
- 'invoice_line': [(6, 0, create_ids)],
- 'currency_id' :sale.pricelist_id.currency_id.id,
- 'comment': '',
- 'payment_term':sale.payment_term.id,
- 'fiscal_position': sale.partner_id.property_account_position.id
- }
- inv_obj = self.pool.get('account.invoice')
- inv_id = inv_obj.create(cr, uid, inv)
-
- for inv in sale.invoice_ids:
- ids_inv.append(inv.id)
- ids_inv.append(inv_id)
- obj_sale.write(cr, uid, sale.id, {'invoice_ids':[(6, 0, ids_inv)]})
- list_inv.append(inv_id)
- #
- # If invoice on picking: add the cost on the SO
- # If not, the advance will be deduced when generating the final invoice
- #
- if sale.order_policy=='picking':
- self.pool.get('sale.order.line').create(cr, uid, {
- 'order_id': sale.id,
- 'name': val['value']['name'],
- 'price_unit': -sale_adv_obj.amount,
- 'product_uom_qty': sale_adv_obj.qtty,
- 'product_uos_qty': sale_adv_obj.qtty,
- 'product_uos': val['value']['uos_id'],
- 'product_uom': val['value']['uos_id'],
- 'product_id': sale_adv_obj.product_id.id,
- 'discount': False,
- 'tax_id': [(6, 0, val['value']['invoice_line_tax_id'])],
- }, context)
-
- return {#'invoice_ids':list_inv,
- 'name': 'Open Invoice',
- 'view_type': 'form',
- 'view_mode': 'form',
- 'res_model': 'sale.open.invoice',
- 'type': 'ir.actions.act_window',
- 'target': 'new',
- 'context': "{'invoice_ids'=%s}" % (list_inv)
- }
-
-sale_advance_payment_inv()
-
-class sale_open_invoice(osv.osv_memory):
- _name = "sale.open.invoice"
- _description = "Sale Open Invoice"
- _columns = {
- }
-
- def open_invoice(self, cr, uid, ids, context):
- mod_obj = self.pool.get('ir.model.data')
- invoices = []
- #TODO: Can not get invoice ids here
- for advance_pay in self.browse(cr, uid, ids):
- result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
- id = mod_obj.read(cr, uid, result, ['res_id'])
- model_data_ids = self.pool.get('ir.model.data').search(cr, uid,
- [('model', '=', 'ir.ui.view'), ('name', '=', 'invoice_form')])
- resource_id = self.pool.get('ir.model.data').read(cr, uid, model_data_ids,
- fields=['res_id'])[0]['res_id']
- return {
-# 'domain': "[('id','in', ["+','.join(map(str, invoices))+"])]", # TODO
- 'name': 'Invoices',
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'account.invoice',
- 'views': [(False, 'tree'), (resource_id, 'form')],
- 'context': "{'type':'out_invoice'}",
- 'type': 'ir.actions.act_window',
- 'search_view_id': id['res_id']
- }
-sale_open_invoice()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/sale/wizard/sale_make_invoice_advance.xml b/addons/sale/wizard/sale_make_invoice_advance.xml
deleted file mode 100644
index eb333f42b64..00000000000
--- a/addons/sale/wizard/sale_make_invoice_advance.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-
-
- Sale Advance Payment Invoive
- sale.advance.payment.inv
- form
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Advance Invoice
- ir.actions.act_window
- sale.advance.payment.inv
- form
- form
- new
- {'record_id' : active_id}
-
-
-
-
-
- Advance Invoice
- client_action_multi
-
- action
- sale.order
-
-
-
-
- Open Invoice
- sale.open.invoice
- form
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Open Invoice
- ir.actions.act_window
- sale.open.invoice
- form
- form
- new
-
-
-
diff --git a/addons/sale/wizard/wizard_sale_line_invoice.py b/addons/sale/wizard/wizard_sale_line_invoice.py
new file mode 100644
index 00000000000..8e1e49ab22d
--- /dev/null
+++ b/addons/sale/wizard/wizard_sale_line_invoice.py
@@ -0,0 +1,121 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+
+import wizard
+import netsvc
+import ir
+import pooler
+
+invoice_form = """
+
+
+
+
+"""
+
+invoice_fields = {
+ 'grouped' : {'string':'Group the invoices', 'type':'boolean', 'default': lambda *a: False}
+}
+
+def _makeInvoices(self, cr, uid, data, context):
+ pool = pooler.get_pool(cr.dbname)
+ res = False
+ invoices = {}
+
+ #TODO: merge with sale.py/make_invoice
+ def make_invoice(order, lines):
+ a = order.partner_id.property_account_receivable.id
+ if order.partner_id and order.partner_id.property_payment_term.id:
+ pay_term = order.partner_id.property_payment_term.id
+ else:
+ pay_term = False
+ inv = {
+ 'name': order.name,
+ 'origin': order.name,
+ 'type': 'out_invoice',
+ 'reference': "P%dSO%d" % (order.partner_id.id, order.id),
+ 'account_id': a,
+ 'partner_id': order.partner_id.id,
+ 'address_invoice_id': order.partner_invoice_id.id,
+ 'address_contact_id': order.partner_invoice_id.id,
+ 'invoice_line': [(6,0,lines)],
+ 'currency_id' : order.pricelist_id.currency_id.id,
+ 'comment': order.note,
+ 'payment_term': pay_term,
+ 'fiscal_position': order.partner_id.property_account_position.id
+ }
+ inv_id = pool.get('account.invoice').create(cr, uid, inv)
+ return inv_id
+
+ for line in pool.get('sale.order.line').browse(cr,uid,data['ids']):
+ if (not line.invoiced) and (line.state not in ('draft','cancel')):
+ if not line.order_id.id in invoices:
+ invoices[line.order_id.id] = []
+ line_id = pool.get('sale.order.line').invoice_line_create(cr, uid,
+ [line.id])
+ for lid in line_id:
+ invoices[line.order_id.id].append((line, lid))
+ pool.get('sale.order.line').write(cr, uid, [line.id],
+ {'invoiced': True})
+ flag = True
+ data_sale = pool.get('sale.order').browse(cr,uid,line.order_id.id)
+ for line in data_sale.order_line:
+ if not line.invoiced:
+ flag = False
+ break
+ if flag:
+ wf_service = netsvc.LocalService('workflow')
+ wf_service.trg_validate(uid, 'sale.order', line.order_id.id, 'all_lines', cr)
+ pool.get('sale.order').write(cr,uid,[line.order_id.id],{'state' : 'progress'})
+
+ for result in invoices.values():
+ order = result[0][0].order_id
+ il = map(lambda x: x[1], result)
+ res = make_invoice(order, il)
+ cr.execute('INSERT INTO sale_order_invoice_rel \
+ (order_id,invoice_id) values (%s,%s)', (order.id, res))
+ return {}
+
+
+class line_make_invoice(wizard.interface):
+ states = {
+ 'init' : {
+ 'actions': [],
+ 'result': {
+ 'type': 'form',
+ 'arch': invoice_form,
+ 'fields': invoice_fields,
+ 'state': [
+ ('end', 'Cancel'),
+ ('invoice', 'Create invoices')
+ ]
+ }
+ },
+ 'invoice' : {
+ 'actions' : [_makeInvoices],
+ 'result' : {'type': 'state', 'state': 'end'}
+ },
+ }
+
+line_make_invoice("sale.order.line.make_invoice")
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/stock/__init__.py b/addons/stock/__init__.py
index 12a218a31be..d728efbf2fe 100644
--- a/addons/stock/__init__.py
+++ b/addons/stock/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -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 .
+# along with this program. If not, see .
#
##############################################################################
@@ -26,8 +26,8 @@ import product
import report
import wizard
import report_stock
-import stock_wizard
+import stock_wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/stock/__terp__.py b/addons/stock/__terp__.py
index ba5e435fcbb..8081c4b6738 100644
--- a/addons/stock/__terp__.py
+++ b/addons/stock/__terp__.py
@@ -41,16 +41,11 @@ Thanks to the double entry management, the inventory controlling is powerful and
"init_xml" : [],
"demo_xml" : ["stock_demo.xml"],
"update_xml" : [
- "stock_data.xml",
- "wizard/stock_inventory_set_stock_zero_view.xml",
- "wizard/stock_fill_inventory_view.xml",
- "wizard/stock_invoice_onshipping_view.xml",
- "wizard/stock_location_product_view.xml",
- "wizard/stock_inventory_line_split_view.xml",
"stock_workflow.xml",
+ "stock_data.xml",
"stock_incoterms.xml",
"stock_wizard.xml",
- "stock_wizard_view.xml",
+ "stock_wizard_view.xml",
"stock_view.xml",
"stock_report.xml",
"stock_sequence.xml",
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index 3c6fdfc9ab2..a403c141be4 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -223,7 +223,7 @@ class stock_location(osv.osv):
# Take the user company and pricetype
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)
-
+
if not product_ids:
product_ids = product_obj.search(cr, uid, [])
@@ -254,10 +254,10 @@ class stock_location(osv.osv):
continue
product = products_by_id[product_id]
quantity_total += qty[product_id]
-
+
# Compute based on pricetype
# Choose the right filed standard_price to read
- amount_unit=product.price_get(pricetype.field, context)[product.id]
+ amount_unit=product.price_get(pricetype.field, context)[product.id]
price = qty[product_id] * amount_unit
# price = qty[product_id] * product.standard_price
@@ -661,13 +661,13 @@ class stock_picking(osv.osv):
'''Return comment string for invoice'''
return picking.note or ''
- def _get_price_unit_invoice(self, cr, users, move_line, type):
+ def _get_price_unit_invoice(self, cursor, user, move_line, type):
'''Return the price unit for the move line'''
if type in ('in_invoice', 'in_refund'):
# Take the user company and pricetype
- price_type_id=self.pool.get('res.users').browse(cr, users, users).company_id.property_valuation_price_type.id
- pricetype=self.pool.get('product.price.type').browse(cr, users, price_type_id)
- amount_unit=move_line.product_id.price_get(pricetype.field, context={})[move_line.product_id.id]
+ price_type_id=self.pool.get('res.users').browse(cr,users,users).company_id.property_valuation_price_type.id
+ pricetype=self.pool.get('product.price.type').browse(cr,uid,price_type_id)
+ amount_unit=move_line.product_id.price_get(pricetype.field, context)[move_line.product_id.id]
return amount_unit
else:
return move_line.product_id.list_price
@@ -1383,12 +1383,12 @@ class stock_move(osv.osv):
# Base computation on valuation price type
else:
company_id=move.company_id.id
-
+
pricetype=self.pool.get('product.price.type').browse(cr,uid,move.company_id.property_valuation_price_type.id)
amount_unit=move.product_id.price_get(pricetype.field, context)[move.product_id.id]
amount=amount_unit * q or 1.0
# amount = q * move.product_id.standard_price
-
+
partner_id = False
if move.picking_id:
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
@@ -1434,7 +1434,7 @@ class stock_move(osv.osv):
raise osv.except_osv(_('UserError'),
_('You can only delete draft moves.'))
return super(stock_move, self).unlink(
- cr, uid, ids, context=context)
+ cr, uid, ids, context=context)
def _create_lot(self, cr, uid, ids, product_id, prefix=False):
prodlot_obj = self.pool.get('stock.production.lot')
@@ -1442,31 +1442,23 @@ class stock_move(osv.osv):
sequence = ir_sequence_obj.get(cr, uid, 'stock.lot.serial')
if not sequence:
raise wizard.except_wizard(_('Error!'), _('No production sequence defined'))
- new_move = []
-
- def _create_lot(move_id, product_id):
- prodlot_id = prodlot_obj.create(cr, uid, {'name': sequence, 'prefix': prefix}, {'product_id': product_id})
- prodlot = prodlot_obj.browse(cr, uid, prodlot_id)
- ref = '%d' % (move_id)
- if prodlot.ref:
- ref = '%s, %s' % (prodlot.ref, ref)
- prodlot_obj.write(cr, uid, [prodlot_id], {'ref': ref})
- return prodlot_id
prodlot_id = prodlot_obj.create(cr, uid, {'name': sequence, 'prefix': prefix}, {'product_id': product_id})
- prodlot = prodlot_obj.browse(cr, uid, prodlot_id)
+ prodlot = prodlot_obj.browse(cr, uid, prodlot_id)
ref = ','.join(map(lambda x:str(x),ids))
if prodlot.ref:
- ref = '%s, %s' % (prodlot.ref, ref)
+ ref = '%s, %s' % (prodlot.ref, ref)
prodlot_obj.write(cr, uid, [prodlot_id], {'ref': ref})
return prodlot_id
def split_lines(self, cr, uid, ids, quantity, split_by_qty=1, prefix=False, with_lot=True, context=None):
+
if quantity <= 0:
raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !'))
res = []
- for move in self.browse(cr, uid, ids):
+
+ for move in self.browse(cr, uid, ids):
if split_by_qty <= 0 or quantity == 0:
return res
@@ -1478,18 +1470,8 @@ class stock_move(osv.osv):
update_val = {
'product_qty': split_by_qty,
'product_uos_qty': uos_qty,
- }
-
- for idx in range(int(quantity//split_by_qty)):
- if idx:
- current_move = self.copy(cr, uid, move.id, {'state': move.state})
- new_move.append(current_move)
- else:
- update_val = {
- 'product_qty': split_by_qty,
- 'product_uos_qty': uos_qty,
- }
- for idx in range(int(quantity//split_by_qty)):
+ }
+ for idx in range(int(quantity//split_by_qty)):
if not idx and move.product_qty<=quantity:
current_move = move.id
else:
@@ -1499,154 +1481,94 @@ class stock_move(osv.osv):
update_val['prodlot_id'] = self._create_lot(cr, uid, [current_move], move.product_id.id)
self.write(cr, uid, [current_move], update_val)
- if quantity_rest > 0:
- idx = int(quantity//split_by_qty)
-
- if quantity_rest > 0:
- idx = int(quantity//split_by_qty)
+
+
+ if quantity_rest > 0:
+ idx = int(quantity//split_by_qty)
update_val['product_qty'] = quantity_rest
- update_val['product_uos_qty'] = uos_qty_rest
- if idx:
- current_move = self.copy(cr, uid, move.id, {'state': move.state})
- new_move.append(current_move)
- update_val['product_uos_qty'] = uos_qty_rest
- if not idx and move.product_qty<=quantity:
- current_move = move.id
+ update_val['product_uos_qty'] = uos_qty_rest
+ if not idx and move.product_qty<=quantity:
+ current_move = move.id
else:
- current_move = move.id
- update_val['prodlot_id'] = _create_lot(current_move, move.product_id.id)
- current_move = self.copy(cr, uid, move.id, {'state': move.state})
-
+ current_move = self.copy(cr, uid, move.id, {'state': move.state})
+
res.append(current_move)
-
-
- if with_lot:
+
+
+ if with_lot:
update_val['prodlot_id'] = self._create_lot(cr, uid, [current_move], move.product_id.id)
self.write(cr, uid, [current_move], update_val)
- return res
+ return res
- def consume_moves(self, cr, uid, ids, quantity, location_id=False, location_dest_id=False, consume=True, context=None):
+ def consume_moves(self, cr, uid, ids, quantity, location_id=False, location_dest_id=False, consume=True, context=None):
if not context:
context = {}
- context = {}
-
+
if quantity <= 0:
raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !'))
- for move in self.browse(cr, uid, ids, context=context):
-
- res = []
- for move in self.browse(cr, uid, ids, context=context):
+ res = []
+ for move in self.browse(cr, uid, ids, context=context):
move_qty = move.product_qty
quantity_rest = move.product_qty
- quantity_rest -= quantity
+ quantity_rest -= quantity
uos_qty_rest = quantity_rest / move_qty * move.product_uos_qty
if quantity_rest <= 0:
- quantity_rest = quantity
- break
-
- default_val = {
- 'product_qty': quantity,
- 'product_uos_qty': uos_qty,
- 'location_id': location_id or move.location_id.id,
- }
- if move.product_id.track_production:
- new_move = self.split_lines(cr, uid, [move.id], quantity, split_by_qty=1, context=context)
- else:
- current_move = self.copy(cr, uid, move.id, default_val)
- new_move.append(current_move)
-
- update_val = {}
- if quantity_rest > 0:
- quantity_rest = 0
+ quantity_rest = 0
uos_qty_rest = 0
quantity = move.product_qty
-
+
uos_qty = quantity / move_qty * move.product_uos_qty
- if quantity_rest > 0:
+ if quantity_rest > 0:
default_val = {
- 'product_qty': quantity,
- 'product_uos_qty': uos_qty,
- 'state': move.state,
+ 'product_qty': quantity,
+ 'product_uos_qty': uos_qty,
+ 'state': move.state,
}
if location_dest_id:
- default_val.update({'location_dest_id': location_dest_id})
+ default_val.update({'location_dest_id': location_dest_id})
if location_id:
- default_val.update({'location_id': location_id})
-
+ default_val.update({'location_id': location_id})
+
if move.product_id.track_production and location_id:
res += self.split_lines(cr, uid, [move.id], quantity, split_by_qty=1, context=context)
else:
current_move = self.copy(cr, uid, move.id, default_val)
res += [current_move]
- update_val = {}
+ update_val = {}
update_val['product_qty'] = quantity_rest
- update_val['product_uos_qty'] = uos_qty_rest
- self.write(cr, uid, [move.id], update_val)
+ update_val['product_uos_qty'] = uos_qty_rest
+ self.write(cr, uid, [move.id], update_val)
- self.action_done(cr, uid, new_move)
- return new_move
- update_val['product_uos_qty'] = uos_qty_rest
- self.write(cr, uid, [move.id], update_val)
-
- else:
- quantity_rest = quantity
+ 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:
- res += [move.id]
- update_val = {}
+ else:
+ res += [move.id]
+ update_val = {}
update_val['product_qty'] = quantity_rest
update_val['product_uos_qty'] = uos_qty_rest
if location_dest_id:
- update_val.update({'location_dest_id': location_dest_id})
+ update_val.update({'location_dest_id': location_dest_id})
if location_id:
- update_val.update({'location_id': location_id})
+ update_val.update({'location_id': location_id})
self.write(cr, uid, [move.id], update_val)
if consume:
- self.action_done(cr, uid, res)
+ self.action_done(cr, uid, res)
return res
def scrap_moves(self, cr, uid, ids, quantity, location_dest_id, context=None):
- new_move = []
- if quantity <= 0:
- raise osv.except_osv(_('Warning!'), _('Please provide Proper Quantity !'))
-
- for move in self.browse(cr, uid, ids, context=context):
- location = move.location_dest_id.id
- move_qty = move.product_qty
- quantity_rest = move.product_qty
-
- quantity_rest -= quantity
- uos_qty = quantity / move_qty * move.product_uos_qty
- uos_qty_rest = quantity_rest / move_qty * move.product_uos_qty
- if quantity_rest <= 0:
- quantity_rest = quantity
- break
-
- default_val = {
- 'product_qty': quantity,
- 'product_uos_qty': uos_qty,
- 'location_dest_id': location_dest_id,
- 'state': move.state
- }
- current_move = self.copy(cr, uid, move.id, default_val)
- new_move.append(current_move)
- update_val = {}
- if quantity_rest > 0:
- update_val['product_qty'] = quantity_rest
- update_val['product_uos_qty'] = uos_qty_rest
- self.write(cr, uid, [move.id], update_val)
- return new_move
return self.consume_moves(cr, uid, ids, quantity, location_id=False, location_dest_id=location_dest_id, consume=False, context=context)
+
stock_move()
@@ -1677,7 +1599,7 @@ class stock_inventory(osv.osv):
move_line = []
for line in inv.inventory_line_id:
pid = line.product_id.id
-
+
# price = line.product_id.standard_price or 0.0
amount = self.pool.get('stock.location')._product_get(cr, uid, line.location_id.id, [pid], {'uom': line.product_uom.id})[pid]
change = line.product_qty - amount
diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml
index c112ab44d5e..3cada5cbb6d 100644
--- a/addons/stock/stock_view.xml
+++ b/addons/stock/stock_view.xml
@@ -33,12 +33,7 @@
-
-
+
@@ -55,7 +50,6 @@
-
@@ -70,7 +64,6 @@
-
stock.inventory.form
@@ -96,12 +89,11 @@
-
-
-
+
+
+
+
@@ -114,7 +106,6 @@
-
@@ -147,9 +138,6 @@
-
-
-
@@ -536,7 +524,7 @@
new{'action_id': active_id}
-
+
stock.picking.calendar
@@ -597,7 +585,7 @@
-
+
-
@@ -741,7 +726,6 @@
-
@@ -756,7 +740,7 @@
-
+
-
@@ -909,6 +890,9 @@
+
@@ -941,7 +925,7 @@
-
+
-
+ states="draft,waiting,confirmed,assigned" />
+
@@ -1294,7 +1278,7 @@
-
+
@@ -1333,7 +1317,7 @@
-
+
@@ -1343,7 +1327,7 @@
domain="[('product_id','=?',product_id)]"
on_change="onchange_lot_id(prodlot_id,product_qty, location_id, product_id)"/>
-
+
diff --git a/addons/stock/stock_wizard.py b/addons/stock/stock_wizard.py
index eefeeec4ad8..548375db199 100644
--- a/addons/stock/stock_wizard.py
+++ b/addons/stock/stock_wizard.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -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 .
+# along with this program. If not, see .
#
##############################################################################
@@ -25,16 +25,16 @@ from tools.translate import _
class stock_move_track(osv.osv_memory):
_name = "stock.move.track"
_description = "Track moves"
-
+
_columns = {
- 'tracking_prefix': fields.char('Tracking prefix', size=64),
+ 'tracking_prefix': fields.char('Tracking prefix', size=64),
'quantity': fields.float("Quantity per lot")
}
_defaults = {
'quantity': lambda *x: 1
}
-
+
def track_lines(self, cr, uid, ids, context={}):
datas = self.read(cr, uid, ids)[0]
move_obj = self.pool.get('stock.move')
@@ -46,43 +46,43 @@ stock_move_track()
class stock_move_consume(osv.osv_memory):
_name = "stock.move.consume"
_description = "Consume Products"
-
+
_columns = {
- 'product_id': fields.many2one('product.product', 'Product', required=True, select=True),
- 'product_qty': fields.float('Quantity', required=True),
- 'product_uom': fields.many2one('product.uom', 'Product UOM', required=True),
+ 'product_id': fields.many2one('product.product', 'Product', required=True, select=True),
+ 'product_qty': fields.float('Quantity', required=True),
+ 'product_uom': fields.many2one('product.uom', 'Product UOM', required=True),
'location_id': fields.many2one('stock.location', 'Location', required=True)
}
def _get_product_id(self, cr, uid, context):
move = self.pool.get('stock.move').browse(cr, uid, context['active_id'], context=context)
return move.product_id.id
-
+
def _get_product_qty(self, cr, uid, context):
move = self.pool.get('stock.move').browse(cr, uid, context['active_id'], context=context)
return move.product_qty
-
+
def _get_product_uom(self, cr, uid, context):
move = self.pool.get('stock.move').browse(cr, uid, context['active_id'], context=context)
return move.product_uom.id
-
+
def _get_location_id(self, cr, uid, context):
move = self.pool.get('stock.move').browse(cr, uid, context['active_id'], context=context)
return move.location_id.id
-
+
_defaults = {
- 'product_id': _get_product_id,
- 'product_qty': _get_product_qty,
- 'product_uom': _get_product_uom,
+ 'product_id': _get_product_id,
+ 'product_qty': _get_product_qty,
+ 'product_uom': _get_product_uom,
'location_id': _get_location_id
}
def do_move_consume(self, cr, uid, ids, context={}):
move_obj = self.pool.get('stock.move')
move_ids = context['active_ids']
- for data in self.read(cr, uid, ids):
- move_obj.consume_moves(cr, uid, move_ids,
- data['product_qty'], data['location_id'],
+ for data in self.read(cr, uid, ids):
+ move_obj.consume_moves(cr, uid, move_ids,
+ data['product_qty'], data['location_id'],
context=context)
return {}
@@ -93,17 +93,17 @@ class stock_move_scrap(osv.osv_memory):
_name = "stock.move.scrap"
_description = "Scrap Products"
_inherit = "stock.move.consume"
-
+
_defaults = {
'location_id': lambda *x: False
- }
+ }
def move_scrap(self, cr, uid, ids, context={}):
- move_obj = self.pool.get('stock.move')
+ move_obj = self.pool.get('stock.move')
move_ids = context['active_ids']
for data in self.read(cr, uid, ids):
- move_obj.scrap_moves(cr, uid, move_ids,
- data['product_qty'], data['location_id'],
+ move_obj.scrap_moves(cr, uid, move_ids,
+ data['product_qty'], data['location_id'],
context=context)
return {}
@@ -113,18 +113,18 @@ stock_move_scrap()
class split_in_production_lot(osv.osv_memory):
_name = "stock.move.split"
_description = "Split in Production lots"
-
+
_columns = {
'product_id': fields.many2one('product.product', 'Product', required=True, select=True),
'line_ids': fields.one2many('stock.move.split.lines', 'lot_id', 'Lots Number')
}
-
+
def _get_product_id(self, cr, uid, context):
move = self.pool.get('stock.move').browse(cr, uid, context['active_id'], context=context)
return move.product_id.id
-
+
_defaults = {
- 'product_id': _get_product_id,
+ 'product_id': _get_product_id,
}
def split_lot(self, cr, uid, ids, context=None):
@@ -135,15 +135,16 @@ class split_in_production_lot(osv.osv_memory):
prodlot_obj = self.pool.get('stock.production.lot')
ir_sequence_obj = self.pool.get('ir.sequence')
move_obj = self.pool.get('stock.move')
- new_move = []
+ new_move = []
for data in self.browse(cr, uid, ids):
for move in move_obj.browse(cr, uid, move_ids):
move_qty = move.product_qty
quantity_rest = move.product_qty
uos_qty_rest = move.product_uos_qty
- new_move = []
+ new_move = []
for line in data.line_ids:
quantity = line.quantity
+
if quantity <= 0 or move_qty == 0:
continue
@@ -154,53 +155,52 @@ class split_in_production_lot(osv.osv_memory):
quantity_rest = quantity
break
default_val = {
- 'product_qty': quantity,
- 'product_uos_qty': uos_qty,
+ 'product_qty': quantity,
+ 'product_uos_qty': uos_qty,
'state': move.state
}
-
current_move = move_obj.copy(cr, uid, move.id, default_val)
new_move.append(current_move)
prodlot_id = False
if line.use_exist and line.name:
prodlot_id = prodlot_obj.search(cr, uid, [('prefix','=',line.name),('product_id','=',data.product_id.id)])
if prodlot_id:
- prodlot_id = prodlot_id[0]
+ prodlot_id = prodlot_id[0]
if not prodlot_id:
sequence = ir_sequence_obj.get(cr, uid, 'stock.lot.serial')
- prodlot_id = prodlot_obj.create(cr, uid, {'name': sequence, 'prefix' : line.name},
- {'product_id': move.product_id.id})
+ prodlot_id = prodlot_obj.create(cr, uid, {'name': sequence, 'prefix' : line.name},
+ {'product_id': move.product_id.id})
move_obj.write(cr, uid, [current_move], {'prodlot_id': prodlot_id})
- prodlot = prodlot_obj.browse(cr, uid, prodlot_id)
+ prodlot = prodlot_obj.browse(cr, uid, prodlot_id)
ref = '%d' % (current_move)
if prodlot.ref:
- ref = '%s, %s' % (prodlot.ref, ref)
+ ref = '%s, %s' % (prodlot.ref, ref)
prodlot_obj.write(cr, uid, [prodlot_id], {'ref': ref})
-
+
update_val = {}
- if quantity_rest > 0:
+ if quantity_rest > 0:
update_val['product_qty'] = quantity_rest
- update_val['product_uos_qty'] = uos_qty_rest
+ update_val['product_uos_qty'] = uos_qty_rest
move_obj.write(cr, uid, [move.id], update_val)
-
+
return new_move
split_in_production_lot()
class stock_move_split_lines(osv.osv_memory):
_name = "stock.move.split.lines"
_description = "Split lines"
-
+
_columns = {
- 'name': fields.char('Tracking serial', size=64),
- 'quantity': fields.integer('Quantity'),
+ 'name': fields.char('Tracking serial', size=64),
+ 'quantity': fields.integer('Quantity'),
'use_exist' : fields.boolean('Use Exist'),
'lot_id': fields.many2one('stock.move.split', 'Lot'),
'action': fields.selection([('split','Split'),('keepinone','Keep in one lot')],'Action'),
}
_defaults = {
'quantity': lambda *x: 1,
- 'action' : lambda *x: 'split',
+ 'action' : lambda *x: 'split',
}
stock_move_split_lines()
diff --git a/addons/stock/stock_wizard.xml b/addons/stock/stock_wizard.xml
index d562ddfbb9f..5db1269d42c 100644
--- a/addons/stock/stock_wizard.xml
+++ b/addons/stock/stock_wizard.xml
@@ -43,6 +43,20 @@
name="stock.return.picking"
string="Return picking"/>
+
+
+
+
-
-
\ No newline at end of file
+
+
+
+
+
+
diff --git a/addons/stock/wizard/__init__.py b/addons/stock/wizard/__init__.py
index c489f880fdf..6a15449a151 100644
--- a/addons/stock/wizard/__init__.py
+++ b/addons/stock/wizard/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -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 .
+# along with this program. If not, see .
#
##############################################################################
@@ -27,13 +27,12 @@ import wizard_replacement
import wizard_return
import wizard_split_lot_line
import wizard_ups
+import wizard_invoice_onshipping
+import wizard_location_product
+import wizard_inventory
+import wizard_split_inventory_lots
+import inventory_merge_zero
import inventory_merge
-import stock_inventory_set_stock_zero
-import stock_fill_inventory
-import stock_inventory_line_split
-import stock_invoice_onshipping
-import stock_location_product
-
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/stock/wizard/inventory_merge.py b/addons/stock/wizard/inventory_merge.py
index b32ad83bec3..7be8eb2b3e3 100644
--- a/addons/stock/wizard/inventory_merge.py
+++ b/addons/stock/wizard/inventory_merge.py
@@ -41,7 +41,6 @@ def do_merge(self, cr, uid, data, context):
invent_lines = {}
if len(data['ids']) < 2:
-
raise wizard.except_wizard(_('Warning'),
_('Please select at least two inventories.'))
diff --git a/addons/stock/wizard/inventory_merge_zero.py b/addons/stock/wizard/inventory_merge_zero.py
new file mode 100644
index 00000000000..3aa2b1e9fd9
--- /dev/null
+++ b/addons/stock/wizard/inventory_merge_zero.py
@@ -0,0 +1,94 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+
+
+import wizard
+import pooler
+from tools.translate import _
+
+
+_form = """
+
+
+
+
+
+
+"""
+_inventory_fields = {
+ 'location_id' : {
+ 'string':'Location',
+ 'type':'many2one',
+ 'relation':'stock.location',
+ 'required':True
+ }
+}
+
+
+def do_merge(self, cr, uid, data, context):
+ invent_obj = pooler.get_pool(cr.dbname).get('stock.inventory')
+ invent_line_obj = pooler.get_pool(cr.dbname).get('stock.inventory.line')
+ prod_obj = pooler.get_pool(cr.dbname).get('product.product')
+
+ if len(data['ids']) <> 1:
+ raise wizard.except_wizard(_('Warning'),
+ _('Please select one and only one inventory !'))
+
+ loc = str(data['form']['location_id'])
+
+ cr.execute('select distinct location_id,product_id from stock_inventory_line where inventory_id=%s', (data['ids'][0],))
+ inv = cr.fetchall()
+ cr.execute('select distinct product_id from stock_move where location_dest_id=%s or location_id=%s',(loc,loc,))
+ stock = cr.fetchall()
+ for s in stock:
+ if (loc,s[0]) not in inv:
+ p = prod_obj.browse(cr, uid, s[0])
+ invent_line_obj.create(cr, uid, {
+ 'inventory_id': data['ids'][0],
+ 'location_id': loc,
+ 'product_id': s[0],
+ 'product_uom': p.uom_id.id,
+ 'product_qty': 0.0,
+ })
+ return {}
+
+
+class merge_inventory(wizard.interface):
+ states = {
+ 'init' : {
+ 'actions' : [],
+ 'result' : {'type' : 'form',
+ 'arch' : _form,
+ 'fields' : _inventory_fields,
+ 'state' : [('end', 'Cancel', 'gtk-cancel'),
+ ('merge', 'Set to Zero', 'gtk-apply', True) ]}
+ },
+ 'merge' : {
+ 'actions' : [],
+ 'result' : {'type' : 'action',
+ 'action': do_merge,
+ 'state' : 'end'}
+ },
+ }
+merge_inventory("inventory.merge.stock.zero")
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/stock/wizard/stock_fill_inventory.py b/addons/stock/wizard/stock_fill_inventory.py
deleted file mode 100644
index 246aff9eabf..00000000000
--- a/addons/stock/wizard/stock_fill_inventory.py
+++ /dev/null
@@ -1,90 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-from osv import fields, osv
-from service import web_services
-from tools.misc import UpdateableStr, UpdateableDict
-from tools.translate import _
-import netsvc
-import pooler
-import time
-import wizard
-
-
-class stock_fill_inventory(osv.osv_memory):
- _name = "stock.fill.inventory"
- _description = "Fill Inventory"
- _columns = {
- 'location_id': fields.many2one('stock.location', 'Location', required=True),
- 'recursive': fields.boolean("Include all childs for the location"),
- }
-
- def fill_inventory(self, cr, uid, ids, context):
- inventory_line_obj = self.pool.get('stock.inventory.line')
- location_obj = self.pool.get('stock.location')
- for fill_inventory in self.browse(cr, uid, ids):
- res = {}
- res_location = {}
- if fill_inventory.recursive :
- location_ids = location_obj.search(cr, uid, [('location_id',
- 'child_of', fill_inventory.location_id.id)])
- for location in location_ids :
- res = location_obj._product_get(cr, uid, location)
- res_location[location] = res
- else:
- context.update({'compute_child': False})
- res = location_obj._product_get(cr, uid,
- fill_inventory.location_id.id, context=context)
- res_location[fill_inventory.location_id.id] = res
-
- product_ids = []
- for location in res_location.keys():
- res = res_location[location]
- for product_id in res.keys():
- prod = self.pool.get('product.product').browse(cr, uid, [product_id])[0]
- uom = prod.uom_id.id
- context.update({'uom': uom})
- amount = self.pool.get('stock.location')._product_get(cr, uid,
- location, [product_id], context=context)[product_id]
-
- if(amount):
- line_ids=inventory_line_obj.search(cr, uid,
- [('inventory_id', '=', context['active_ids']),
- ('location_id', '=', location),
- ('product_id', '=', product_id),
- ('product_uom', '=', uom),
- ('product_qty', '=', amount)])
- if not len(line_ids):
- inventory_line = {'inventory_id': context['active_ids'][0],
- 'location_id': location,
- 'product_id': product_id,
- 'product_uom': uom,
- 'product_qty': amount}
- inventory_line_obj.create(cr, uid, inventory_line)
- product_ids.append(product_id)
-
- if(len(product_ids) == 0):
- raise osv.except_osv(_('Message !'), _('No product in this location.'))
- return {}
-
-stock_fill_inventory()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/stock/wizard/stock_fill_inventory_view.xml b/addons/stock/wizard/stock_fill_inventory_view.xml
deleted file mode 100644
index 5ac6732b533..00000000000
--- a/addons/stock/wizard/stock_fill_inventory_view.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
- Fill Inventory
- stock.fill.inventory
- form
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fill Inventory
- ir.actions.act_window
- stock.fill.inventory
- form
- form
- new
- {'record_id' : active_id}
-
-
-
-
-
- Fill Inventory
- client_action_multi
-
- action
- stock.inventory
-
-
-
-
\ No newline at end of file
diff --git a/addons/stock/wizard/stock_inventory_line_split.py b/addons/stock/wizard/stock_inventory_line_split.py
deleted file mode 100644
index 1723f7b3032..00000000000
--- a/addons/stock/wizard/stock_inventory_line_split.py
+++ /dev/null
@@ -1,105 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-from osv import fields, osv
-from service import web_services
-from tools.misc import UpdateableStr, UpdateableDict
-from tools.translate import _
-import netsvc
-import pooler
-import time
-import wizard
-
-class stock_inventory_line_split(osv.osv_memory):
- _name = "stock.inventory.line.split"
- _description = "Split inventory lines"
- _columns = {
- 'prefix': fields.char('Prefix', size=64),
- 'quantity': fields.float('Quantity per lot'),
- }
-
- def _check_production_lot(self, cr, uid, context):
- for inv_obj in self.pool.get('stock.inventory.line').browse(cr, uid, \
- context['active_ids']):
- if not inv_obj.prod_lot_id:
- raise osv.except_osv(_('Caution!'), _('Before splitting the \
-inventory lines, make sure the production lot is assigned to this product.'))
- return
-
- _defaults = {
- 'quantity': lambda *a: '1',
- 'prefix': _check_production_lot,
- }
-
- def split_lines(self, cr, uid, ids, context):
- inv_id = context['active_id']
- inv_line_obj = self.pool.get('stock.inventory.line')
- prodlot_obj = self.pool.get('stock.production.lot')
- for linesplit_obj in self.browse(cr, uid, ids):
- ir_sequence_obj = self.pool.get('ir.sequence')
-
- sequence = ir_sequence_obj.get(cr, uid, 'stock.lot.serial')
- if not sequence:
- raise wizard.except_wizard(_('Error!'), _('No production sequence defined'))
- if linesplit_obj.prefix:
- sequence = linesplit_obj.prefix + '/' + (sequence or '')
-
- inv = inv_line_obj.browse(cr, uid, [inv_id])[0]
- quantity = linesplit_obj.quantity
- prodlot_obj.write(cr, uid, inv.prod_lot_id.id, {'name': sequence})
-
- if quantity <= 0 or inv.product_qty == 0:
- return {}
-
- quantity_rest = inv.product_qty % quantity
-
- update_val = {
- 'product_qty': quantity,
- }
-
- new_line = []
- for idx in range(int(inv.product_qty // quantity)):
- if idx:
- current_line = inv_line_obj.copy(cr, uid, inv.id,
- {'prod_lot_id': inv.prod_lot_id.id})
- new_line.append(current_line)
- else:
- current_line = inv.id
- inv_line_obj.write(cr, uid, [current_line], update_val)
-
- if quantity_rest > 0:
- idx = int(inv.product_qty // quantity)
- update_val['product_qty'] = quantity_rest
-
- if idx:
- current_line = inv_line_obj.copy(cr, uid, inv.id,
- {'prod_lot_id': inv.prod_lot_id.id})
- new_line.append(current_line)
- else:
- current_line = inv_line_obj.id
- inv_line_obj.write(cr, uid, [current_line], update_val)
-
- return {}
-
-stock_inventory_line_split()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/stock/wizard/stock_inventory_line_split_view.xml b/addons/stock/wizard/stock_inventory_line_split_view.xml
deleted file mode 100644
index a2c9f2d065a..00000000000
--- a/addons/stock/wizard/stock_inventory_line_split_view.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
- Split inventory lines
- stock.inventory.line.split
- form
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Split inventory lines
- ir.actions.act_window
- stock.inventory.line.split
- form
- form
- new
-
-
-
-
\ No newline at end of file
diff --git a/addons/stock/wizard/stock_inventory_set_stock_zero.py b/addons/stock/wizard/stock_inventory_set_stock_zero.py
deleted file mode 100644
index cfb1d4a0ac9..00000000000
--- a/addons/stock/wizard/stock_inventory_set_stock_zero.py
+++ /dev/null
@@ -1,72 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-from osv import fields, osv
-from service import web_services
-from tools.misc import UpdateableStr, UpdateableDict
-from tools.translate import _
-import netsvc
-import pooler
-import time
-import wizard
-
-
-class inventory_merge_stock_zero(osv.osv_memory):
- _name = "stock.inventory.merge.stock.zero"
- _description = "Set Stock to 0"
- _columns = {
- 'location_id': fields.many2one('stock.location', 'Location', required=True),
- }
-
- def do_merge(self, cr, uid, ids, context):
- invent_obj = pooler.get_pool(cr.dbname).get('stock.inventory')
- invent_line_obj = pooler.get_pool(cr.dbname).get('stock.inventory.line')
- prod_obj = pooler.get_pool(cr.dbname).get('product.product')
-
- if len(context['active_ids']) <> 1:
- raise wizard.except_wizard(_('Warning'),
- _('Please select one and only one inventory !'))
- for id in ids:
- datas = self.read(cr, uid, id)
- loc = str(datas['location_id'])
-
- cr.execute('select distinct location_id,product_id \
- from stock_inventory_line \
- where inventory_id=%s', (context['active_ids'][0],))
- inv = cr.fetchall()
- cr.execute('select distinct product_id from stock_move where \
- location_dest_id=%s or location_id=%s', (loc, loc,))
- stock = cr.fetchall()
- for s in stock:
- if (loc, s[0]) not in inv:
- p = prod_obj.browse(cr, uid, s[0])
- invent_line_obj.create(cr, uid, {
- 'inventory_id': context['active_ids'][0],
- 'location_id': loc,
- 'product_id': s[0],
- 'product_uom': p.uom_id.id,
- 'product_qty': 0.0,
- })
- return {}
-
-inventory_merge_stock_zero()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/stock/wizard/stock_inventory_set_stock_zero_view.xml b/addons/stock/wizard/stock_inventory_set_stock_zero_view.xml
deleted file mode 100644
index 2948b3005ea..00000000000
--- a/addons/stock/wizard/stock_inventory_set_stock_zero_view.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
-
- Set Stock to Zero
- stock.inventory.merge.stock.zero
- form
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Set Stock to Zero
- ir.actions.act_window
- stock.inventory.merge.stock.zero
- form
- form
- new
- {'record_id' : active_id}
-
-
-
-
-
- Set Stock to Zero
- client_action_multi
-
- action
- stock.inventory
-
-
-
-
\ No newline at end of file
diff --git a/addons/stock/wizard/stock_invoice_onshipping.py b/addons/stock/wizard/stock_invoice_onshipping.py
deleted file mode 100644
index 82043fc0532..00000000000
--- a/addons/stock/wizard/stock_invoice_onshipping.py
+++ /dev/null
@@ -1,111 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-from osv import fields, osv
-from service import web_services
-from tools.misc import UpdateableStr, UpdateableDict
-from tools.translate import _
-import netsvc
-import pooler
-import time
-import wizard
-
-class stock_invoice_onshipping(osv.osv_memory):
- _name = "stock.invoice.onshipping"
- _description = "Stock Invoice Onshipping"
- _columns = {
- 'journal_id': fields.many2one('account.journal', 'Destination Journal', required=True),
- 'group': fields.boolean("Group by partner"),
- 'type': fields.selection([('out_invoice', 'Customer Invoice'),
- ('in_invoice', 'Supplier Invoice'),
- ('out_refund', 'Customer Refund'),
- ('in_refund', 'Supplier Refund')] , 'Type', required=True),
- 'invoice_date': fields.date('Invoiced date'),
- }
-
- def _get_type(self, cr, uid, context):
- picking_obj = self.pool.get('stock.picking')
- usage = 'customer'
- pick = picking_obj.browse(cr, uid, context['active_id'])
- if pick.invoice_state == 'invoiced':
- raise osv.except_osv(_('UserError'), _('Invoice is already created.'))
- if pick.invoice_state == 'none':
- raise osv.except_osv(_('UserError'), _('Invoice cannot be created from Picking.'))
- if pick.move_lines:
- usage = pick.move_lines[0].location_id.usage
-
- if pick.type == 'out' and usage == 'supplier':
- type = 'in_refund'
- elif pick.type == 'out' and usage == 'customer':
- type = 'out_invoice'
- elif pick.type == 'in' and usage == 'supplier':
- type = 'in_invoice'
- elif pick.type == 'in' and usage == 'customer':
- type = 'out_refund'
- else:
- type = 'out_invoice'
- return type
-
- _defaults = {
- 'type': _get_type,
- }
-
- def create_invoice(self, cr, uid, ids, context):
- result = []
- for onshipdata_obj in self.read(cr, uid, ids, ['journal_id', 'group', 'type', 'invoice_date']):
- if context.get('new_picking', False):
- onshipdata_obj[id] = onshipdata_obj.new_picking
- onshipdata_obj[ids] = onshipdata_obj.new_picking
-
- picking_obj = self.pool.get('stock.picking')
- mod_obj = self.pool.get('ir.model.data')
- act_obj = self.pool.get('ir.actions.act_window')
-
- type = onshipdata_obj['type']
- context['date_inv'] = onshipdata_obj['invoice_date']
- res = picking_obj.action_invoice_create(cr, uid,context['active_ids'],
- journal_id = onshipdata_obj['journal_id'],
- group=onshipdata_obj['group'],
- type=type,
- context=context)
- invoice_ids = res.values()
- if not invoice_ids:
- raise osv.except_osv(_('Error'), _('Invoice is not created'))
-
- if type == 'out_invoice':
- xml_id = 'action_invoice_tree1'
- elif type == 'in_invoice':
- xml_id = 'action_invoice_tree2'
- elif type == 'out_refund':
- xml_id = 'action_invoice_tree3'
- else:
- xml_id = 'action_invoice_tree4'
-
- result = mod_obj._get_id(cr, uid, 'account', xml_id)
- id = mod_obj.read(cr, uid, result, ['res_id'])
- result = act_obj.read(cr, uid, id['res_id'])
- result['res_id'] = invoice_ids
- return result
-
-stock_invoice_onshipping()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/stock/wizard/stock_invoice_onshipping_view.xml b/addons/stock/wizard/stock_invoice_onshipping_view.xml
deleted file mode 100644
index c4bec603120..00000000000
--- a/addons/stock/wizard/stock_invoice_onshipping_view.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-
- Stock Invoice Onshipping
- stock.invoice.onshipping
- form
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Create Invoice
- ir.actions.act_window
- stock.invoice.onshipping
- form
- form
- new
- {'record_id' : active_id}
-
-
-
-
-
- Create Invoice
- client_action_multi
-
- action
- stock.picking
-
-
-
\ No newline at end of file
diff --git a/addons/stock/wizard/stock_location_product.py b/addons/stock/wizard/stock_location_product.py
deleted file mode 100755
index 44f6cb4dc7f..00000000000
--- a/addons/stock/wizard/stock_location_product.py
+++ /dev/null
@@ -1,59 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# 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 .
-#
-##############################################################################
-
-from osv import fields, osv
-from service import web_services
-from tools.misc import UpdateableStr, UpdateableDict
-from tools.translate import _
-import netsvc
-import pooler
-import time
-import wizard
-
-class stock_location_product(osv.osv_memory):
- _name = "stock.location.product"
- _description = "Products by Location"
- _columns = {
- 'from_date': fields.datetime('From'),
- 'to_date': fields.datetime('To'),
- }
-
- def action_open_window(self, cr, uid, ids, context):
- mod_obj = self.pool.get('ir.model.data')
- for location_obj in self.read(cr, uid, ids, ['from_date', 'to_date']):
- result = mod_obj._get_id(cr, uid, 'product', 'product_search_form_view')
- id = mod_obj.read(cr, uid, result, ['res_id'])
- return {
- 'name': 'product',
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'product.product',
- 'type': 'ir.actions.act_window',
- 'context': {'location': context['active_ids'][0],
- 'from_date': location_obj['from_date'],
- 'to_date': location_obj['to_date']},
- 'domain': [('type', '<>', 'service')],
- 'search_view_id': id['res_id']
- }
-
-stock_location_product()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/stock/wizard/stock_location_product_view.xml b/addons/stock/wizard/stock_location_product_view.xml
deleted file mode 100644
index 5d54ee874aa..00000000000
--- a/addons/stock/wizard/stock_location_product_view.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-
- Products by Location
- stock.location.product
- form
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Products by Location
- ir.actions.act_window
- stock.location.product
- form
- form
- new
- {'record_id' : active_id}
-
-
-
-
-
- Products by Location
- client_action_multi
-
- action
- stock.location
-
-
-
\ No newline at end of file
diff --git a/addons/stock/wizard/stock_traceability.py b/addons/stock/wizard/stock_traceability.py
index 3fc65ff74c0..58cc26a3224 100644
--- a/addons/stock/wizard/stock_traceability.py
+++ b/addons/stock/wizard/stock_traceability.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -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 .
+# along with this program. If not, see .
#
##############################################################################
diff --git a/addons/stock/wizard/wizard_inventory.py b/addons/stock/wizard/wizard_inventory.py
new file mode 100644
index 00000000000..42345353866
--- /dev/null
+++ b/addons/stock/wizard/wizard_inventory.py
@@ -0,0 +1,111 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+
+import time
+import wizard
+import ir
+import pooler
+from osv.osv import except_osv
+from osv import fields,osv
+import netsvc
+from tools.translate import _
+
+inventory_form = """
+
+
+
+
+
+
+
+
+"""
+
+inventory_fields = {
+ 'location_id' : {
+ 'string':'Location',
+ 'type':'many2one',
+ 'relation':'stock.location',
+ 'required':True
+ },
+ 'recursive' : {'string':'Include all childs for the location', 'type':'boolean'}
+}
+
+
+
+def _fill_inventory(self, cr, uid, data, context):
+ pool = pooler.get_pool(cr.dbname)
+ inventory_line_obj = pooler.get_pool(cr.dbname).get('stock.inventory.line')
+ location_obj = pooler.get_pool(cr.dbname).get('stock.location')
+ res={}
+ res_location={}
+ if data['form']['recursive'] :
+ location_ids = location_obj.search(cr, uid, [('location_id', 'child_of', [data['form']['location_id']])])
+ for location in location_ids :
+ res=location_obj._product_get(cr, uid, location)
+ res_location[location]=res
+ else:
+ context.update({'compute_child':False})
+ res=location_obj._product_get(cr, uid, data['form']['location_id'],context=context)
+ res_location[data['form']['location_id']]=res
+
+ product_ids=[]
+ for location in res_location.keys():
+ res=res_location[location]
+ for product_id in res.keys():
+ #product_ids.append(product_id)
+ prod = pool.get('product.product').browse(cr, uid, [product_id])[0]
+ uom = prod.uom_id.id
+ context.update({'uom': uom})
+ amount=pool.get('stock.location')._product_get(cr, uid, location, [product_id], context=context)[product_id]
+
+ if(amount):
+ line_ids=inventory_line_obj.search(cr,uid,[('inventory_id','=',data['id']),('location_id','=',location),('product_id','=',product_id),('product_uom','=',uom),('product_qty','=',amount)])
+ if not len(line_ids):
+ inventory_line={'inventory_id':data['id'],'location_id':location,'product_id':product_id,'product_uom':uom,'product_qty':amount}
+ inventory_line_obj.create(cr, uid, inventory_line)
+ product_ids.append(product_id)
+
+ if(len(product_ids)==0):
+ raise wizard.except_wizard(_('Message !'), _('No product in this location.'))
+ return {}
+
+
+
+class fill_inventory(wizard.interface):
+ states = {
+ 'init' : {
+ 'actions' : [],
+ 'result' : {'type' : 'form',
+ 'arch' : inventory_form,
+ 'fields' : inventory_fields,
+ 'state' : [('end', 'Cancel', 'gtk-cancel'),('fill_inventory', 'Fill Inventory', 'gtk-apply', True) ]}
+ },
+ 'fill_inventory' : {
+ 'actions' : [],
+ 'result' : {'type' : 'action', 'action': _fill_inventory, 'state' : 'end'}
+ },
+ }
+fill_inventory("stock.fill_inventory")
+
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/stock/wizard/wizard_invoice_onshipping.py b/addons/stock/wizard/wizard_invoice_onshipping.py
new file mode 100644
index 00000000000..22cdbc97e70
--- /dev/null
+++ b/addons/stock/wizard/wizard_invoice_onshipping.py
@@ -0,0 +1,167 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+
+import wizard
+import pooler
+from tools.translate import _
+
+invoice_form = """
+
+
+
+
+
+
+
+
+
+
+"""
+
+invoice_fields = {
+ 'journal_id': {
+ 'string': 'Destination Journal',
+ 'type': 'many2one',
+ 'relation': 'account.journal',
+ 'required': True
+ },
+ 'group': {
+ 'string': 'Group by partner',
+ 'type': 'boolean'
+ },
+ 'type': {
+ 'string': 'Type',
+ 'type': 'selection',
+ 'selection': [],
+ 'required': True
+ },
+ 'invoice_date': {'string': 'Invoiced date', 'type':'date' }
+}
+
+
+def _get_type(obj, cr, uid, data, context):
+ picking_obj = pooler.get_pool(cr.dbname).get('stock.picking')
+ usage = 'customer'
+ pick = picking_obj.browse(cr, uid, data['id'], context)
+ if pick.invoice_state == 'invoiced':
+ raise wizard.except_wizard(_('UserError'), _('Invoice is already created.'))
+ if pick.invoice_state == 'none':
+ raise wizard.except_wizard(_('UserError'), _('Invoice cannot be created from Picking.'))
+
+ if pick.move_lines:
+ usage = pick.move_lines[0].location_id.usage
+
+ if pick.type =='out':
+ invoice_fields['type']['selection'] = [
+ ('out_invoice', 'Customer Invoice'),
+ ('in_refund', 'Supplier Refund'),
+ ]
+ elif pick.type =='in':
+ invoice_fields['type']['selection'] = [
+ ('in_invoice', 'Supplier Invoice'),
+ ('out_refund', 'Customer Refund'),
+ ]
+ else:
+ invoice_fields['type']['selection']=[
+ ('out_invoice', 'Customer Invoice'),
+ ('in_invoice', 'Supplier Invoice'),
+ ('out_refund', 'Customer Refund'),
+ ('in_refund', 'Supplier Refund'),
+ ]
+
+ if pick.type == 'out' and usage == 'supplier':
+ type = 'in_refund'
+ elif pick.type == 'out' and usage == 'customer':
+ type = 'out_invoice'
+ elif pick.type == 'in' and usage == 'supplier':
+ type = 'in_invoice'
+ elif pick.type == 'in' and usage == 'customer':
+ type = 'out_refund'
+ else:
+ type = 'out_invoice'
+ return {'type': type}
+
+
+def _create_invoice(obj, cr, uid, data, context):
+ if data['form'].get('new_picking', False):
+ data['id'] = data['form']['new_picking']
+ data['ids'] = [data['form']['new_picking']]
+ pool = pooler.get_pool(cr.dbname)
+ picking_obj = pooler.get_pool(cr.dbname).get('stock.picking')
+ mod_obj = pool.get('ir.model.data')
+ act_obj = pool.get('ir.actions.act_window')
+
+ type = data['form']['type']
+
+ context['date_inv'] = data['form']['invoice_date']
+ res = picking_obj.action_invoice_create(cr, uid, data['ids'],
+ journal_id = data['form']['journal_id'], group=data['form']['group'],
+ type=type, context= context)
+
+ invoice_ids = res.values()
+ if not invoice_ids:
+ raise wizard.except_wizard(_('Error'), _('Invoice is not created'))
+
+ if type == 'out_invoice':
+ xml_id = 'action_invoice_tree1'
+ elif type == 'in_invoice':
+ xml_id = 'action_invoice_tree2'
+ elif type == 'out_refund':
+ xml_id = 'action_invoice_tree3'
+ else:
+ xml_id = 'action_invoice_tree4'
+
+ result = mod_obj._get_id(cr, uid, 'account', xml_id)
+ id = mod_obj.read(cr, uid, result, ['res_id'])
+ result = act_obj.read(cr, uid, id['res_id'])
+ result['res_id'] = invoice_ids
+ return result
+
+
+class make_invoice_onshipping(wizard.interface):
+ states = {
+ 'init': {
+ 'actions': [_get_type],
+ 'result': {
+ 'type': 'form',
+ 'arch': invoice_form,
+ 'fields': invoice_fields,
+ 'state': [
+ ('end', 'Cancel', 'gtk-cancel'),
+ ('create_invoice', 'Create invoice', 'gtk-apply', True)
+ ]
+ }
+ },
+ 'create_invoice': {
+ 'actions': [],
+ 'result': {
+ 'type': 'action',
+ 'action': _create_invoice,
+ 'state': 'end'
+ }
+ },
+ }
+
+make_invoice_onshipping("stock.invoice_onshipping")
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/stock/wizard/wizard_location_product.py b/addons/stock/wizard/wizard_location_product.py
new file mode 100755
index 00000000000..c423c426832
--- /dev/null
+++ b/addons/stock/wizard/wizard_location_product.py
@@ -0,0 +1,76 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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 .
+#
+##############################################################################
+
+import wizard
+import pooler
+import time
+
+def _action_open_window(self, cr, uid, data, context):
+ pool = pooler.get_pool(cr.dbname)
+ mod_obj = pool.get('ir.model.data')
+ result = mod_obj._get_id(cr, uid, 'product', 'product_search_form_view')
+ id = mod_obj.read(cr, uid, result, ['res_id'])
+ return {
+ 'name': False,
+ 'view_type': 'form',
+ "view_mode": 'tree,form',
+ 'res_model': 'product.product',
+ 'type': 'ir.actions.act_window',
+ 'context':{'location': data['ids'][0],'from_date':data['form']['from_date'],'to_date':data['form']['to_date']},
+ 'domain':[('type','<>','service')],
+ 'search_view_id': id['res_id']
+ }
+
+
+class product_by_location(wizard.interface):
+ form1 = '''
+