[MERGE] merged with lp:~openerp/openobject-addons/trunk/
bzr revid: hmo@tinyerp.com-20100422054243-xqnrbedvck4m5by8
This commit is contained in:
@@ -68,6 +68,10 @@ module named account_voucherss
|
||||
'wizard/account_validate_move_view.xml',
|
||||
'wizard/account_statement_from_invoice_view.xml',
|
||||
'wizard/account_pay_invoice_view.xml',
|
||||
'wizard/account_unreconcile_view.xml',
|
||||
'wizard/account_invoice_state_view.xml',
|
||||
'wizard/account_use_model_view.xml',
|
||||
'wizard/account_partner_balance_report_view.xml',
|
||||
'project/wizard/project_account_analytic_line_view.xml',
|
||||
'account_view.xml',
|
||||
'account_end_fy.xml',
|
||||
|
||||
@@ -1176,7 +1176,7 @@
|
||||
<separator string="Legend" colspan="4"/>
|
||||
<field name="legend" colspan="4" nolabel="1"/>
|
||||
<group col="1" colspan="4">
|
||||
<button name="%(wizard_account_use_model)d" string="Create entries" type="action" icon="gtk-execute"/>
|
||||
<button name="%(action_account_use_model_create_entry)d" string="Create entries" type="action" icon="gtk-execute"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
<!-- manual reconcile -->
|
||||
<wizard id="wizard_reconcile" model="account.move.line" name="account.move.line.reconcile" string="Reconcile Entries"/>
|
||||
|
||||
<wizard id="wizard_reconcile_unreconcile" model="account.move.reconcile" name="account.reconcile.unreconcile" string="Unreconcile Entries"/>
|
||||
<!-- <wizard id="wizard_reconcile_unreconcile" model="account.move.reconcile" name="account.reconcile.unreconcile" string="Unreconcile Entries"/>-->
|
||||
|
||||
|
||||
<!-- <wizard id="wizard_reconcile_select" menu="False" model="account.move.line" name="account.move.line.reconcile.select" string="Reconcile entries"/>
|
||||
@@ -57,7 +57,7 @@
|
||||
-->
|
||||
|
||||
<!-- unreconcile -->
|
||||
<wizard id="wizard_unreconcile" model="account.move.line" name="account.move.line.unreconcile" string="Unreconcile Entries"/>
|
||||
<!-- <wizard id="wizard_unreconcile" model="account.move.line" name="account.move.line.unreconcile" string="Unreconcile Entries"/>-->
|
||||
|
||||
<!-- unreconcile
|
||||
|
||||
@@ -76,8 +76,8 @@
|
||||
<menuitem icon="STOCK_PRINT" action="wizard_aged_trial_balance" id="menu_aged_trial_balance" parent="next_id_22" type="wizard"/>
|
||||
|
||||
<!-- report-related wizards -->
|
||||
<wizard id="wizard_partner_balance_report" menu="False" model="res.partner" name="account.partner.balance.report" string="Partner Balance"/>
|
||||
<menuitem icon="STOCK_PRINT" action="wizard_partner_balance_report" id="menu_partner_balance" parent="account.next_id_22" type="wizard"/>
|
||||
<!-- <wizard id="wizard_partner_balance_report" menu="False" model="res.partner" name="account.partner.balance.report" string="Partner Balance"/>
|
||||
<menuitem icon="STOCK_PRINT" action="wizard_partner_balance_report" id="menu_partner_balance" parent="account.next_id_22" type="wizard"/> -->
|
||||
|
||||
<wizard id="wizard_third_party_ledger" menu="False" model="res.partner" name="account.third_party_ledger.report" string="Partner Ledger"/>
|
||||
<menuitem icon="STOCK_PRINT" action="wizard_third_party_ledger" id="menu_third_party_ledger" parent="account.next_id_22" type="wizard"/>
|
||||
@@ -85,9 +85,9 @@
|
||||
<wizard id="wizard_balance_report" keyword="client_print_multi" model="account.account" name="account.account.balance.report" string="Account Balance"/>
|
||||
<wizard id="wizard_general_ledger_report" keyword="client_print_multi" model="account.account" name="account.general.ledger.report" string="General Ledger"/>
|
||||
|
||||
<wizard id="wizard_invoice_state_confirm" keyword="client_action_multi" model="account.invoice" multi="True" name="account.invoice.state.confirm" string="Confirm draft invoices" groups="base.group_user"/>
|
||||
<wizard id="wizard_invoice_state_cancel" keyword="client_action_multi" model="account.invoice" multi="True" name="account.invoice.state.cancel" string="Cancel selected invoices" groups="base.group_user"/>
|
||||
|
||||
<!-- <wizard id="wizard_invoice_state_confirm" keyword="client_action_multi" model="account.invoice" multi="True" name="account.invoice.state.confirm" string="Confirm draft invoices" groups="base.group_user"/>-->
|
||||
<!-- <wizard id="wizard_invoice_state_cancel" keyword="client_action_multi" model="account.invoice" multi="True" name="account.invoice.state.cancel" string="Cancel selected invoices" groups="base.group_user"/>-->
|
||||
<!---->
|
||||
|
||||
<!-- account.move validate -->
|
||||
<!-- <wizard id="wizard_validate_account_moves" menu="False" model="account.move" name="account.move.validate" string="Validate Ledger Postings"/>
|
||||
@@ -96,10 +96,10 @@
|
||||
<wizard id="wizard_validate_account_moves_line" menu="True" model="account.move.line" name="account.move_line.validate" string="Validate Ledger Postings"/>-->
|
||||
|
||||
<!-- Use Models -->
|
||||
<wizard string="Create Entries From Models" model="account.model" name="account_use_models" menu="False" id="wizard_account_use_model"/>
|
||||
<menuitem action="wizard_account_use_model" type="wizard" parent="account.menu_finance_recurrent_entries" id="menu_account_use_model"/>
|
||||
<!-- <wizard string="Create Entries From Models" model="account.model" name="account_use_models" menu="False" id="wizard_account_use_model"/>-->
|
||||
<!-- <menuitem action="wizard_account_use_model" type="wizard" parent="account.menu_finance_recurrent_entries" id="menu_account_use_model"/>-->
|
||||
|
||||
<wizard string="Create Entries From Models" model="account.move.line" name="account_use_models" menu="True" id="wizard_line_account_use_model"/>
|
||||
<!-- <wizard string="Create Entries From Models" model="account.move.line" name="account_use_models" menu="True" id="wizard_line_account_use_model"/>-->
|
||||
|
||||
<!-- account.invoice -->
|
||||
<!-- <wizard string="Open State" model="account.invoice" name="account.wizard_paid_open" menu="False" id="wizard_paid_open" groups="base.group_user"/> -->
|
||||
|
||||
@@ -13,7 +13,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-21 04:05+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: account
|
||||
|
||||
@@ -14,7 +14,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: account
|
||||
|
||||
@@ -13,7 +13,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: account
|
||||
|
||||
@@ -7,13 +7,13 @@ msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 5.0.0\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
|
||||
"PO-Revision-Date: 2010-03-24 14:33+0000\n"
|
||||
"Last-Translator: Anders Eriksson (Mobila System) <ae@mobilasystem.se>\n"
|
||||
"PO-Revision-Date: 2010-04-21 15:12+0000\n"
|
||||
"Last-Translator: djn (XCLUDE) <Unknown>\n"
|
||||
"Language-Team: <> <>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-17 04:08+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-22 03:43+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: account
|
||||
@@ -26,12 +26,6 @@ msgstr "Internt namn"
|
||||
msgid "Account Tax Code"
|
||||
msgstr "Konto, skattekod"
|
||||
|
||||
#. module: account
|
||||
#: model:ir.actions.act_window,name:account.action_invoice_tree9
|
||||
#: model:ir.ui.menu,name:account.menu_action_invoice_tree9
|
||||
msgid "Unpaid Supplier Invoices"
|
||||
msgstr "Obetalda leverantörsfakturor"
|
||||
|
||||
#. module: account
|
||||
#: model:ir.ui.menu,name:account.menu_finance_entries
|
||||
msgid "Entries Encoding"
|
||||
@@ -1593,7 +1587,7 @@ msgstr "Moms"
|
||||
#. module: account
|
||||
#: rml:account.analytic.account.journal:0
|
||||
msgid "Account n°"
|
||||
msgstr ""
|
||||
msgstr "Konto Nr"
|
||||
|
||||
#. module: account
|
||||
#: view:account.tax:0
|
||||
|
||||
@@ -324,6 +324,17 @@ class account_invoice(osv.osv):
|
||||
'user_id': lambda s,cr,u,c: u,
|
||||
}
|
||||
|
||||
def create(self, cr, uid, vals, context={}):
|
||||
try:
|
||||
res = super(account_invoice, self).create(cr, uid, vals, context)
|
||||
return res
|
||||
except Exception,e:
|
||||
if '"journal_id" viol' in e.args[0]:
|
||||
raise except_orm(_('Configuration Error!'),
|
||||
_('There is no Accounting Journal of type Sale/Purchase defined!'))
|
||||
else:
|
||||
raise except_orm(_('UnknownError'), str(e))
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
invoices = self.read(cr, uid, ids, ['state'])
|
||||
unlink_ids = []
|
||||
|
||||
@@ -67,10 +67,10 @@ class partner_balance(report_sxw.rml_parse):
|
||||
## Get All Period Date
|
||||
#
|
||||
# If we have no period we will take all perdio in the FiscalYear.
|
||||
if not data['form']['periods'][0][2] :
|
||||
if not data['form']['periods']:
|
||||
periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
|
||||
else:
|
||||
periods_id = data['form']['periods'][0][2]
|
||||
periods_id = data['form']['periods']
|
||||
date_array = []
|
||||
for period_id in periods_id:
|
||||
period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id)
|
||||
@@ -85,35 +85,38 @@ class partner_balance(report_sxw.rml_parse):
|
||||
self.date_lst.sort()
|
||||
|
||||
def transform_both_into_date_array(self,data):
|
||||
if not data['form']['periods'][0][2] :
|
||||
final_date_array = []
|
||||
date_start_date = data['form']['date1']
|
||||
date_stop_date = data['form']['date2']
|
||||
if not data['form']['periods']:
|
||||
periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
|
||||
else:
|
||||
periods_id = data['form']['periods'][0][2]
|
||||
periods_id = data['form']['periods']
|
||||
date_array = []
|
||||
for period_id in periods_id:
|
||||
period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id)
|
||||
date_array = date_array + self.date_range(period_obj.date_start,period_obj.date_stop)
|
||||
if periods_id:
|
||||
for period_id in periods_id:
|
||||
period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id)
|
||||
date_array = date_array + self.date_range(period_obj.date_start,period_obj.date_stop)
|
||||
period_start_date = date_array[0]
|
||||
period_stop_date = date_array[-1]
|
||||
|
||||
period_start_date = date_array[0]
|
||||
date_start_date = data['form']['date1']
|
||||
period_stop_date = date_array[-1]
|
||||
date_stop_date = data['form']['date2']
|
||||
if period_start_date<date_start_date:
|
||||
start_date = period_start_date
|
||||
else :
|
||||
start_date = date_start_date
|
||||
|
||||
if period_start_date<date_start_date:
|
||||
start_date = period_start_date
|
||||
if date_stop_date<period_stop_date:
|
||||
stop_date = period_stop_date
|
||||
else :
|
||||
stop_date = date_stop_date
|
||||
|
||||
final_date_array = final_date_array + self.date_range(start_date,stop_date)
|
||||
self.date_lst = final_date_array
|
||||
self.date_lst.sort()
|
||||
else :
|
||||
start_date = date_start_date
|
||||
|
||||
if date_stop_date<period_stop_date:
|
||||
stop_date = period_stop_date
|
||||
else :
|
||||
stop_date = date_stop_date
|
||||
|
||||
|
||||
final_date_array = []
|
||||
final_date_array = final_date_array + self.date_range(start_date,stop_date)
|
||||
self.date_lst = final_date_array
|
||||
self.date_lst.sort()
|
||||
final_date_array = final_date_array + self.date_range(date_start_date,date_stop_date)
|
||||
self.date_lst = final_date_array
|
||||
self.date_lst.sort()
|
||||
|
||||
def transform_none_into_date_array(self,data):
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import wizard_automatic_reconcile
|
||||
import account_move_line_reconcile_select
|
||||
import account_move_line_unreconcile_select
|
||||
import wizard_reconcile
|
||||
import wizard_unreconcile
|
||||
import account_unreconcile
|
||||
import account_invoice_refund
|
||||
import account_pay_invoice
|
||||
import account_move_journal
|
||||
@@ -33,8 +33,7 @@ import account_subscription_generate
|
||||
import wizard_aged_trial_balance
|
||||
import wizard_general_ledger_report
|
||||
import wizard_third_party_ledger
|
||||
import wizard_account_balance_report
|
||||
import wizard_partner_balance_report
|
||||
import account_partner_balance_report
|
||||
import account_period_close
|
||||
import account_fiscalyear_close
|
||||
import account_fiscalyear_close_state
|
||||
@@ -42,13 +41,13 @@ import account_vat
|
||||
import account_open_closed_fiscalyear
|
||||
|
||||
import wizard_compare_account_balance_report
|
||||
import wizard_invoice_state
|
||||
import account_invoice_state
|
||||
import wizard_account_duplicate
|
||||
import account_chart
|
||||
import wizard_move_line_select
|
||||
|
||||
import account_validate_account_move
|
||||
import wizard_use_model
|
||||
import account_use_model
|
||||
|
||||
import account_state_open
|
||||
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
import netsvc
|
||||
|
||||
class account_invoice_confirm(osv.osv_memory):
|
||||
"""
|
||||
This wizard will confirm the all the selected draft invoices
|
||||
"""
|
||||
|
||||
_name = "account.invoice.confirm"
|
||||
_description = "Confirm the selected invoices"
|
||||
|
||||
def invoice_confirm(self, cr, uid, ids, context=None):
|
||||
wf_service = netsvc.LocalService('workflow')
|
||||
if context is None:
|
||||
context = {}
|
||||
for id in context['active_ids']:
|
||||
wf_service.trg_validate(uid, 'account.invoice', id, 'invoice_open', cr)
|
||||
return {}
|
||||
|
||||
account_invoice_confirm()
|
||||
|
||||
class account_invoice_cancel(osv.osv_memory):
|
||||
"""
|
||||
This wizard will cancel the all the selected invoices.
|
||||
If in the journal, the option allow cancelling entry is not selected then it will give warning message.
|
||||
"""
|
||||
|
||||
_name = "account.invoice.cancel"
|
||||
_description = "Cancel the selected invoices"
|
||||
|
||||
def invoice_cancel(self, cr, uid, ids, context=None):
|
||||
wf_service = netsvc.LocalService('workflow')
|
||||
if context is None:
|
||||
context = {}
|
||||
for id in context['active_ids']:
|
||||
wf_service.trg_validate(uid, 'account.invoice', id, 'invoice_cancel', cr)
|
||||
return {}
|
||||
|
||||
account_invoice_cancel()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,73 @@
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="account_invoice_confirm_view" model="ir.ui.view">
|
||||
<field name="name">account.invoice.confirm.form</field>
|
||||
<field name="model">account.invoice.confirm</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Confirm draft invoices">
|
||||
<separator string="Confirm draft invoices" colspan="4"/>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-execute" string="Confirm Invoices" name="invoice_confirm" type="object" default_focus="1"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_invoice_confirm" model="ir.actions.act_window">
|
||||
<field name="name">Confirm draft invoices</field>
|
||||
<field name="res_model">account.invoice.confirm</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_invoice_confirm_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="action_account_invoice_confirm_values">
|
||||
<field name="model_id" ref="account.model_account_invoice" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Confirm draft invoices</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' +str(ref('action_account_invoice_confirm'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">account.invoice</field>
|
||||
</record>
|
||||
|
||||
<record id="account_invoice_cancel_view" model="ir.ui.view">
|
||||
<field name="name">account.invoice.cancel.form</field>
|
||||
<field name="model">account.invoice.cancel</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Cancel selected invoices">
|
||||
<separator string="Cancel selected invoices" colspan="4"/>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-execute" string="Cancel selected invoices" name="invoice_cancel" type="object" default_focus="1"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_invoice_cancel" model="ir.actions.act_window">
|
||||
<field name="name">Cancel selected invoices</field>
|
||||
<field name="res_model">account.invoice.cancel</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_invoice_cancel_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="action_account_invoice_cancel_values">
|
||||
<field name="model_id" ref="account.model_account_invoice" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Cancel selected invoices</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' +str(ref('action_account_invoice_cancel'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">account.invoice</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -0,0 +1,109 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
|
||||
from tools.translate import _
|
||||
from osv import fields, osv
|
||||
|
||||
class account_partner_balance(osv.osv_memory):
|
||||
"""
|
||||
This wizard will provide the partner balance report by periods, between any two dates.
|
||||
"""
|
||||
_name = 'account.partner.balance'
|
||||
_description = 'Account Partner Balance'
|
||||
_columns = {
|
||||
'company_id': fields.many2one('res.company', 'Company', required=True),
|
||||
'state': fields.selection([('bydate','By Date'),
|
||||
('byperiod','By Period'),
|
||||
('all','By Date and Period'),
|
||||
('none','No Filter')
|
||||
],'Date/Period Filter'),
|
||||
'fiscalyear': fields.many2one('account.fiscalyear', 'Fiscal year', help='Keep empty for all open fiscal year'),
|
||||
'periods': fields.many2many('account.period', 'period_report_rel', 'report_id', 'period_id', 'Periods', help='All periods if empty'),
|
||||
'result_selection': fields.selection([('customer','Receivable Accounts'),
|
||||
('supplier','Payable Accounts'),
|
||||
('all','Receivable and Payable Accounts')],
|
||||
'Partner', required=True),
|
||||
'soldeinit': fields.boolean('Include initial balances'),
|
||||
'date1': fields.date('Start date', required=True),
|
||||
'date2': fields.date('End date', required=True),
|
||||
}
|
||||
|
||||
def _get_company(self, cr, uid, ids, context=None):
|
||||
user_obj = self.pool.get('res.users')
|
||||
company_obj = self.pool.get('res.company')
|
||||
user = user_obj.browse(cr, uid, uid, context=context)
|
||||
if user.company_id:
|
||||
return user.company_id.id
|
||||
else:
|
||||
return company_obj.search(cr, uid, [('parent_id', '=', False)])[0]
|
||||
|
||||
_defaults={
|
||||
'state' : 'none',
|
||||
'date1' : lambda *a: time.strftime('%Y-01-01'),
|
||||
'date2' : lambda *a: time.strftime('%Y-%m-%d'),
|
||||
'result_selection' : lambda *a: 'all',
|
||||
'soldeinit' : True,
|
||||
'company_id' : _get_company,
|
||||
'fiscalyear' : False,
|
||||
}
|
||||
|
||||
def check_state(self, cr, uid, ids, context=None):
|
||||
data = {
|
||||
'ids':[],
|
||||
'model': 'res.partner',
|
||||
'form': self.read(cr, uid, ids, [])[0],
|
||||
}
|
||||
|
||||
if data['form']['state'] == 'bydate' :
|
||||
return self._check_date(cr, uid, data, context)
|
||||
if data['form']['state'] == 'byperiod':
|
||||
if not data['form']['periods']:
|
||||
raise osv.except_osv(_('Warning'),_('Please Enter Periods ! '))
|
||||
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.partner.balance',
|
||||
'datas': data,
|
||||
}
|
||||
|
||||
def _check_date(self, cr, uid, data, context):
|
||||
sql = """
|
||||
SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where %s between f.date_start and f.date_stop """
|
||||
cr.execute(sql,(data['form']['date1'],))
|
||||
res = cr.dictfetchall()
|
||||
if res:
|
||||
if (data['form']['date2'] > res[0]['date_stop'] or data['form']['date2'] < res[0]['date_start']):
|
||||
raise osv.except_osv(_('UserError'),_('Date to must be set between %s and %s') % (str(res[0]['date_start']), str(res[0]['date_stop'])))
|
||||
else:
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.partner.balance',
|
||||
'datas': data,
|
||||
}
|
||||
else:
|
||||
raise osv.except_osv(_('UserError'),_('Date not in a defined fiscal year'))
|
||||
|
||||
account_partner_balance()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="account_partner_balance_view" model="ir.ui.view">
|
||||
<field name="name">Select period</field>
|
||||
<field name="model">account.partner.balance</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Select Date-Period">
|
||||
<field name="company_id"/>
|
||||
<field name="result_selection" required = "True"/>
|
||||
<newline/>
|
||||
<field name="fiscalyear"/>
|
||||
<label colspan="2" string="(Keep empty for all open fiscal years)" align="0.0"/>
|
||||
<newline/>
|
||||
<separator string="Filters" colspan="4"/>
|
||||
<field name="state" required="True"/>
|
||||
<newline/>
|
||||
<group attrs="{'invisible':[('state','=','none')]}" colspan="4">
|
||||
<group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4">
|
||||
<separator string="Date Filter" colspan="4"/>
|
||||
<field name="date1"/>
|
||||
<field name="date2"/>
|
||||
</group>
|
||||
<group attrs="{'invisible':[('state','=','bydate')]}" colspan="4">
|
||||
<separator string="Filter on Periods" colspan="4"/>
|
||||
<field name="periods" colspan="4" nolabel="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<newline/>
|
||||
<group colspan="4" col="6">
|
||||
<label string ="" colspan="2"/>
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="check_state" string="Print" type="object" icon="gtk-print"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_partner_balance" model="ir.actions.act_window">
|
||||
<field name="name">Select Period</field>
|
||||
<field name="res_model">account.partner.balance</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="account_partner_balance_view"/>
|
||||
<field name="context">{'record_id':active_id}</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem icon="STOCK_PRINT"
|
||||
name="Partner Balance"
|
||||
action="action_account_partner_balance"
|
||||
id="menu_account_partner_balance_report"
|
||||
parent="account.next_id_22"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -0,0 +1,55 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
from osv import fields, osv
|
||||
|
||||
class account_unreconcile(osv.osv_memory):
|
||||
_name = "account.unreconcile"
|
||||
_description = "Account Unreconcile"
|
||||
|
||||
def trans_unrec(self, cr, uid, ids, context=None):
|
||||
obj_move_line = self.pool.get('account.move.line')
|
||||
obj_move_reconcile = self.pool.get('account.move.reconcile')
|
||||
if context is None:
|
||||
context = {}
|
||||
recs = obj_move_line.read(cr, uid, context['active_ids'], ['reconcile_id',])
|
||||
recs = filter(lambda x: x['reconcile_id'], recs)
|
||||
rec_ids = [rec['reconcile_id'][0] for rec in recs]
|
||||
if len(rec_ids):
|
||||
obj_move_reconcile.unlink(cr, uid, rec_ids)
|
||||
return {}
|
||||
|
||||
account_unreconcile()
|
||||
|
||||
class account_unreconcile_reconcile(osv.osv_memory):
|
||||
_name = "account.unreconcile.reconcile"
|
||||
_description = "Account Unreconcile Reconcile"
|
||||
|
||||
def trans_unrec_reconcile(self, cr, uid, ids, context=None):
|
||||
obj_move_reconcile = self.pool.get('account.move.reconcile')
|
||||
if context is None:
|
||||
context = {}
|
||||
if len(rec_ids):
|
||||
obj_move_reconcile.unlink(cr, uid, context['active_ids'])
|
||||
return {}
|
||||
|
||||
account_unreconcile_reconcile()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="account_unreconcile_view" model="ir.ui.view">
|
||||
<field name="name">Unreconcile Entries</field>
|
||||
<field name="model">account.unreconcile</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Unreconciliation">
|
||||
<separator string="Unreconciliation transactions" colspan="4"/>
|
||||
<image name="gtk-dialog-info"/>
|
||||
<label string="If you unreconciliate transactions, you must also verify all the actions that are linked to those transactions because they will not be disable" colspan="2"/>
|
||||
<separator colspan="4"/>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-ok" string="Unreconcile" name="trans_unrec" type="object" default_focus="1"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_unreconcile" model="ir.actions.act_window">
|
||||
<field name="name">Unreconcile Entries</field>
|
||||
<field name="res_model">account.unreconcile</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_unreconcile_view"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="account_unreconcile_values">
|
||||
<field name="model_id" ref="account.model_account_move_line" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Unreconcile Entries</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_unreconcile'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">account.move.line</field>
|
||||
</record>
|
||||
|
||||
<record id="account_unreconcile_reconcile_view" model="ir.ui.view">
|
||||
<field name="name">Unreconcile Entries</field>
|
||||
<field name="model">account.unreconcile.reconcile</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Unreconciliation">
|
||||
<separator string="Unreconciliation transactions" colspan="4"/>
|
||||
<image name="gtk-dialog-info"/>
|
||||
<label string="If you unreconciliate transactions, you must also verify all the actions that are linked to those transactions because they will not be disable" colspan="2"/>
|
||||
<separator colspan="4"/>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-ok" string="Unreconcile" name="trans_unrec_reconcile" type="object" default_focus="1"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_unreconcile_reconcile" model="ir.actions.act_window">
|
||||
<field name="name">Unreconcile Entries</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.unreconcile.reconcile</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="account_unreconcile_reconcile_view"/>
|
||||
<field name="context">{'record_id' : active_id}</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="account_unreconcile_reconcile_values">
|
||||
<field name="model_id" ref="account.model_account_move_reconcile" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Unreconcile Entries</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_unreconcile_reconcile'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">account.move.reconcile</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
import time
|
||||
import datetime
|
||||
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
|
||||
class account_use_model(osv.osv_memory):
|
||||
|
||||
_name = 'account.use.model'
|
||||
_description = 'Use model'
|
||||
_columns = {
|
||||
'model': fields.many2many('account.model', 'account_use_model_relation','account_id','model_id','Account Model'),
|
||||
}
|
||||
|
||||
def create_entries(self, cr, uid, ids, context=None):
|
||||
account_model_obj = self.pool.get('account.model')
|
||||
account_period_obj = self.pool.get('account.period')
|
||||
account_move_obj = self.pool.get('account.move')
|
||||
account_move_line_obj = self.pool.get('account.move.line')
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
data = self.read(cr, uid, ids,context=context)[0]
|
||||
record_id = context and context.get('model_line', False) or False
|
||||
if record_id:
|
||||
data_model = account_model_obj.browse(cr,uid,data['model'])
|
||||
else:
|
||||
data_model = account_model_obj.browse(cr,uid,context['active_ids'])
|
||||
move_ids = []
|
||||
for model in data_model:
|
||||
period_id = account_period_obj.find(cr, uid, context=context)
|
||||
if not period_id:
|
||||
raise osv.except_osv(_('No period found !'), _('Unable to find a valid period !'))
|
||||
period_id = period_id[0]
|
||||
move_id = account_move_obj.create(cr, uid, {
|
||||
'ref': model.ref,
|
||||
'period_id': period_id,
|
||||
'journal_id': model.journal_id.id,
|
||||
})
|
||||
move_ids.append(move_id)
|
||||
for line in model.lines_id:
|
||||
val = {
|
||||
'move_id': move_id,
|
||||
'journal_id': model.journal_id.id,
|
||||
'period_id': period_id
|
||||
}
|
||||
val.update({
|
||||
'name': line.name,
|
||||
'quantity': line.quantity,
|
||||
'debit': line.debit,
|
||||
'credit': line.credit,
|
||||
'account_id': line.account_id.id,
|
||||
'move_id': move_id,
|
||||
'ref': line.ref,
|
||||
'partner_id': line.partner_id.id,
|
||||
'date': time.strftime('%Y-%m-%d'),
|
||||
'date_maturity': time.strftime('%Y-%m-%d')
|
||||
})
|
||||
c = context.copy()
|
||||
c.update({'journal_id': model.journal_id.id,'period_id': period_id})
|
||||
id_line = account_move_line_obj.create(cr, uid, val, context=c)
|
||||
context.update({'move_ids':move_ids})
|
||||
model_data_ids = mod_obj.search(cr, uid,[('model','=','ir.ui.view'),('name','=','view_account_use_model_open_entry')], context=context)
|
||||
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
|
||||
return {
|
||||
'name': _('Use Model'),
|
||||
'context': context,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'account.use.model',
|
||||
'views': [(resource_id,'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
}
|
||||
|
||||
def open_moves(self, cr, uid, ids, context=None):
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
if context is None:
|
||||
context = {}
|
||||
model_data_ids = mod_obj.search(cr, uid,[('model','=','ir.ui.view'),('name','=','view_move_form')], context=context)
|
||||
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
|
||||
return {
|
||||
'domain': "[('id','in', ["+','.join(map(str,context['move_ids']))+"])]",
|
||||
'name': 'Entries',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'account.move',
|
||||
'views': [(False,'tree'),(resource_id,'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
|
||||
account_use_model()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_account_use_model" model="ir.ui.view">
|
||||
<field name="name">account.use.model.form</field>
|
||||
<field name="model">account.use.model</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Create Entries From Models">
|
||||
<group colspan="4" >
|
||||
<field name="model"/>
|
||||
</group>
|
||||
<group colspan="4" col="6">
|
||||
<label string ="" colspan="2"/>
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-execute" string="Create Entries" name="create_entries" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_view_account_use_model" model="ir.actions.act_window">
|
||||
<field name="name">Create Entries From Models</field>
|
||||
<field name="res_model">account.use.model</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_account_use_model"/>
|
||||
<field name="target">new</field>
|
||||
<field name="context">{'model_line':'model_line'}</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="action_account_use_model_values">
|
||||
<field name="model_id" ref="account.model_account_move_line" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Create Entries From Models</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' +str(ref('action_view_account_use_model'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">account.move.line</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_view_account_use_model" name="Create Entries From Models"
|
||||
parent="account.menu_finance_recurrent_entries" id="menu_account_use_model"/>
|
||||
|
||||
<record id="view_account_use_model_open_entry" model="ir.ui.view">
|
||||
<field name="name">account.use.model.open.entry.form</field>
|
||||
<field name="model">account.use.model</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Use Model">
|
||||
<group colspan="4" col="6">
|
||||
<label string = "Entry Lines Created." colspan="2"/>
|
||||
<newline/>
|
||||
<button icon="gtk-ok" special="cancel" string="Ok"/>
|
||||
<button icon="gtk-execute" string="Open" name="open_moves" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_account_use_model_create_entry" model="ir.ui.view">
|
||||
<field name="name">account.use.model.create.entry.form</field>
|
||||
<field name="model">account.use.model</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Use Model">
|
||||
<group colspan="4" col="6">
|
||||
<label string = "Are you sure you want to create entries?" colspan="2"/>
|
||||
<newline/>
|
||||
<button icon="gtk-ok" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-execute" string="Ok" name="create_entries" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_use_model_create_entry" model="ir.actions.act_window">
|
||||
<field name="name">Create Entries From Models</field>
|
||||
<field name="res_model">account.use.model</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_account_use_model_create_entry"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -64,7 +64,7 @@
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="event_registration_values">
|
||||
<record model="ir.values" id="validate_account_move_line_values">
|
||||
<field name="model_id" ref="account.model_account_move_line" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Validate Ledger Postings</field>
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
|
||||
def _invoice_confirm(self, cr, uid, data, context):
|
||||
wf_service = netsvc.LocalService('workflow')
|
||||
for id in data['ids']:
|
||||
wf_service.trg_validate(uid, 'account.invoice', id, 'invoice_open', cr)
|
||||
return {}
|
||||
|
||||
class wizard_invoice_confirm(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_invoice_confirm],
|
||||
'result': {'type':'state', 'state':'end'}
|
||||
}
|
||||
}
|
||||
wizard_invoice_confirm('account.invoice.state.confirm')
|
||||
|
||||
|
||||
def _invoice_cancel(self, cr, uid, data, context):
|
||||
wf_service = netsvc.LocalService('workflow')
|
||||
for id in data['ids']:
|
||||
wf_service.trg_validate(uid, 'account.invoice', id, 'invoice_cancel', cr)
|
||||
return {}
|
||||
|
||||
class wizard_invoice_cancel(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_invoice_cancel],
|
||||
'result': {'type':'state', 'state':'end'}
|
||||
}
|
||||
}
|
||||
wizard_invoice_cancel('account.invoice.state.cancel')
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
import wizard
|
||||
import pooler
|
||||
from tools.translate import _
|
||||
|
||||
period_form = '''<?xml version="1.0"?>
|
||||
<form string="Select Date-Period">
|
||||
<field name="company_id"/>
|
||||
<field name="result_selection"/>
|
||||
<newline/>
|
||||
<field name="fiscalyear"/>
|
||||
<label colspan="2" string="(Keep empty for all open fiscal years)" align="0.0"/>
|
||||
<newline/>
|
||||
<separator string="Filters" colspan="4"/>
|
||||
<field name="state" required="True"/>
|
||||
<newline/>
|
||||
<group attrs="{'invisible':[('state','=','none')]}" colspan="4">
|
||||
<group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4">
|
||||
<separator string="Date Filter" colspan="4"/>
|
||||
<field name="date1"/>
|
||||
<field name="date2"/>
|
||||
</group>
|
||||
<group attrs="{'invisible':[('state','=','bydate')]}" colspan="4">
|
||||
<separator string="Filter on Periods" colspan="4"/>
|
||||
<field name="periods" colspan="4" nolabel="1"/>
|
||||
</group>
|
||||
</group>
|
||||
</form>'''
|
||||
|
||||
period_fields = {
|
||||
'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True},
|
||||
'state':{
|
||||
'string':"Date/Period Filter",
|
||||
'type':'selection',
|
||||
'selection':[('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],
|
||||
'default': lambda *a:'none'
|
||||
},
|
||||
'fiscalyear': {
|
||||
'string':'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear',
|
||||
'default': lambda *a:False,
|
||||
'help': 'Keep empty for all open fiscal year'
|
||||
},
|
||||
'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty'},
|
||||
'result_selection':{
|
||||
'string':"Partner",
|
||||
'type':'selection',
|
||||
'selection':[('customer','Receivable Accounts'),('supplier','Payable Accounts'),('all','Receivable and Payable Accounts')],
|
||||
'required':True
|
||||
},
|
||||
'soldeinit':{'string':"Include initial balances",'type':'boolean'},
|
||||
'date1': {'string':' Start date', 'type':'date', 'required':True,'default': lambda *a: time.strftime('%Y-01-01')},
|
||||
'date2': {'string':'End date', 'type':'date', 'required':True,'default': lambda *a: time.strftime('%Y-%m-%d')},
|
||||
}
|
||||
|
||||
class wizard_report(wizard.interface):
|
||||
|
||||
def _get_defaults(self,cr,uid,data,context):
|
||||
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context)
|
||||
if user.company_id:
|
||||
company_id = user.company_id.id
|
||||
else:
|
||||
company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
|
||||
|
||||
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
|
||||
periods_obj=pooler.get_pool(cr.dbname).get('account.period')
|
||||
data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
|
||||
data['form']['periods'] =periods_obj.search(cr, uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
|
||||
data['form']['company_id'] = company_id
|
||||
data['form']['soldeinit'] = True
|
||||
data['form']['fiscalyear'] = False
|
||||
data['form']['result_selection'] = 'all'
|
||||
return data['form']
|
||||
|
||||
def _check_state(self, cr, uid, data, context):
|
||||
|
||||
if data['form']['state'] == 'bydate' :
|
||||
self._check_date(cr, uid, data, context)
|
||||
return data['form']
|
||||
|
||||
def _check_date(self, cr, uid, data, context):
|
||||
sql = """
|
||||
SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where %s between f.date_start and f.date_stop """
|
||||
cr.execute(sql,(data['form']['date1'],))
|
||||
res = cr.dictfetchall()
|
||||
if res:
|
||||
if (data['form']['date2'] > res[0]['date_stop'] or data['form']['date2'] < res[0]['date_start']):
|
||||
raise wizard.except_wizard(_('UserError'),_('Date to must be set between %s and %s') % (str(res[0]['date_start']), str(res[0]['date_stop'])))
|
||||
else:
|
||||
return 'report'
|
||||
|
||||
else:
|
||||
raise wizard.except_wizard(_('UserError'),_('Date not in a defined fiscal year'))
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_get_defaults],
|
||||
'result': {'type':'form', 'arch':period_form, 'fields':period_fields, 'state':[('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]}
|
||||
},
|
||||
|
||||
'report': {
|
||||
'actions': [_check_state],
|
||||
'result': {'type':'print', 'report':'account.partner.balance', 'state':'end'}
|
||||
}
|
||||
}
|
||||
wizard_report('account.partner.balance.report')
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -1,76 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import pooler
|
||||
|
||||
_info_form = '''<?xml version="1.0"?>
|
||||
<form string="Unreconciliation">
|
||||
<separator string="Unreconciliation transactions" colspan="4"/>
|
||||
<image name="gtk-dialog-info" colspan="2"/>
|
||||
<label string="If you unreconciliate transactions, you must also verify all the actions that are linked to those transactions because they will not be disable" colspan="2"/>
|
||||
</form>'''
|
||||
|
||||
def _trans_unrec(self, cr, uid, data, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
recs = pool.get('account.move.line').read(cr, uid, data['ids'], ['reconcile_id',])
|
||||
recs = filter(lambda x: x['reconcile_id'], recs)
|
||||
rec_ids = [rec['reconcile_id'][0] for rec in recs]
|
||||
if len(rec_ids):
|
||||
pooler.get_pool(cr.dbname).get('account.move.reconcile').unlink(cr, uid, rec_ids)
|
||||
return {}
|
||||
|
||||
class wiz_unreconcile(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type': 'form', 'arch': _info_form, 'fields': {}, 'state':[('end', 'Cancel', 'gtk-cancel'), ('unrec', 'Unreconcile', 'gtk-ok')]}
|
||||
},
|
||||
'unrec': {
|
||||
'actions': [_trans_unrec],
|
||||
'result': {'type': 'state', 'state':'end'}
|
||||
}
|
||||
}
|
||||
wiz_unreconcile('account.move.line.unreconcile')
|
||||
|
||||
|
||||
def _trans_unrec_reconcile(self, cr, uid, data, context):
|
||||
rec_ids = data['ids']
|
||||
if len(rec_ids):
|
||||
pooler.get_pool(cr.dbname).get('account.move.reconcile').unlink(cr, uid, rec_ids)
|
||||
return {}
|
||||
|
||||
class wiz_unreconcile_reconcile(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type': 'form', 'arch': _info_form, 'fields': {}, 'state':[('end', 'Cancel', 'gtk-cancel'), ('unrec', 'Unreconcile', 'gtk-ok')]}
|
||||
},
|
||||
'unrec': {
|
||||
'actions': [_trans_unrec_reconcile],
|
||||
'result': {'type': 'state', 'state':'end'}
|
||||
}
|
||||
}
|
||||
wiz_unreconcile_reconcile('account.reconcile.unreconcile')
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import time
|
||||
import datetime
|
||||
import pooler
|
||||
from tools.translate import _
|
||||
|
||||
model_form = """<?xml version="1.0"?>
|
||||
<form string="Create entries from models">
|
||||
<field name="model"/>
|
||||
</form>"""
|
||||
|
||||
model_fields = {
|
||||
'model': {'string': 'Account Model', 'type': 'many2many', 'relation': 'account.model', 'required': True},
|
||||
}
|
||||
|
||||
form = """<?xml version="1.0"?>
|
||||
<form string="Use Model">
|
||||
<label string="Entry Lines Created."/>
|
||||
</form>
|
||||
"""
|
||||
fields = {
|
||||
}
|
||||
def _create_entries(self, cr, uid, data, context):
|
||||
pool_obj = pooler.get_pool(cr.dbname)
|
||||
if data['model']=='ir.ui.menu' or data['model']=='account.move.line':
|
||||
model_ids = data['form']['model'][0][2]
|
||||
data_model = pool_obj.get('account.model').browse(cr,uid,model_ids)
|
||||
else:
|
||||
data_model = pool_obj.get('account.model').browse(cr,uid,data['ids'])
|
||||
move_ids = []
|
||||
for model in data_model:
|
||||
|
||||
period_id = pool_obj.get('account.period').find(cr,uid, context=context)
|
||||
if not period_id:
|
||||
raise wizard.except_wizard(_('No period found !'), _('Unable to find a valid period !'))
|
||||
period_id = period_id[0]
|
||||
move_id = pool_obj.get('account.move').create(cr, uid, {
|
||||
'ref': model.ref,
|
||||
'period_id': period_id,
|
||||
'journal_id': model.journal_id.id,
|
||||
})
|
||||
move_ids.append(move_id)
|
||||
for line in model.lines_id:
|
||||
val = {
|
||||
'move_id': move_id,
|
||||
'journal_id': model.journal_id.id,
|
||||
'period_id': period_id
|
||||
}
|
||||
val.update({
|
||||
'name': line.name,
|
||||
'quantity': line.quantity,
|
||||
'debit': line.debit,
|
||||
'credit': line.credit,
|
||||
'account_id': line.account_id.id,
|
||||
'move_id': move_id,
|
||||
'ref': line.ref,
|
||||
'partner_id': line.partner_id.id,
|
||||
'date': time.strftime('%Y-%m-%d'),
|
||||
'date_maturity': time.strftime('%Y-%m-%d')
|
||||
})
|
||||
c = context.copy()
|
||||
c.update({'journal_id': model.journal_id.id,'period_id': period_id})
|
||||
id_line = pool_obj.get('account.move.line').create(cr, uid, val, context=c)
|
||||
data['form']['move_ids']=move_ids
|
||||
return data['form']
|
||||
|
||||
class use_model(wizard.interface):
|
||||
|
||||
def _open_moves(self, cr, uid, data, context):
|
||||
pool_obj = pooler.get_pool(cr.dbname)
|
||||
model_data_ids = pool_obj.get('ir.model.data').search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_move_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']['move_ids']))+"])]",
|
||||
'name': 'Entries',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'account.move',
|
||||
'views': [(False,'tree'),(resource_id,'form')],
|
||||
'type': 'ir.actions.act_window'
|
||||
}
|
||||
|
||||
def _check(self, cr, uid, data, context):
|
||||
if data['model']=='ir.ui.menu' or data['model']=='account.move.line':
|
||||
return 'init_form'
|
||||
return 'create'
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type':'choice','next_state':_check}
|
||||
},
|
||||
'init_form': {
|
||||
'actions': [],
|
||||
'result': {'type':'form', 'arch':model_form, 'fields':model_fields, 'state':[('end','Cancel', 'gtk-cancel'),('create','Create', 'gtk-ok')]},
|
||||
},
|
||||
'create': {
|
||||
'actions': [_create_entries],
|
||||
'result': {'type': 'form','arch':form, 'fields':fields, 'state':[('end','Ok'),('open_move','Open')]},
|
||||
},
|
||||
'open_move': {
|
||||
'actions': [],
|
||||
'result': {'type':'action', 'action':_open_moves, 'state':'end'}
|
||||
}
|
||||
}
|
||||
|
||||
use_model("account_use_models")# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -234,6 +234,9 @@ class account_analytic_plan_instance_line(osv.osv):
|
||||
'analytic_account_id':fields.many2one('account.analytic.account','Analytic Account', required=True),
|
||||
'rate':fields.float('Rate (%)', required=True),
|
||||
}
|
||||
_defaults = {
|
||||
'rate': lambda *args: 100.0
|
||||
}
|
||||
def name_get(self, cr, uid, ids, context={}):
|
||||
if not len(ids):
|
||||
return []
|
||||
|
||||
@@ -14,7 +14,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: account_analytic_plans
|
||||
|
||||
@@ -14,7 +14,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: account_anglo_saxon
|
||||
|
||||
@@ -14,7 +14,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: account_balance
|
||||
|
||||
@@ -14,7 +14,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-20 03:32+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-21 04:05+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: account_followup
|
||||
|
||||
@@ -14,7 +14,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: account_invoice_layout
|
||||
|
||||
@@ -13,7 +13,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-20 03:32+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-21 04:05+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: account_tax_include
|
||||
|
||||
@@ -14,7 +14,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: analytic_user_function
|
||||
|
||||
@@ -13,7 +13,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: analytic_user_function
|
||||
|
||||
@@ -481,10 +481,11 @@ class auction_lots(osv.osv):
|
||||
return result
|
||||
|
||||
def name_search(self, cr, user, name, args=None, operator='ilike', context={}):
|
||||
if not args:
|
||||
if not len(args):
|
||||
args = []
|
||||
|
||||
ids = self.search(cr, user, [('obj_num','=',int(name))] + args)
|
||||
ids = []
|
||||
if name:
|
||||
ids = self.search(cr, user, [('obj_num','=',int(name))] + args)
|
||||
if not ids:
|
||||
ids = self.search(cr, user, [('name',operator,name)] + args)
|
||||
return self.name_get(cr, user, ids)
|
||||
|
||||
@@ -13,7 +13,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: base_module_merge
|
||||
|
||||
@@ -13,7 +13,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-20 03:32+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-21 04:05+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: base_module_publish
|
||||
|
||||
@@ -13,7 +13,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-20 03:32+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-21 04:05+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: base_module_record
|
||||
|
||||
@@ -13,7 +13,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-20 03:32+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-21 04:05+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: board_manufacturing
|
||||
|
||||
@@ -13,7 +13,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-20 03:32+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-21 04:05+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: board_sale
|
||||
|
||||
@@ -14,7 +14,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: crm_profiling
|
||||
|
||||
@@ -13,7 +13,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-20 03:32+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-21 04:05+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: event
|
||||
|
||||
@@ -253,7 +253,8 @@ class mail_server(osv.osv):
|
||||
|
||||
msg['body'] = body
|
||||
msg['attachments'] = attachents
|
||||
|
||||
|
||||
res_id = False
|
||||
if msg.get('references', False):
|
||||
id = False
|
||||
ref = msg.get('references')
|
||||
@@ -274,12 +275,20 @@ class mail_server(osv.osv):
|
||||
vals = {
|
||||
|
||||
}
|
||||
model_pool.message_update(cr, uid, [history.res_id], vals, msg, context=context)
|
||||
if hasattr(model_pool, 'message_update'):
|
||||
model_pool.message_update(cr, uid, [history.res_id], vals, msg, context=context)
|
||||
else:
|
||||
logger.notifyChannel('imap', netsvc.LOG_WARNING, 'method def message_update is not define in model %s' % (model_pool._name))
|
||||
return False
|
||||
res_id = id
|
||||
else:
|
||||
model_pool = self.pool.get(server.object_id.model)
|
||||
res_id = model_pool.message_new(cr, uid, msg, context)
|
||||
|
||||
if hasattr(model_pool, 'message_new'):
|
||||
res_id = model_pool.message_new(cr, uid, msg, context)
|
||||
else:
|
||||
logger.notifyChannel('imap', netsvc.LOG_WARNING, 'method def message_new is not define in model %s' % (model_pool._name))
|
||||
return False
|
||||
|
||||
for attactment in attachents or []:
|
||||
data_attach = {
|
||||
'name': attactment,
|
||||
@@ -333,10 +342,10 @@ class mail_server(osv.osv):
|
||||
result, data = imap_server.search(None, '(UNSEEN)')
|
||||
for num in data[0].split():
|
||||
result, data = imap_server.fetch(num, '(RFC822)')
|
||||
self._process_email(cr, uid, server, data[0][1], context)
|
||||
imap_server.store(num, '+FLAGS', '\\Seen')
|
||||
count += 1
|
||||
logger.notifyChannel('imap', netsvc.LOG_INFO, 'fetchmail fetch %s email(s) from %s' % (count, server.name))
|
||||
if self._process_email(cr, uid, server, data[0][1], context):
|
||||
imap_server.store(num, '+FLAGS', '\\Seen')
|
||||
count += 1
|
||||
logger.notifyChannel('imap', netsvc.LOG_INFO, 'fetchmail fetch/process %s email(s) from %s' % (count, server.name))
|
||||
|
||||
imap_server.close()
|
||||
imap_server.logout()
|
||||
|
||||
@@ -14,7 +14,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: hr
|
||||
|
||||
@@ -7,13 +7,13 @@ msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 5.0.0\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
|
||||
"PO-Revision-Date: 2010-03-09 21:10+0000\n"
|
||||
"Last-Translator: Anders Eriksson (Mobila System) <ae@mobilasystem.se>\n"
|
||||
"PO-Revision-Date: 2010-04-21 15:10+0000\n"
|
||||
"Last-Translator: djn (XCLUDE) <Unknown>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-17 04:16+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-22 03:43+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: hr
|
||||
@@ -189,7 +189,7 @@ msgstr "Medlemmar"
|
||||
#. module: hr
|
||||
#: field:hr.employee,ssnid:0
|
||||
msgid "SSN No"
|
||||
msgstr ""
|
||||
msgstr "Personnummer"
|
||||
|
||||
#. module: hr
|
||||
#: model:process.transition,note:hr.process_transition_contactofemployee0
|
||||
@@ -315,7 +315,7 @@ msgstr "Aktiv"
|
||||
#. module: hr
|
||||
#: constraint:hr.employee:0
|
||||
msgid "Error ! You cannot create recursive Hierarchy of Employees."
|
||||
msgstr ""
|
||||
msgstr "Fel! Du kan inte skapa omvänd rangordning av anställda."
|
||||
|
||||
#. module: hr
|
||||
#: model:process.process,name:hr.process_process_employeecontractprocess0
|
||||
|
||||
@@ -44,7 +44,10 @@ to set up a management by affair.
|
||||
'hr_timesheet_view.xml',
|
||||
'hr_timesheet_report.xml',
|
||||
'hr_timesheet_wizard.xml',
|
||||
'process/hr_timesheet_process.xml'
|
||||
'process/hr_timesheet_process.xml',
|
||||
'wizard/hr_timesheet_print_employee_view.xml',
|
||||
'wizard/hr_timesheet_print_users_view.xml',
|
||||
'wizard/hr_timesheet_sign_in_out_view.xml',
|
||||
],
|
||||
'demo_xml': ['hr_timesheet_demo.xml'],
|
||||
'installable': True,
|
||||
|
||||
@@ -13,32 +13,32 @@
|
||||
sequence="1" />
|
||||
<report auto="False" id="report_user_timesheet" menu="False" model="hr.employee" name="hr.analytical.timesheet" string="Employee timesheet" xsl="hr_timesheet/report/user_timesheet.xsl"/>
|
||||
|
||||
<wizard id="wizard_hr_timesheet" menu="False" model="hr.employee" name="hr.analytical.timesheet" string="Employee Timesheet"/>
|
||||
|
||||
<!--<wizard id="wizard_hr_timesheet" menu="False" model="hr.employee" name="hr.analytical.timesheet" string="Employee Timesheet"/>
|
||||
-->
|
||||
<!--<menuitem id="next_id_48" name="Timesheet" parent="hr.menu_hr_reporting"/>-->
|
||||
<!-- <menuitem action="wizard_hr_timesheet" id="menu_wizard_hr_timesheet" parent="next_id_48" type="wizard"
|
||||
groups="hr.group_hr_manager"/>-->
|
||||
<menuitem action="wizard_hr_timesheet" id="menu_wizard_hr_timesheet" parent="menu_hr_reporting_timesheet" type="wizard"
|
||||
<!--<menuitem action="wizard_hr_timesheet" id="menu_wizard_hr_timesheet" parent="menu_hr_reporting_timesheet" type="wizard"
|
||||
|
||||
groups="hr.group_hr_manager"
|
||||
/>
|
||||
<wizard id="wizard_hr_timesheet_my" menu="False" model="hr.employee" name="hr.analytical.timesheet.my" string="Print My Timesheet"/>
|
||||
/>-->
|
||||
<!-- <wizard id="wizard_hr_timesheet_my" menu="False" model="hr.employee" name="hr.analytical.timesheet.my" string="Print My Timesheet"/>
|
||||
<menuitem
|
||||
action="wizard_hr_timesheet_my"
|
||||
id="menu_wizard_hr_timesheet_my"
|
||||
parent="menu_hr_reporting_timesheet"
|
||||
type="wizard"
|
||||
groups="hr.group_hr_user"
|
||||
/>
|
||||
/>-->
|
||||
|
||||
<report auto="False" id="report_users_timesheet" menu="False" model="hr.employee" name="hr.analytical.timesheet_users" string="Employees Timesheet" xsl="hr_timesheet/report/users_timesheet.xsl"/>
|
||||
|
||||
<wizard id="wizard_hr_timesheet_users" menu="False" model="hr.employee" name="hr.analytical.timesheet_users" string="Employees Timesheet"/>
|
||||
<menuitem
|
||||
<!--<menuitem
|
||||
action="wizard_hr_timesheet_users"
|
||||
id="menu_wizard_hr_timesheet_users"
|
||||
groups="hr.group_hr_manager"
|
||||
parent="menu_hr_reporting_timesheet" type="wizard"/>
|
||||
|
||||
-->
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<!--<wizard id="si_so" model="hr.employee" name="hr_timesheet.si_so" string="Sign in / Sign out by project"/>-->
|
||||
<!-- <menuitem action="si_so" id="menu_si_so" parent="hr_attendance.menu_hr_attendance" type="wizard"/>-->
|
||||
|
||||
<data><!--
|
||||
<wizard id="si_so" name="hr_timesheet.si_so" string="Sign in / Sign out by project"/>
|
||||
<menuitem action="si_so" id="menu_si_so" parent="hr_attendance.menu_hr_time_tracking" type="wizard"/>
|
||||
-->
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
@@ -15,7 +15,7 @@
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
@@ -42,24 +42,24 @@ def emp_create_xml(cr, id, som, eom):
|
||||
"and line.user_id=%s and line.date >= %s and line.date < %s "
|
||||
"order by line.date",
|
||||
(id, som.strftime('%Y-%m-%d'), eom.strftime('%Y-%m-%d')))
|
||||
|
||||
|
||||
# Sum by day
|
||||
month = {}
|
||||
for presence in cr.dictfetchall():
|
||||
day = int(presence['date'][-2:])
|
||||
month[day] = month.get(day, 0.0) + presence['amount']
|
||||
|
||||
|
||||
xml = '''
|
||||
<time-element date="%s">
|
||||
<amount>%.2f</amount>
|
||||
</time-element>
|
||||
'''
|
||||
time_xml = ([xml % (day, amount) for day, amount in month.iteritems()])
|
||||
|
||||
|
||||
# Computing the employee
|
||||
cr.execute("select name from res_users where id=%s", (id,))
|
||||
emp = cr.fetchone()[0]
|
||||
|
||||
|
||||
# Computing the xml
|
||||
xml = '''
|
||||
<employee id="%d" name="%s">
|
||||
@@ -73,13 +73,13 @@ class report_custom(report_rml):
|
||||
def get_month_name(self, cr, uid, month):
|
||||
_months = {1:_("January"), 2:_("February"), 3:_("March"), 4:_("April"), 5:_("May"), 6:_("June"), 7:_("July"), 8:_("August"), 9:_("September"), 10:_("October"), 11:_("November"), 12:_("December")}
|
||||
return _months[month]
|
||||
|
||||
|
||||
def get_weekday_name(self, cr, uid, weekday):
|
||||
_weekdays = {1:_('Mon'), 2:_('Tue'), 3:_('Wed'), 4:_('Thu'), 5:_('Fri'), 6:_('Sat'), 7:_('Sun')}
|
||||
return _weekdays[weekday]
|
||||
|
||||
def create_xml(self, cr, uid, ids, data, context):
|
||||
|
||||
|
||||
# Computing the dates (start of month: som, and end of month: eom)
|
||||
som = datetime.date(data['form']['year'], data['form']['month'], 1)
|
||||
eom = som + datetime.timedelta(lengthmonth(som.year, som.month))
|
||||
@@ -87,9 +87,9 @@ class report_custom(report_rml):
|
||||
date_xml += ['<day number="%d" name="%s" weekday="%d" />' % (x, self.get_weekday_name(cr, uid, som.replace(day=x).weekday()+1), som.replace(day=x).weekday()+1) for x in range(1, lengthmonth(som.year, som.month)+1)]
|
||||
date_xml.append('</days>')
|
||||
date_xml.append('<cols>2.5cm%s,2cm</cols>\n' % (',0.7cm' * lengthmonth(som.year, som.month)))
|
||||
|
||||
|
||||
emp_xml=''
|
||||
for id in data['form']['user_ids'][0][2]:
|
||||
for id in data['form']['user_ids']:
|
||||
emp_xml += emp_create_xml(cr, id, som, eom)
|
||||
|
||||
# Computing the xml
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
@@ -15,13 +15,13 @@
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import sign_in_out
|
||||
import wizard_print_timesheet
|
||||
import wizard_print_timesheet_users
|
||||
import hr_timesheet_sign_in_out
|
||||
import hr_timesheet_print_employee
|
||||
import hr_timesheet_print_users
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
import datetime
|
||||
|
||||
from osv import osv, fields
|
||||
|
||||
class analytical_timesheet_employee(osv.osv_memory):
|
||||
_name = 'hr.analytical.timesheet.employee'
|
||||
_description = 'Print Employee Timesheet & Print My Timesheet'
|
||||
_columns = {
|
||||
'month': fields.selection([(x, datetime.date(2000, x, 1).strftime('%B')) for x in range(1, 13)],
|
||||
'Month', required=True),
|
||||
'year': fields.integer('Year', required=True),
|
||||
'user_id': fields.many2one('res.users', 'User', required=True)
|
||||
}
|
||||
|
||||
def _get_user(self, cr, uid, context=None):
|
||||
return uid
|
||||
|
||||
_defaults = {
|
||||
'month': datetime.date.today().month,
|
||||
'year': datetime.date.today().year,
|
||||
'user_id': _get_user
|
||||
}
|
||||
|
||||
def print_report(self, cr, uid, ids, context=None):
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
datas = {
|
||||
'ids': [],
|
||||
'model': 'hr.employee',
|
||||
'form': data
|
||||
}
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'hr.analytical.timesheet',
|
||||
'datas': datas,
|
||||
}
|
||||
analytical_timesheet_employee()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,75 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Print Employee Timesheet -->
|
||||
<record id="view_hr_timesheet_employee" model="ir.ui.view">
|
||||
<field name="name">hr.analytical.timesheet.employee.form</field>
|
||||
<field name="model">hr.analytical.timesheet.employee</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Employee Timesheet">
|
||||
<group colspan="4" >
|
||||
<field name="month" />
|
||||
<field name="year" />
|
||||
<field name="user_id" colspan="3" />
|
||||
</group>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-print" string="Print" name="print_report" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_hr_timesheet_employee" model="ir.actions.act_window">
|
||||
<field name="name">Employee Timesheet</field>
|
||||
<field name="res_model">hr.analytical.timesheet.employee</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_hr_timesheet_employee"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_hr_timesheet_employee"
|
||||
id="menu_hr_timesheet_employee"
|
||||
parent="menu_hr_reporting_timesheet"
|
||||
groups="hr.group_hr_manager" />
|
||||
|
||||
|
||||
<!-- Print My Timesheet -->
|
||||
<record id="view_hr_timesheet_my" model="ir.ui.view">
|
||||
<field name="name">hr.analytical.timesheet.my.form</field>
|
||||
<field name="model">hr.analytical.timesheet.employee</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Print My Timesheet">
|
||||
<group colspan="4" >
|
||||
<field name="month" />
|
||||
<field name="year" />
|
||||
<field name="user_id" colspan="3" readonly="1" />
|
||||
</group>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-print" string="Print" name="print_report" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_hr_timesheet_my" model="ir.actions.act_window">
|
||||
<field name="name">Print My Timesheet</field>
|
||||
<field name="res_model">hr.analytical.timesheet.employee</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_hr_timesheet_my"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_hr_timesheet_my"
|
||||
id="menu_hr_timesheet_my"
|
||||
parent="menu_hr_reporting_timesheet"
|
||||
groups="hr.group_hr_user" />
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -0,0 +1,56 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import datetime
|
||||
|
||||
from osv import osv, fields
|
||||
|
||||
class analytical_timesheet_employees(osv.osv_memory):
|
||||
_name = 'hr.analytical.timesheet.users'
|
||||
_description = 'Print Employees Timesheet'
|
||||
_columns = {
|
||||
'month': fields.selection([(x, datetime.date(2000, x, 1).strftime('%B')) for x in range(1, 13)],
|
||||
'Month', required=True),
|
||||
'year': fields.integer('Year', required=True),
|
||||
'user_ids': fields.many2many('res.users', 'timesheet_users_rel', 'timesheet_id', 'user_id', 'Users', required=True)
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'month': datetime.date.today().month,
|
||||
'year': datetime.date.today().year,
|
||||
}
|
||||
|
||||
def print_report(self, cr, uid, ids, context=None):
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
datas = {
|
||||
'ids': [],
|
||||
'model': 'hr.employee',
|
||||
'form': data
|
||||
}
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'hr.analytical.timesheet_users',
|
||||
'datas': datas,
|
||||
}
|
||||
|
||||
analytical_timesheet_employees()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Print Employees Timesheets -->
|
||||
<record id="view_hr_timesheet_users" model="ir.ui.view">
|
||||
<field name="name">hr.analytical.timesheet.users.form</field>
|
||||
<field name="model">hr.analytical.timesheet.users</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Employees Timesheet">
|
||||
<group colspan="4" >
|
||||
<field name="month" />
|
||||
<field name="year" />
|
||||
<field name="user_ids" colspan="3" />
|
||||
</group>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-print" string="Print" name="print_report" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_hr_timesheet_users" model="ir.actions.act_window">
|
||||
<field name="name">Employees Timesheet</field>
|
||||
<field name="res_model">hr.analytical.timesheet.users</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_hr_timesheet_users"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_hr_timesheet_users"
|
||||
id="menu_hr_timesheet_users"
|
||||
parent="menu_hr_reporting_timesheet"
|
||||
groups="hr.group_hr_manager" />
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -0,0 +1,169 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
import time
|
||||
|
||||
from osv import osv, fields
|
||||
from tools.translate import _
|
||||
|
||||
class hr_so_project(osv.osv_memory):
|
||||
_name = 'hr.sign.out.project'
|
||||
_description = 'Sign Out By Project'
|
||||
_columns = {
|
||||
'account_id': fields.many2one('account.analytic.account', 'Analytic Account', required=True, domain=[('type','=','normal')]),
|
||||
'info': fields.char('Work Description', size=256, required=True),
|
||||
'date_start': fields.datetime('Starting Date', readonly=True),
|
||||
'date': fields.datetime('Closing Date'),
|
||||
'analytic_amount': fields.float('Minimum Analytic Amount'),
|
||||
'name': fields.char('Employees name', size=32, required=True, readonly=True),
|
||||
'state': fields.char('Current state', size=32, required=True, readonly=True),
|
||||
'server_date': fields.datetime('Current Date', required=True, readonly=True),
|
||||
'emp_id': fields.char('Employee ID', size=256, required=False),
|
||||
}
|
||||
|
||||
def _get_empid(self, cr, uid, context=None):
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
|
||||
if emp_id:
|
||||
employee = emp_obj.read(cr, uid, emp_id)[0]
|
||||
return {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0], 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')}
|
||||
raise osv.except_osv(_('UserError'), _('No employee defined for your user !'))
|
||||
|
||||
def _get_empid2(self, cr, uid, context):
|
||||
res = self._get_empid(cr, uid, context)
|
||||
cr.execute('select name,action from hr_attendance where employee_id=%s order by name desc limit 1', (res['emp_id'],))
|
||||
res['server_date'] = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
res['date_start'] = cr.fetchone()[0]
|
||||
return res
|
||||
|
||||
def default_get(self, cr, uid, fields_list, context=None):
|
||||
res = super(hr_so_project, self).default_get(cr, uid, fields_list, context=context)
|
||||
res.update(self._get_empid2(cr, uid, context=context))
|
||||
return res
|
||||
|
||||
def _write(self, cr, uid, data, emp_id, context=None):
|
||||
timesheet_obj = self.pool.get('hr.analytic.timesheet')
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
hour = (time.mktime(time.strptime(data['date'] or time.strftime('%Y-%m-%d %H:%M:%S'), '%Y-%m-%d %H:%M:%S')) -
|
||||
time.mktime(time.strptime(data['date_start'], '%Y-%m-%d %H:%M:%S'))) / 3600.0
|
||||
minimum = data['analytic_amount']
|
||||
if minimum:
|
||||
hour = round(round((hour + minimum / 2) / minimum) * minimum, 2)
|
||||
res = timesheet_obj.default_get(cr, uid, ['product_id','product_uom_id'])
|
||||
if not res['product_uom_id']:
|
||||
raise osv.except_osv(_('UserError'), _('No cost unit defined for this employee !'))
|
||||
up = timesheet_obj.on_change_unit_amount(cr, uid, False, res['product_id'], hour, res['product_uom_id'])['value']
|
||||
res['name'] = data['info']
|
||||
res['account_id'] = data['account_id']
|
||||
res['unit_amount'] = hour
|
||||
emp_journal = emp_obj.browse(cr, uid, emp_id, context).journal_id
|
||||
res['journal_id'] = emp_journal and emp_journal.id or False
|
||||
res.update(up)
|
||||
up = timesheet_obj.on_change_account_id(cr, uid, [], res['account_id']).get('value', {})
|
||||
res.update(up)
|
||||
return timesheet_obj.create(cr, uid, res, context=context)
|
||||
|
||||
def sign_out_result_end(self, cr, uid, ids, context=None):
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
data = self.read(cr, uid, ids, [])[0]
|
||||
emp_id = data['emp_id']
|
||||
emp_obj.attendance_action_change(cr, uid, [emp_id], type='sign_out',dt=data['date'])
|
||||
self._write(cr, uid, data, emp_id, context=context)
|
||||
return {}
|
||||
|
||||
def sign_out_result(self, cr, uid, ids, context=None):
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
data = self.read(cr, uid, ids, [])[0]
|
||||
emp_id = data['emp_id']
|
||||
emp_obj.attendance_action_change(cr, uid, [emp_id], type='action', dt=data['date'])
|
||||
self._write(cr, uid, data, emp_id, context=context)
|
||||
return {}
|
||||
|
||||
hr_so_project()
|
||||
|
||||
class hr_si_project(osv.osv_memory):
|
||||
_name = 'hr.sign.in.project'
|
||||
_description = 'Sign In By Project'
|
||||
_columns = {
|
||||
'name': fields.char('Employees name', size=32, required=True, readonly=True),
|
||||
'state': fields.char('Current state', size=32, required=True, readonly=True),
|
||||
'date': fields.datetime('Starting Date'),
|
||||
'server_date': fields.datetime('Current Date', required=True, readonly=True),
|
||||
'emp_id': fields.char('Employee ID', size=512, required=False),
|
||||
}
|
||||
|
||||
def check_state(self, cr, uid, ids, context=None):
|
||||
obj_model = self.pool.get('ir.model.data')
|
||||
emp_id = self._get_empid(cr, uid, context)['emp_id']
|
||||
# get the latest action (sign_in or out) for this employee
|
||||
cr.execute('select action from hr_attendance where employee_id=%s and action in (\'sign_in\',\'sign_out\') order by name desc limit 1', (emp_id,))
|
||||
res = (cr.fetchone() or ('sign_out',))[0]
|
||||
#TODO: invert sign_in et sign_out
|
||||
if res == 'sign_out':
|
||||
model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_hr_timesheet_sign_in')])
|
||||
resource_id = obj_model.read(cr,uid,model_data_ids,fields=['res_id'])[0]['res_id']
|
||||
return {
|
||||
'name': 'Sign in / Sign out',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'hr.sign.in.project',
|
||||
'views': [(False,'tree'), (resource_id,'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new'
|
||||
}
|
||||
else:
|
||||
model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_hr_timesheet_sign_out')])
|
||||
resource_id = obj_model.read(cr,uid,model_data_ids,fields=['res_id'])[0]['res_id']
|
||||
return {
|
||||
'name': 'Sign in / Sign out',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'hr.sign.out.project',
|
||||
'views': [(False,'tree'), (resource_id,'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new'
|
||||
}
|
||||
|
||||
def _get_empid(self, cr, uid, context=None):
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
|
||||
if emp_id:
|
||||
employee = emp_obj.read(cr, uid, emp_id)[0]
|
||||
return {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0], 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')}
|
||||
raise osv.except_osv(_('UserError'), _('No employee defined for your user !'))
|
||||
|
||||
def sign_in_result(self, cr, uid, ids, context):
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
data = self.read(cr, uid, ids, [], context)[0]
|
||||
emp_id = data['emp_id']
|
||||
try:
|
||||
success = emp_obj.attendance_action_change(cr, uid, [emp_id], type = 'sign_in' ,dt=data['date'] or False)
|
||||
except except_osv, e:
|
||||
raise osv.except_osv(e.name, e.value)
|
||||
return {}
|
||||
|
||||
def default_get(self, cr, uid, fields_list, context=None):
|
||||
res = super(hr_si_project, self).default_get(cr, uid, fields_list, context=context)
|
||||
res.update(self._get_empid(cr, uid, context=context))
|
||||
return res
|
||||
|
||||
hr_si_project()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,95 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_hr_timesheet_sign_in_message" model="ir.ui.view">
|
||||
<field name="name">hr.sign.in.project.message.form</field>
|
||||
<field name="model">hr.sign.in.project</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Sign In/Out By Project">
|
||||
<group colspan="4" >
|
||||
<separator string="This Wizard will make Sign In/Out By Project" colspan="4"/>
|
||||
</group>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-ok" string="Sign in / Sign out" name="check_state" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_hr_timesheet_sign_in" model="ir.ui.view">
|
||||
<field name="name">hr.sign.in.project.form</field>
|
||||
<field name="model">hr.sign.in.project</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Sign In/Out By Project">
|
||||
<group colspan="4" >
|
||||
<separator string="Sign in" colspan="4"/>
|
||||
<field name="name" readonly="True" />
|
||||
<field name="state" readonly="True" />
|
||||
<field name="server_date"/>
|
||||
<label string="(local time on the server side)" colspan="2"/>
|
||||
<field name="date"/>
|
||||
<label string="(Keep empty for current time)" colspan="2"/>
|
||||
</group>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-ok" string="Start Working" name="sign_in_result" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_hr_timesheet_sign_in" model="ir.actions.act_window">
|
||||
<field name="name">Sign in / Sign out by project</field>
|
||||
<field name="res_model">hr.sign.in.project</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_hr_timesheet_sign_in_message"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_hr_timesheet_sign_in"
|
||||
id="menu_hr_timesheet_sign_in"
|
||||
parent="hr_attendance.menu_hr_time_tracking"
|
||||
/>
|
||||
|
||||
<record id="view_hr_timesheet_sign_out" model="ir.ui.view">
|
||||
<field name="name">hr.sign.out.project.form</field>
|
||||
<field name="model">hr.sign.out.project</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Sign In/Out By Project">
|
||||
<group colspan="4" >
|
||||
<separator string="General Information" colspan="4" />
|
||||
<field name="name" readonly="True" />
|
||||
<field name="state" readonly="True" />
|
||||
<field name="date_start"/>
|
||||
<field name="server_date"/>
|
||||
<separator string="Work done in the last period" colspan="4" />
|
||||
<field name="account_id" colspan="3"/>
|
||||
<field name="info" colspan="3"/>
|
||||
<field name="date"/>
|
||||
<label string="(Keep empty for current_time)" colspan="2"/>
|
||||
<field name="analytic_amount"/> </group>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-ok" string="Change Work" name="sign_out_result" type="object"/>
|
||||
<button icon="gtk-ok" string="Stop Working" name="sign_out_result_end" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_hr_timesheet_sign_out" model="ir.actions.act_window">
|
||||
<field name="name">Sign in / Sign out by project</field>
|
||||
<field name="res_model">hr.sign.out.project</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_hr_timesheet_sign_out"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,171 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
||||
import wizard
|
||||
import time
|
||||
import pooler
|
||||
from tools.translate import _
|
||||
|
||||
si_form ='''<?xml version="1.0"?>
|
||||
<form string="Sign in / Sign out">
|
||||
<separator string="Sign in" colspan="4"/>
|
||||
<field name="name" readonly="True" />
|
||||
<field name="state" readonly="True" />
|
||||
<field name="server_date"/>
|
||||
<label string="(local time on the server side)" colspan="2"/>
|
||||
<field name="date"/>
|
||||
<label string="(Keep empty for current time)" colspan="2"/>
|
||||
</form>'''
|
||||
|
||||
si_fields = {
|
||||
'name': {'string': "Employee's name", 'type':'char', 'required':True, 'readonly':True},
|
||||
'state': {'string': "Current state", 'type' : 'char', 'required' : True, 'readonly': True},
|
||||
'date': {'string':"Starting Date", 'type':'datetime'},
|
||||
'server_date': {'string':"Current Date", 'type':'datetime', 'readonly':True},
|
||||
}
|
||||
|
||||
so_form = '''<?xml version="1.0" ?>
|
||||
<form string="Sign in status">
|
||||
<separator string="General Information" colspan="4" />
|
||||
<field name="name" readonly="True" />
|
||||
<field name="state" readonly="True" />
|
||||
<field name="date_start"/>
|
||||
<field name="server_date"/>
|
||||
<separator string="Work done in the last period" colspan="4" />
|
||||
<field name="account_id" colspan="3"/>
|
||||
<field name="info" colspan="3"/>
|
||||
<field name="date"/>
|
||||
<label string="(Keep empty for current_time)" colspan="2"/>
|
||||
<field name="analytic_amount"/>
|
||||
</form>'''
|
||||
|
||||
so_fields = {
|
||||
'name': {'string':"Employee's name", 'type':'char', 'required':True, 'readonly':True},
|
||||
'state': {'string':"Current state", 'type':'char', 'required':True, 'readonly':True},
|
||||
'account_id': {'string':"Analytic Account", 'type':'many2one', 'relation':'account.analytic.account', 'required':True, 'domain':"[('type','=','normal')]"},
|
||||
'info': {'string':"Work Description", 'type':'char', 'size':256, 'required':True},
|
||||
'date': {'string':"Closing Date", 'type':'datetime'},
|
||||
'date_start': {'string':"Starting Date", 'type':'datetime', 'readonly':True},
|
||||
'server_date': {'string':"Current Server Date", 'type':'datetime', 'readonly':True},
|
||||
'analytic_amount': {'string':"Minimum Analytic Amount", 'type':'float'},
|
||||
}
|
||||
|
||||
def _get_empid(self, cr, uid, data, context):
|
||||
emp_obj = pooler.get_pool(cr.dbname).get('hr.employee')
|
||||
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
|
||||
if emp_id:
|
||||
employee = emp_obj.read(cr, uid, emp_id)[0]
|
||||
return {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0], 'date':False, 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')}
|
||||
raise wizard.except_wizard(_('UserError'), _('No employee defined for your user !'))
|
||||
|
||||
def _get_empid2(self, cr, uid, data, context):
|
||||
res = _get_empid(self,cr, uid, data, context)
|
||||
cr.execute('select name,action from hr_attendance where employee_id=%s order by name desc limit 1', (res['emp_id'],))
|
||||
res['server_date'] = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
res['date_start'] = cr.fetchone()[0]
|
||||
res['info'] = ''
|
||||
res['account_id'] = False
|
||||
return res
|
||||
|
||||
def _sign_in_result(self, cr, uid, data, context):
|
||||
emp_obj = pooler.get_pool(cr.dbname).get('hr.employee')
|
||||
emp_id = data['form']['emp_id']
|
||||
from osv.osv import except_osv
|
||||
try:
|
||||
success = emp_obj.attendance_action_change(cr, uid, [emp_id], type = 'sign_in' ,dt=data['form']['date'] or False)
|
||||
except except_osv, e:
|
||||
raise wizard.except_wizard(e.name, e.value)
|
||||
return {}
|
||||
|
||||
def _write(self, cr, uid, data, emp_id, context):
|
||||
timesheet_obj = pooler.get_pool(cr.dbname).get('hr.analytic.timesheet')
|
||||
hour = (time.mktime(time.strptime(data['form']['date'] or time.strftime('%Y-%m-%d %H:%M:%S'), '%Y-%m-%d %H:%M:%S')) -
|
||||
time.mktime(time.strptime(data['form']['date_start'], '%Y-%m-%d %H:%M:%S'))) / 3600.0
|
||||
minimum = data['form']['analytic_amount']
|
||||
if minimum:
|
||||
hour = round(round((hour + minimum / 2) / minimum) * minimum, 2)
|
||||
res = timesheet_obj.default_get(cr, uid, ['product_id','product_uom_id'])
|
||||
if not res['product_uom_id']:
|
||||
raise wizard.except_wizard(_('UserError'), _('No cost unit defined for this employee !'))
|
||||
up = timesheet_obj.on_change_unit_amount(cr, uid, False, res['product_id'], hour, res['product_uom_id'])['value']
|
||||
res['name'] = data['form']['info']
|
||||
res['account_id'] = data['form']['account_id']
|
||||
res['unit_amount'] = hour
|
||||
res.update(up)
|
||||
up = timesheet_obj.on_change_account_id(cr, uid, [], res['account_id']).get('value', {})
|
||||
res.update(up)
|
||||
return timesheet_obj.create(cr, uid, res, context)
|
||||
|
||||
def _sign_out_result_end(self, cr, uid, data, context):
|
||||
emp_obj = pooler.get_pool(cr.dbname).get('hr.employee')
|
||||
emp_id = data['form']['emp_id']
|
||||
emp_obj.attendance_action_change(cr, uid, [emp_id], type='sign_out',dt=data['form']['date'])
|
||||
_write(self, cr, uid, data, emp_id, context)
|
||||
return {}
|
||||
|
||||
def _sign_out_result(self, cr, uid, data, context):
|
||||
emp_obj = pooler.get_pool(cr.dbname).get('hr.employee')
|
||||
emp_id = data['form']['emp_id']
|
||||
emp_obj.attendance_action_change(cr, uid, [emp_id], type='action',dt=data['form']['date'])
|
||||
_write(self, cr, uid, data, emp_id, context)
|
||||
return {}
|
||||
|
||||
def _state_check(self, cr, uid, data, context):
|
||||
emp_id = _get_empid(self, cr, uid, data, context)['emp_id']
|
||||
# get the latest action (sign_in or out) for this employee
|
||||
cr.execute('select action from hr_attendance where employee_id=%s and action in (\'sign_in\',\'sign_out\') order by name desc limit 1', (emp_id,))
|
||||
res = (cr.fetchone() or ('sign_out',))[0]
|
||||
#TODO: invert sign_in et sign_out
|
||||
return res
|
||||
|
||||
class wiz_si_so(wizard.interface):
|
||||
states = {
|
||||
'init' : {
|
||||
'actions' : [_get_empid],
|
||||
'result' : {'type' : 'choice', 'next_state': _state_check}
|
||||
},
|
||||
'sign_out' : { # this means sign_in...
|
||||
'actions' : [_get_empid],
|
||||
'result' : {'type':'form', 'arch':si_form, 'fields' : si_fields, 'state':[('end', 'Cancel'),('si_result', 'Start Working') ] }
|
||||
},
|
||||
'si_result' : {
|
||||
'actions' : [_sign_in_result],
|
||||
'result' : {'type':'state', 'state':'end'}
|
||||
},
|
||||
'sign_in' : { # this means sign_out...
|
||||
'actions' : [_get_empid2],
|
||||
'result' : {'type':'form', 'arch':so_form, 'fields':so_fields, 'state':[('end', 'Cancel'),('so_result', 'Change Work'),('so_result_end', 'Stop Working') ] }
|
||||
},
|
||||
'so_result' : {
|
||||
'actions' : [_sign_out_result],
|
||||
'result' : {'type':'state', 'state':'end'}
|
||||
},
|
||||
'so_result_end' : {
|
||||
'actions' : [_sign_out_result_end],
|
||||
'result' : {'type':'state', 'state':'end'}
|
||||
},
|
||||
}
|
||||
wiz_si_so('hr_timesheet.si_so')
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import datetime
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
|
||||
dates_form = '''<?xml version="1.0"?>
|
||||
<form string="Choose your month">
|
||||
<field name="month" />
|
||||
<field name="year" />
|
||||
<field name="user_id" colspan="3" />
|
||||
</form>'''
|
||||
|
||||
|
||||
dates_form_ro = '''<?xml version="1.0"?>
|
||||
<form string="Choose your month">
|
||||
<field name="month" />
|
||||
<field name="year" />
|
||||
<field name="user_id" colspan="3" readonly="1"/>
|
||||
</form>'''
|
||||
|
||||
dates_fields = {
|
||||
'month': dict(string=u'Month', type='selection', required=True, selection=[(x, datetime.date(2000, x, 1).strftime('%B')) for x in range(1, 13)]),
|
||||
'year': dict(string=u'Year', type=u'integer', required=True),
|
||||
'user_id' : dict(string=u'User', type='many2one', relation='res.users', required=True),
|
||||
}
|
||||
|
||||
def _get_value(self, cr, uid, data, context):
|
||||
today = datetime.date.today()
|
||||
return dict(month=today.month, year=today.year, user_id=uid)
|
||||
|
||||
class wizard_report(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_get_value],
|
||||
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[ ('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]}
|
||||
},
|
||||
'report': {
|
||||
'actions': [],
|
||||
'result': {'type':'print', 'report':'hr.analytical.timesheet', 'state':'end'}
|
||||
}
|
||||
}
|
||||
wizard_report('hr.analytical.timesheet')
|
||||
|
||||
class wizard_report_my(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_get_value],
|
||||
'result': {'type':'form', 'arch':dates_form_ro, 'fields':dates_fields, 'state':[ ('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]}
|
||||
},
|
||||
'report': {
|
||||
'actions': [],
|
||||
'result': {'type':'print', 'report':'hr.analytical.timesheet', 'state':'end'}
|
||||
}
|
||||
}
|
||||
wizard_report_my('hr.analytical.timesheet.my')
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import datetime
|
||||
|
||||
form='''<?xml version="1.0"?>
|
||||
<form string="Choose Users">
|
||||
<field name="month"/>
|
||||
<field name="year"/>
|
||||
<field name="user_ids" colspan="3"/>
|
||||
</form>'''
|
||||
|
||||
fields = {
|
||||
'month': dict(string=u'Month', type='selection', required=True, selection=[(x, datetime.date(2000, x, 1).strftime('%B')) for x in range(1, 13)]),
|
||||
'year': dict(string=u'Year', type='integer', required=True),
|
||||
'user_ids': dict(string=u'Users', type='many2many', relation='res.users', required=True),
|
||||
}
|
||||
|
||||
def _get_value(self, cr, uid, data, context):
|
||||
today=datetime.date.today()
|
||||
return dict(month=today.month, year=today.year)
|
||||
|
||||
class wizard_report(wizard.interface):
|
||||
states={
|
||||
'init':{
|
||||
'actions':[_get_value],
|
||||
'result':{'type':'form', 'arch':form, 'fields':fields, 'state':[('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]}
|
||||
},
|
||||
'report':{
|
||||
'actions':[],
|
||||
'result':{'type':'print', 'report':'hr.analytical.timesheet_users', 'state':'end'}
|
||||
}
|
||||
}
|
||||
wizard_report('hr.analytical.timesheet_users')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -39,6 +39,7 @@ reports, eso.""",
|
||||
'hr_timesheet_invoice_report.xml',
|
||||
'report/report_analytic_view.xml',
|
||||
'report/hr_timesheet_invoice_report_view.xml',
|
||||
'wizard/hr_timesheet_invoice_analytic_cost_ledger_view.xml',
|
||||
],
|
||||
'demo_xml': ['hr_timesheet_invoice_demo.xml'],
|
||||
'installable': True,
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
sequence="2" />
|
||||
<report auto="False" id="account_analytic_account_cost_ledger" menu="False" model="account.analytic.account" name="hr.timesheet.invoice.account.analytic.account.cost_ledger" rml="account/project/report/cost_ledger.rml" string="Cost Ledger"/>
|
||||
|
||||
<wizard id="account_analytic_account_cost_ledger_report" keyword="client_print_multi" model="account.analytic.account" name="hr.timesheet.invoice.account.analytic.account.cost_ledger.report" string="Cost Ledger"/>
|
||||
<!--<wizard id="account_analytic_account_cost_ledger_report" keyword="client_print_multi" model="account.analytic.account" name="hr.timesheet.invoice.account.analytic.account.cost_ledger.report" string="Cost Ledger"/>-->
|
||||
|
||||
<report
|
||||
auto="False"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
@@ -15,14 +15,14 @@
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import hr_timesheet_invoice_create
|
||||
import account_analytic_profit
|
||||
import hr_timesheet_final_invoice_create
|
||||
import wizard_account_analytic_cost_ledger_report
|
||||
import hr_timesheet_analytic_cost_ledger_report
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
import time
|
||||
|
||||
from osv import osv, fields
|
||||
|
||||
class hr_timesheet_analytic_cost_ledger(osv.osv_memory):
|
||||
_name = 'hr.timesheet.analytic.cost.ledger'
|
||||
_description = 'hr.timesheet.analytic.cost.ledger'
|
||||
_columns = {
|
||||
'date1': fields.date('Start of period', required=True),
|
||||
'date2': fields.date('End of period', required=True)
|
||||
}
|
||||
_defaults = {
|
||||
'date1': lambda *a: time.strftime('%Y-01-01'),
|
||||
'date2': lambda *a: time.strftime('%Y-%m-%d')
|
||||
}
|
||||
def print_report(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
datas = {
|
||||
'ids': 'active_ids' in context and context['active_ids'] or [],
|
||||
'model': 'account.analytic.account',
|
||||
'form': self.read(cr, uid, ids)[0]
|
||||
}
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'hr.timesheet.invoice.account.analytic.account.cost_ledger',
|
||||
'datas': datas,
|
||||
}
|
||||
|
||||
hr_timesheet_analytic_cost_ledger()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_hr_timesheet_invoice_cost_ledger" model="ir.ui.view">
|
||||
<field name="name">Cost Ledger</field>
|
||||
<field name="model">hr.timesheet.analytic.cost.ledger</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Select Period">
|
||||
<group col="4" colspan="6">
|
||||
<field name="date1"/>
|
||||
<field name="date2"/>
|
||||
</group>
|
||||
<separator colspan="4"/>
|
||||
<group col="2" colspan="4">
|
||||
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
|
||||
<button name="print_report" string="Print" colspan="1" type="object" icon="gtk-print"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_hr_timesheet_invoice_cost_ledger" model="ir.actions.act_window">
|
||||
<field name="name">Cost Ledger</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">hr.timesheet.analytic.cost.ledger</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="hr_timesheet_invoice_cost_ledger_values">
|
||||
<field name="model_id" ref="model_account_analytic_account" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Cost Ledger</field>
|
||||
<field name="key2">client_print_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_hr_timesheet_invoice_cost_ledger'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">account.analytic.account</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,52 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
import wizard
|
||||
|
||||
dates_form = '''<?xml version="1.0"?>
|
||||
<form string="Select period">
|
||||
<field name="date1"/>
|
||||
<field name="date2"/>
|
||||
</form>'''
|
||||
|
||||
dates_fields = {
|
||||
'date1': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
|
||||
'date2': {'string':'End of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
|
||||
}
|
||||
|
||||
class wizard_report(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'),('report','Print')]}
|
||||
},
|
||||
'report': {
|
||||
'actions': [],
|
||||
'result': {'type':'print', 'report':'hr.timesheet.invoice.account.analytic.account.cost_ledger', 'state':'end'}
|
||||
}
|
||||
}
|
||||
wizard_report('hr.timesheet.invoice.account.analytic.account.cost_ledger.report')
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -154,7 +154,7 @@ class account_invoice(osv.osv):
|
||||
## @param partner_bank_id the partner linked invoice bank
|
||||
## @return the dict of values with the partner_bank value updated
|
||||
def onchange_partner_id(self, cr, uid, ids, type, partner_id,
|
||||
date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False):
|
||||
date_invoice=False, payment_term=False, partner_bank=False, company_id=False):
|
||||
""" Function that is call when the partner of the invoice is changed
|
||||
it will retriev and set the good bank partner bank"""
|
||||
res = super(account_invoice, self).onchange_partner_id(
|
||||
@@ -175,7 +175,7 @@ class account_invoice(osv.osv):
|
||||
if type in ('in_invoice', 'in_refund'):
|
||||
res['value']['partner_bank'] = bank_id
|
||||
|
||||
if partner_bank_id != bank_id:
|
||||
if partner_bank != bank_id:
|
||||
to_update = self.onchange_partner_bank(cr, uid, ids, bank_id)
|
||||
res['value'].update(to_update['value'])
|
||||
return res
|
||||
|
||||
@@ -14,7 +14,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: l10n_chart_uk_minimal
|
||||
|
||||
@@ -26,23 +26,23 @@ class mrp_installer(osv.osv_memory):
|
||||
|
||||
_columns = {
|
||||
# Manufacturing Resource Planning
|
||||
'stock_location':fields.boolean('Advanced Routes',
|
||||
'stock_location': fields.boolean('Advanced Routes',
|
||||
help="Manages product routes and paths within and between "
|
||||
"locations (e.g. warehouses)"),
|
||||
'mrp_jit':fields.boolean('Just In Time Scheduling',
|
||||
'mrp_jit': fields.boolean('Just In Time Scheduling',
|
||||
help="Enables Just In Time computation of procurement orders."
|
||||
"\n\nWhile it's more resource intensive than the default "
|
||||
"setup, the JIT computer avoids having to wait for the "
|
||||
"procurement scheduler to run or having to run the "
|
||||
"procurement scheduler manually."),
|
||||
'mrp_operations':fields.boolean('Manufacturing Operations',
|
||||
'mrp_operations': fields.boolean('Manufacturing Operations',
|
||||
help="Enhances production orders with readiness states as well "
|
||||
"as the dates of start and end of execution of the order."),
|
||||
'mrp_subproduct':fields.boolean('MRP Subproducts',
|
||||
'mrp_subproduct': fields.boolean('MRP Subproducts',
|
||||
help="Enables multiple product output from a single production "
|
||||
"order: without this, a productio order can have only one "
|
||||
"output product."),
|
||||
'mrp_repair':fields.boolean('Repairs',
|
||||
'mrp_repair': fields.boolean('Repairs',
|
||||
help="Enables warranty and repair management (and their impact "
|
||||
"on stocks and invoicing)."),
|
||||
}
|
||||
|
||||
+89
-85
@@ -161,15 +161,16 @@ class mrp_bom(osv.osv):
|
||||
@return: Dictionary of values
|
||||
"""
|
||||
result = {}
|
||||
bom_obj = self.pool.get('mrp.bom')
|
||||
for bom in self.browse(cr, uid, ids, context=context):
|
||||
result[bom.id] = map(lambda x: x.id, bom.bom_lines)
|
||||
if bom.bom_lines:
|
||||
continue
|
||||
ok = ((name=='child_complete_ids') and (bom.product_id.supply_method=='produce'))
|
||||
if bom.type=='phantom' or ok:
|
||||
sids = self.pool.get('mrp.bom').search(cr, uid, [('bom_id','=',False),('product_id','=',bom.product_id.id)])
|
||||
sids = bom_obj.search(cr, uid, [('bom_id','=',False),('product_id','=',bom.product_id.id)])
|
||||
if sids:
|
||||
bom2 = self.pool.get('mrp.bom').browse(cr, uid, sids[0], context=context)
|
||||
bom2 = bom_obj.browse(cr, uid, sids[0], context=context)
|
||||
result[bom.id] += map(lambda x: x.id, bom2.bom_lines)
|
||||
|
||||
return result
|
||||
@@ -182,13 +183,13 @@ class mrp_bom(osv.osv):
|
||||
"""
|
||||
res = dict(map(lambda x: (x,''), ids))
|
||||
for line in self.browse(cr, uid, ids):
|
||||
if line.type=='phantom' and not line.bom_id:
|
||||
if line.type == 'phantom' and not line.bom_id:
|
||||
res[line.id] = 'set'
|
||||
continue
|
||||
if line.bom_lines or line.type=='phantom':
|
||||
if line.bom_lines or line.type == 'phantom':
|
||||
continue
|
||||
if line.product_id.supply_method=='produce':
|
||||
if line.product_id.procure_method=='make_to_stock':
|
||||
if line.product_id.supply_method == 'produce':
|
||||
if line.product_id.procure_method == 'make_to_stock':
|
||||
res[line.id] = 'stock'
|
||||
else:
|
||||
res[line.id] = 'order'
|
||||
@@ -223,7 +224,6 @@ class mrp_bom(osv.osv):
|
||||
'child_complete_ids': fields.function(_child_compute,relation='mrp.bom', method=True, string="BoM Hierarchy", type='many2many'),
|
||||
'company_id': fields.many2one('res.company','Company',required=True),
|
||||
'multi_level_bom': fields.boolean('Multi-level BoM'),
|
||||
|
||||
}
|
||||
_defaults = {
|
||||
'active': lambda *a: 1,
|
||||
@@ -261,8 +261,8 @@ class mrp_bom(osv.osv):
|
||||
@return: Dictionary of changed values
|
||||
"""
|
||||
if product_id:
|
||||
prod=self.pool.get('product.product').browse(cr,uid,[product_id])[0]
|
||||
v = {'product_uom':prod.uom_id.id}
|
||||
prod = self.pool.get('product.product').browse(cr, uid, [product_id])[0]
|
||||
v = {'product_uom': prod.uom_id.id}
|
||||
if not name:
|
||||
v['name'] = prod.name
|
||||
return {'value': v}
|
||||
@@ -285,8 +285,8 @@ class mrp_bom(osv.osv):
|
||||
prop = 0
|
||||
for prop_id in bom.property_ids:
|
||||
if prop_id.id in properties:
|
||||
prop+=1
|
||||
if (prop>max_prop) or ((max_prop==0) and not result):
|
||||
prop += 1
|
||||
if (prop > max_prop) or ((max_prop == 0) and not result):
|
||||
result = bom.id
|
||||
max_prop = prop
|
||||
return result
|
||||
@@ -303,20 +303,20 @@ class mrp_bom(osv.osv):
|
||||
"""
|
||||
factor = factor / (bom.product_efficiency or 1.0)
|
||||
factor = rounding(factor, bom.product_rounding)
|
||||
if factor<bom.product_rounding:
|
||||
if factor < bom.product_rounding:
|
||||
factor = bom.product_rounding
|
||||
result = []
|
||||
result2 = []
|
||||
phantom=False
|
||||
if bom.type=='phantom' and not bom.bom_lines:
|
||||
phantom = False
|
||||
if bom.type == 'phantom' and not bom.bom_lines:
|
||||
newbom = self._bom_find(cr, uid, bom.product_id.id, bom.product_uom.id, properties)
|
||||
if newbom:
|
||||
res = self._bom_explode(cr, uid, self.browse(cr, uid, [newbom])[0], factor*bom.product_qty, properties, addthis=True, level=level+10)
|
||||
result = result + res[0]
|
||||
result2 = result2 + res[1]
|
||||
phantom=True
|
||||
phantom = True
|
||||
else:
|
||||
phantom=False
|
||||
phantom = False
|
||||
if not phantom:
|
||||
if addthis and not bom.bom_lines:
|
||||
result.append(
|
||||
@@ -348,7 +348,7 @@ class mrp_bom(osv.osv):
|
||||
result2 = result2 + res[1]
|
||||
return result, result2
|
||||
|
||||
def set_indices(self, cr, uid, ids, context = {}):
|
||||
def set_indices(self, cr, uid, ids, context={}):
|
||||
""" Sets Indices.
|
||||
@return: True
|
||||
"""
|
||||
@@ -361,10 +361,10 @@ class mrp_bom(osv.osv):
|
||||
bom_rev_obj = self.pool.get('mrp.bom.revision')
|
||||
for rev_id in rev_ids:
|
||||
if res[0]['revision_type'] == 'numeric':
|
||||
bom_rev_obj.write(cr, uid, [rev_id], {'indice' : idx})
|
||||
bom_rev_obj.write(cr, uid, [rev_id], {'indice': idx})
|
||||
else:
|
||||
bom_rev_obj.write(cr, uid, [rev_id], {'indice' : "%c"%(idx+96,)})
|
||||
idx+=1
|
||||
bom_rev_obj.write(cr, uid, [rev_id], {'indice': "%c" %(idx+96,)})
|
||||
idx += 1
|
||||
return True
|
||||
|
||||
mrp_bom()
|
||||
@@ -372,6 +372,7 @@ mrp_bom()
|
||||
class mrp_bom_revision(osv.osv):
|
||||
_name = 'mrp.bom.revision'
|
||||
_description = 'Bill of material revisions'
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Modification name', size=64, required=True),
|
||||
'description': fields.text('Description'),
|
||||
@@ -383,7 +384,7 @@ class mrp_bom_revision(osv.osv):
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'author_id': lambda x,y,z,c: z,
|
||||
'author_id': lambda x, y, z, c: z,
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d'),
|
||||
}
|
||||
|
||||
@@ -443,7 +444,7 @@ class mrp_production(osv.osv):
|
||||
|
||||
def _production_calc(self, cr, uid, ids, prop, unknow_none, context={}):
|
||||
""" Calculates total hours and total no. of cycles for a production order.
|
||||
@param prop:
|
||||
@param prop: Name of field.
|
||||
@param unknow_none:
|
||||
@return: Dictionary of values.
|
||||
"""
|
||||
@@ -541,10 +542,11 @@ class mrp_production(osv.osv):
|
||||
'state': lambda *a: 'draft',
|
||||
'date_planned': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'product_qty': lambda *a: 1.0,
|
||||
'name': lambda x,y,z,c: x.pool.get('ir.sequence').get(y,z,'mrp.production') or '/',
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.production', context=c),
|
||||
'name': lambda x, y, z, c: x.pool.get('ir.sequence').get(y, z, 'mrp.production') or '/',
|
||||
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.production', context=c),
|
||||
}
|
||||
_order = 'date_planned asc, priority desc';
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
productions = self.read(cr, uid, ids, ['state'])
|
||||
unlink_ids = []
|
||||
@@ -587,8 +589,8 @@ class mrp_production(osv.osv):
|
||||
return {}
|
||||
res = self.pool.get('product.product').read(cr, uid, [product], ['uom_id'])[0]
|
||||
uom = res['uom_id'] and res['uom_id'][0]
|
||||
result = {'product_uom':uom}
|
||||
return {'value':result}
|
||||
result = {'product_uom': uom}
|
||||
return {'value': result}
|
||||
|
||||
def bom_id_change(self, cr, uid, ids, product):
|
||||
""" Finds routing for changed BoM.
|
||||
@@ -599,14 +601,14 @@ class mrp_production(osv.osv):
|
||||
return {}
|
||||
res = self.pool.get('mrp.bom').read(cr, uid, [product], ['routing_id'])[0]
|
||||
routing_id = res['routing_id'] and res['routing_id'][0]
|
||||
result = {'routing_id':routing_id}
|
||||
return {'value':result}
|
||||
result = {'routing_id': routing_id}
|
||||
return {'value': result}
|
||||
|
||||
def action_picking_except(self, cr, uid, ids):
|
||||
""" Changes the state to Exception.
|
||||
@return: True
|
||||
"""
|
||||
self.write(cr, uid, ids, {'state':'picking_except'})
|
||||
self.write(cr, uid, ids, {'state': 'picking_except'})
|
||||
return True
|
||||
|
||||
def action_compute(self, cr, uid, ids, properties=[]):
|
||||
@@ -657,7 +659,7 @@ class mrp_production(osv.osv):
|
||||
if production.move_created_ids:
|
||||
move_obj.action_cancel(cr, uid, [x.id for x in production.move_created_ids])
|
||||
move_obj.action_cancel(cr, uid, [x.id for x in production.move_lines])
|
||||
self.write(cr, uid, ids, {'state':'cancel'}) #,'move_lines':[(6,0,[])]})
|
||||
self.write(cr, uid, ids, {'state': 'cancel'}) #,'move_lines':[(6,0,[])]})
|
||||
return True
|
||||
|
||||
#XXX: may be a bug here; lot_lines are unreserved for a few seconds;
|
||||
@@ -667,11 +669,11 @@ class mrp_production(osv.osv):
|
||||
@return: True
|
||||
"""
|
||||
move_obj = self.pool.get('stock.move')
|
||||
self.write(cr, uid, ids, {'state':'ready'})
|
||||
self.write(cr, uid, ids, {'state': 'ready'})
|
||||
for production in self.browse(cr, uid, ids):
|
||||
if production.move_prod_id:
|
||||
move_obj.write(cr, uid, [production.move_prod_id.id],
|
||||
{'location_id':production.location_dest_id.id})
|
||||
{'location_id': production.location_dest_id.id})
|
||||
return True
|
||||
|
||||
def action_production_end(self, cr, uid, ids):
|
||||
@@ -680,7 +682,7 @@ class mrp_production(osv.osv):
|
||||
"""
|
||||
for production in self.browse(cr, uid, ids):
|
||||
self._costs_generate(cr, uid, production)
|
||||
return self.write(cr, uid, ids, {'state': 'done', 'date_finnished': time.strftime('%Y-%m-%d %H:%M:%S')})
|
||||
return self.write(cr, uid, ids, {'state': 'done', 'date_finnished': time.strftime('%Y-%m-%d %H:%M:%S')})
|
||||
|
||||
def test_production_done(self, cr, uid, ids):
|
||||
""" Tests whether production is done or not.
|
||||
@@ -765,7 +767,7 @@ class mrp_production(osv.osv):
|
||||
if final_product.id not in parent_move_ids:
|
||||
new_parent_ids.append(final_product.id)
|
||||
for new_parent_id in new_parent_ids:
|
||||
stock_mov_obj.write(cr, uid, [raw_product.id], {'move_history_ids':[(4,new_parent_id)]})
|
||||
stock_mov_obj.write(cr, uid, [raw_product.id], {'move_history_ids': [(4,new_parent_id)]})
|
||||
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'mrp.production', production_id, 'button_produce_done', cr)
|
||||
@@ -786,7 +788,7 @@ class mrp_production(osv.osv):
|
||||
if value and account:
|
||||
amount += value
|
||||
analytic_line_obj.create(cr, uid, {
|
||||
'name': wc_line.name+' (H)',
|
||||
'name': wc_line.name + ' (H)',
|
||||
'amount': value,
|
||||
'account_id': account,
|
||||
'general_account_id': wc.costs_general_account_id.id,
|
||||
@@ -813,7 +815,7 @@ class mrp_production(osv.osv):
|
||||
@return: True
|
||||
"""
|
||||
move_ids = []
|
||||
self.write(cr, uid, ids, {'state': 'in_production','date_start':time.strftime('%Y-%m-%d %H:%M:%S')})
|
||||
self.write(cr, uid, ids, {'state': 'in_production', 'date_start': time.strftime('%Y-%m-%d %H:%M:%S')})
|
||||
return True
|
||||
|
||||
def test_if_product(self, cr, uid, ids):
|
||||
@@ -834,12 +836,13 @@ class mrp_production(osv.osv):
|
||||
""" Confirms production order.
|
||||
@return: Newly generated picking Id.
|
||||
"""
|
||||
picking_id=False
|
||||
picking_id = False
|
||||
proc_ids = []
|
||||
seq_obj = self.pool.get('ir.sequence')
|
||||
pick_obj = self.pool.get('stock.picking')
|
||||
move_obj = self.pool.get('stock.move')
|
||||
proc_obj = self.pool.get('mrp.procurement')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for production in self.browse(cr, uid, ids):
|
||||
if not production.product_lines:
|
||||
self.action_compute(cr, uid, [production.id])
|
||||
@@ -849,14 +852,14 @@ class mrp_production(osv.osv):
|
||||
address_id = False
|
||||
if production.bom_id.routing_id and production.bom_id.routing_id.location_id:
|
||||
routing_loc = production.bom_id.routing_id.location_id
|
||||
if routing_loc.usage<>'internal':
|
||||
if routing_loc.usage <> 'internal':
|
||||
pick_type = 'out'
|
||||
address_id = routing_loc.address_id and routing_loc.address_id.id or False
|
||||
routing_loc = routing_loc.id
|
||||
pick_name = seq_obj.get(cr, uid, 'stock.picking.'+pick_type)
|
||||
pick_name = seq_obj.get(cr, uid, 'stock.picking.' + pick_type)
|
||||
picking_id = pick_obj.create(cr, uid, {
|
||||
'name': pick_name,
|
||||
'origin': (production.origin or '').split(':')[0] +':'+production.name,
|
||||
'origin': (production.origin or '').split(':')[0] + ':' + production.name,
|
||||
'type': pick_type,
|
||||
'move_type': 'one',
|
||||
'state': 'auto',
|
||||
@@ -867,7 +870,7 @@ class mrp_production(osv.osv):
|
||||
|
||||
source = production.product_id.product_tmpl_id.property_stock_production.id
|
||||
data = {
|
||||
'name':'PROD:'+production.name,
|
||||
'name':'PROD:' + production.name,
|
||||
'date_planned': production.date_planned,
|
||||
'product_id': production.product_id.id,
|
||||
'product_qty': production.product_qty,
|
||||
@@ -885,11 +888,11 @@ class mrp_production(osv.osv):
|
||||
self.write(cr, uid, [production.id], {'move_created_ids': [(6, 0, [res_final_id])]})
|
||||
moves = []
|
||||
for line in production.product_lines:
|
||||
move_id=False
|
||||
move_id = False
|
||||
newdate = production.date_planned
|
||||
if line.product_id.type in ('product', 'consu'):
|
||||
res_dest_id = move_obj.create(cr, uid, {
|
||||
'name':'PROD:'+production.name,
|
||||
'name':'PROD:' + production.name,
|
||||
'date_planned': production.date_planned,
|
||||
'product_id': line.product_id.id,
|
||||
'product_qty': line.product_qty,
|
||||
@@ -904,7 +907,7 @@ class mrp_production(osv.osv):
|
||||
})
|
||||
moves.append(res_dest_id)
|
||||
move_id = move_obj.create(cr, uid, {
|
||||
'name':'PROD:'+production.name,
|
||||
'name':'PROD:' + production.name,
|
||||
'picking_id':picking_id,
|
||||
'product_id': line.product_id.id,
|
||||
'product_qty': line.product_qty,
|
||||
@@ -932,12 +935,10 @@ class mrp_production(osv.osv):
|
||||
'move_id': move_id,
|
||||
'company_id': production.company_id.id,
|
||||
})
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'mrp.procurement', proc_id, 'button_confirm', cr)
|
||||
proc_ids.append(proc_id)
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
|
||||
self.write(cr, uid, [production.id], {'picking_id':picking_id, 'move_lines': [(6,0,moves)], 'state':'confirmed'})
|
||||
self.write(cr, uid, [production.id], {'picking_id': picking_id, 'move_lines': [(6,0,moves)], 'state':'confirmed'})
|
||||
return picking_id
|
||||
|
||||
def force_production(self, cr, uid, ids, *args):
|
||||
@@ -955,6 +956,7 @@ class mrp_production_workcenter_line(osv.osv):
|
||||
_name = 'mrp.production.workcenter.line'
|
||||
_description = 'Work Orders'
|
||||
_order = 'sequence'
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Work Order', size=64, required=True),
|
||||
'workcenter_id': fields.many2one('mrp.workcenter', 'Work Center', required=True),
|
||||
@@ -973,6 +975,7 @@ mrp_production_workcenter_line()
|
||||
class mrp_production_product_line(osv.osv):
|
||||
_name = 'mrp.production.product.line'
|
||||
_description = 'Production scheduled products'
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Name', size=64, required=True),
|
||||
'product_id': fields.many2one('product.product', 'Product', required=True),
|
||||
@@ -998,6 +1001,7 @@ class mrp_procurement(osv.osv):
|
||||
_name = "mrp.procurement"
|
||||
_description = "Procurement"
|
||||
_order = 'priority,date_planned'
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Reason', size=64, required=True, help='Procurement name.'),
|
||||
'origin': fields.char('Source Document', size=64,
|
||||
@@ -1038,7 +1042,7 @@ class mrp_procurement(osv.osv):
|
||||
('waiting','Waiting')], 'State', required=True,
|
||||
help='When a procurement is created the state is set to \'Draft\'.\n If the procurement is confirmed, the state is set to \'Confirmed\'.\
|
||||
\nAfter confirming the state is set to \'Running\'.\n If any exception arises in the order then the state is set to \'Exception\'.\n Once the exception is removed the state becomes \'Ready\'.\n It is in \'Waiting\'. state when the procurement is waiting for another one to finish.'),
|
||||
'note' : fields.text('Note'),
|
||||
'note': fields.text('Note'),
|
||||
'company_id': fields.many2one('res.company','Company',required=True),
|
||||
}
|
||||
_defaults = {
|
||||
@@ -1047,7 +1051,7 @@ class mrp_procurement(osv.osv):
|
||||
'date_planned': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'close_move': lambda *a: 0,
|
||||
'procure_method': lambda *a: 'make_to_order',
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.procurement', context=c)
|
||||
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.procurement', context=c)
|
||||
}
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
@@ -1066,10 +1070,10 @@ class mrp_procurement(osv.osv):
|
||||
@return: Dictionary of values.
|
||||
"""
|
||||
if product_id:
|
||||
w=self.pool.get('product.product').browse(cr,uid,product_id, context)
|
||||
w = self.pool.get('product.product').browse(cr, uid, product_id, context)
|
||||
v = {
|
||||
'product_uom':w.uom_id.id,
|
||||
'product_uos':w.uos_id and w.uos_id.id or w.uom_id.id
|
||||
'product_uom': w.uom_id.id,
|
||||
'product_uos': w.uos_id and w.uos_id.id or w.uom_id.id
|
||||
}
|
||||
return {'value': v}
|
||||
return {}
|
||||
@@ -1092,7 +1096,7 @@ class mrp_procurement(osv.osv):
|
||||
for procurement in self.browse(cr, uid, ids, context):
|
||||
if procurement.move_id:
|
||||
ok = True
|
||||
if not procurement.move_id.state=='cancel':
|
||||
if not procurement.move_id.state == 'cancel':
|
||||
res = False
|
||||
return res and ok
|
||||
|
||||
@@ -1103,7 +1107,7 @@ class mrp_procurement(osv.osv):
|
||||
res = True
|
||||
for proc in self.browse(cr, uid, ids, context):
|
||||
if proc.move_id:
|
||||
if not proc.move_id.state=='done':
|
||||
if not proc.move_id.state == 'done':
|
||||
res = False
|
||||
return res
|
||||
|
||||
@@ -1116,7 +1120,7 @@ class mrp_procurement(osv.osv):
|
||||
@param proc: Current procurement.
|
||||
@return: Quantity or False.
|
||||
"""
|
||||
if proc.product_id.type=='product':
|
||||
if proc.product_id.type == 'product':
|
||||
if proc.move_id.product_uos:
|
||||
return proc.move_id.product_uos_qty
|
||||
return False
|
||||
@@ -1126,7 +1130,7 @@ class mrp_procurement(osv.osv):
|
||||
@param proc: Current procurement.
|
||||
@return: UoS or False.
|
||||
"""
|
||||
if proc.product_id.type=='product':
|
||||
if proc.product_id.type == 'product':
|
||||
if proc.move_id.product_uos:
|
||||
return proc.move_id.product_uos.id
|
||||
return False
|
||||
@@ -1160,7 +1164,7 @@ class mrp_procurement(osv.osv):
|
||||
@return: True or False
|
||||
"""
|
||||
for procurement in self.browse(cr, uid, ids, context=context):
|
||||
if procurement.move_id and procurement.move_id.state=='auto':
|
||||
if procurement.move_id and procurement.move_id.state == 'auto':
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -1185,7 +1189,7 @@ class mrp_procurement(osv.osv):
|
||||
"""
|
||||
ok = True
|
||||
for procurement in self.browse(cr, uid, ids, context=context):
|
||||
if procurement.product_id.type=='service':
|
||||
if procurement.product_id.type == 'service':
|
||||
ok = ok and self._check_make_to_stock_service(cr, uid, procurement, context)
|
||||
else:
|
||||
ok = ok and self._check_make_to_stock_product(cr, uid, procurement, context)
|
||||
@@ -1198,7 +1202,7 @@ class mrp_procurement(osv.osv):
|
||||
res = True
|
||||
user = self.pool.get('res.users').browse(cr, uid, uid)
|
||||
for procurement in self.browse(cr, uid, ids):
|
||||
if procurement.product_id.product_tmpl_id.supply_method<>'produce':
|
||||
if procurement.product_id.product_tmpl_id.supply_method <> 'produce':
|
||||
if procurement.product_id.seller_ids:
|
||||
partner = procurement.product_id.seller_ids[0].name
|
||||
if user.company_id and user.company_id.partner_id:
|
||||
@@ -1220,7 +1224,7 @@ class mrp_procurement(osv.osv):
|
||||
user = self.pool.get('res.users').browse(cr, uid, uid)
|
||||
partner_obj = self.pool.get('res.partner')
|
||||
for procurement in self.browse(cr, uid, ids):
|
||||
if procurement.product_id.product_tmpl_id.supply_method<>'buy':
|
||||
if procurement.product_id.product_tmpl_id.supply_method <> 'buy':
|
||||
return False
|
||||
if not procurement.product_id.seller_ids:
|
||||
cr.execute('update mrp_procurement set message=%s where id=%s', (_('No supplier defined for this product !'), procurement.id))
|
||||
@@ -1240,7 +1244,7 @@ class mrp_procurement(osv.osv):
|
||||
@return: True or False
|
||||
"""
|
||||
for record in self.browse(cr, uid, ids):
|
||||
if record.move_id and record.move_id.state=='cancel':
|
||||
if record.move_id and record.move_id.state == 'cancel':
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -1255,32 +1259,32 @@ class mrp_procurement(osv.osv):
|
||||
if procurement.product_id.type in ('product', 'consu'):
|
||||
if not procurement.move_id:
|
||||
source = procurement.location_id.id
|
||||
if procurement.procure_method=='make_to_order':
|
||||
if procurement.procure_method == 'make_to_order':
|
||||
source = procurement.product_id.product_tmpl_id.property_stock_procurement.id
|
||||
id = move_obj.create(cr, uid, {
|
||||
'name': 'PROC:'+procurement.name,
|
||||
'name': 'PROC:' + procurement.name,
|
||||
'location_id': source,
|
||||
'location_dest_id': procurement.location_id.id,
|
||||
'product_id': procurement.product_id.id,
|
||||
'product_qty':procurement.product_qty,
|
||||
'product_qty': procurement.product_qty,
|
||||
'product_uom': procurement.product_uom.id,
|
||||
'date_planned': procurement.date_planned,
|
||||
'state':'confirmed',
|
||||
'state': 'confirmed',
|
||||
'company_id': procurement.company_id.id,
|
||||
})
|
||||
self.write(cr, uid, [procurement.id], {'move_id': id, 'close_move':1})
|
||||
self.write(cr, uid, [procurement.id], {'move_id': id, 'close_move': 1})
|
||||
else:
|
||||
# TODO: check this
|
||||
if procurement.procure_method=='make_to_stock' and procurement.move_id.state in ('waiting',):
|
||||
if procurement.procure_method == 'make_to_stock' and procurement.move_id.state in ('waiting',):
|
||||
id = move_obj.write(cr, uid, [procurement.move_id.id], {'state':'confirmed'})
|
||||
self.write(cr, uid, ids, {'state':'confirmed','message':''})
|
||||
self.write(cr, uid, ids, {'state': 'confirmed', 'message': ''})
|
||||
return True
|
||||
|
||||
def action_move_assigned(self, cr, uid, ids, context={}):
|
||||
""" Changes procurement state to Running and writes message.
|
||||
@return: True
|
||||
"""
|
||||
self.write(cr, uid, ids, {'state':'running','message':_('from stock: products assigned.')})
|
||||
self.write(cr, uid, ids, {'state': 'running', 'message': _('from stock: products assigned.')})
|
||||
return True
|
||||
|
||||
def _check_make_to_stock_service(self, cr, uid, procurement, context={}):
|
||||
@@ -1306,7 +1310,7 @@ class mrp_procurement(osv.osv):
|
||||
@return: True
|
||||
"""
|
||||
for procurement in self.browse(cr, uid, ids):
|
||||
self.write(cr, uid, [procurement.id], {'state':'running'})
|
||||
self.write(cr, uid, [procurement.id], {'state': 'running'})
|
||||
return True
|
||||
|
||||
def action_produce_assign_product(self, cr, uid, ids, context={}):
|
||||
@@ -1346,12 +1350,12 @@ class mrp_procurement(osv.osv):
|
||||
'company_id': procurement.company_id.id,
|
||||
})
|
||||
res[procurement.id] = produce_id
|
||||
self.write(cr, uid, [procurement.id], {'state':'running'})
|
||||
self.write(cr, uid, [procurement.id], {'state': 'running'})
|
||||
bom_result = production_obj.action_compute(cr, uid,
|
||||
[produce_id], properties=[x.id for x in procurement.property_ids])
|
||||
wf_service.trg_validate(uid, 'mrp.production', produce_id, 'button_confirm', cr)
|
||||
move_obj.write(cr, uid, [res_id],
|
||||
{'location_id':procurement.location_id.id})
|
||||
{'location_id': procurement.location_id.id})
|
||||
return res
|
||||
|
||||
def action_po_assign(self, cr, uid, ids, context={}):
|
||||
@@ -1385,7 +1389,7 @@ class mrp_procurement(osv.osv):
|
||||
|
||||
qty = uom_obj._compute_qty(cr, uid, procurement.product_uom.id, procurement.product_qty, uom_id)
|
||||
if procurement.product_id.seller_ids[0].qty:
|
||||
qty=max(qty,procurement.product_id.seller_ids[0].qty)
|
||||
qty = max(qty,procurement.product_id.seller_ids[0].qty)
|
||||
|
||||
price = pricelist_obj.price_get(cr, uid, [pricelist_id], procurement.product_id.id, qty, False, {'uom': uom_id})[pricelist_id]
|
||||
|
||||
@@ -1394,9 +1398,9 @@ class mrp_procurement(osv.osv):
|
||||
newdate = newdate - procurement.product_id.seller_ids[0].delay
|
||||
|
||||
#Passing partner_id to context for purchase order line integrity of Line name
|
||||
context.update({'lang':partner.lang, 'partner_id':partner_id})
|
||||
context.update({'lang': partner.lang, 'partner_id': partner_id})
|
||||
|
||||
product = prod_obj.browse(cr,uid,procurement.product_id.id,context=context)
|
||||
product = prod_obj.browse(cr, uid, procurement.product_id.id, context=context)
|
||||
|
||||
line = {
|
||||
'name': product.partner_ref,
|
||||
@@ -1406,13 +1410,13 @@ class mrp_procurement(osv.osv):
|
||||
'price_unit': price,
|
||||
'date_planned': newdate.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'move_dest_id': res_id,
|
||||
'notes':product.description_purchase,
|
||||
'notes': product.description_purchase,
|
||||
}
|
||||
|
||||
taxes_ids = procurement.product_id.product_tmpl_id.supplier_taxes_id
|
||||
taxes = acc_pos_obj.map_tax(cr, uid, partner.property_account_position, taxes_ids)
|
||||
line.update({
|
||||
'taxes_id':[(6,0,taxes)]
|
||||
'taxes_id': [(6,0,taxes)]
|
||||
})
|
||||
purchase_id = po_obj.create(cr, uid, {
|
||||
'origin': procurement.origin,
|
||||
@@ -1425,7 +1429,7 @@ class mrp_procurement(osv.osv):
|
||||
'fiscal_position': partner.property_account_position and partner.property_account_position.id or False
|
||||
})
|
||||
res[procurement.id] = purchase_id
|
||||
self.write(cr, uid, [procurement.id], {'state':'running', 'purchase_id':purchase_id})
|
||||
self.write(cr, uid, [procurement.id], {'state': 'running', 'purchase_id': purchase_id})
|
||||
return res
|
||||
|
||||
def action_cancel(self, cr, uid, ids):
|
||||
@@ -1437,16 +1441,16 @@ class mrp_procurement(osv.osv):
|
||||
move_obj = self.pool.get('stock.move')
|
||||
for proc in self.browse(cr, uid, ids):
|
||||
if proc.close_move:
|
||||
if proc.move_id.state not in ('done','cancel'):
|
||||
if proc.move_id.state not in ('done', 'cancel'):
|
||||
todo2.append(proc.move_id.id)
|
||||
else:
|
||||
if proc.move_id and proc.move_id.state=='waiting':
|
||||
if proc.move_id and proc.move_id.state == 'waiting':
|
||||
todo.append(proc.move_id.id)
|
||||
if len(todo2):
|
||||
move_obj.action_cancel(cr, uid, todo2)
|
||||
if len(todo):
|
||||
move_obj.write(cr, uid, todo, {'state':'assigned'})
|
||||
self.write(cr, uid, ids, {'state':'cancel'})
|
||||
move_obj.write(cr, uid, todo, {'state': 'assigned'})
|
||||
self.write(cr, uid, ids, {'state': 'cancel'})
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for id in ids:
|
||||
wf_service.trg_trigger(uid, 'mrp.procurement', id, cr)
|
||||
@@ -1461,7 +1465,7 @@ class mrp_procurement(osv.osv):
|
||||
"""
|
||||
ok = False
|
||||
for procurement in self.browse(cr, uid, ids):
|
||||
if procurement.move_id.state=='assigned' or procurement.move_id.state=='done':
|
||||
if procurement.move_id.state == 'assigned' or procurement.move_id.state == 'done':
|
||||
self.action_done(cr, uid, [procurement.id])
|
||||
ok = True
|
||||
return ok
|
||||
@@ -1470,7 +1474,7 @@ class mrp_procurement(osv.osv):
|
||||
""" Changes procurement state to Ready.
|
||||
@return: True
|
||||
"""
|
||||
res = self.write(cr, uid, ids, {'state':'ready'})
|
||||
res = self.write(cr, uid, ids, {'state': 'ready'})
|
||||
return res
|
||||
|
||||
def action_done(self, cr, uid, ids):
|
||||
@@ -1482,7 +1486,7 @@ class mrp_procurement(osv.osv):
|
||||
if procurement.move_id:
|
||||
if procurement.close_move and (procurement.move_id.state <> 'done'):
|
||||
move_obj.action_done(cr, uid, [procurement.move_id.id])
|
||||
res = self.write(cr, uid, ids, {'state':'done', 'date_close':time.strftime('%Y-%m-%d')})
|
||||
res = self.write(cr, uid, ids, {'state': 'done', 'date_close': time.strftime('%Y-%m-%d')})
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for id in ids:
|
||||
wf_service.trg_trigger(uid, 'mrp.procurement', id, cr)
|
||||
|
||||
@@ -864,6 +864,7 @@
|
||||
<field name="date_planned" widget="date"/>
|
||||
<field name="state" />
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="1" string="Group By" colspan="4" col="8">
|
||||
<filter string="Product" icon="terp-mrp" domain="[]" context="{'group_by':'product_id'}"/>
|
||||
<filter string="Reason" icon="terp-mrp" domain="[]" context="{'group_by':'name'}"/>
|
||||
|
||||
+13
-21
@@ -27,13 +27,9 @@ class product_product(osv.osv):
|
||||
_inherit = "product.product"
|
||||
|
||||
def get_product_accounts(self, cr, uid, product_id, context={}):
|
||||
|
||||
"""
|
||||
To get the stock input account, stock output account and stock journal related to product.
|
||||
|
||||
@param product_id : product id
|
||||
@return: dictionary which contains information regarding stock input account, stock output account and stock journal
|
||||
|
||||
""" To get the stock input account, stock output account and stock journal related to product.
|
||||
@param product_id: product id
|
||||
@return: dictionary which contains information regarding stock input account, stock output account and stock journal
|
||||
"""
|
||||
product_obj = self.pool.get('product.product').browse(cr, uid, product_id, False)
|
||||
|
||||
@@ -55,14 +51,10 @@ class product_product(osv.osv):
|
||||
return res
|
||||
|
||||
def do_change_standard_price(self, cr, uid, ids, datas, context={}):
|
||||
"""
|
||||
Changes the Standard Price of Product and parent products and creates an account move accordingly.
|
||||
|
||||
@param datas : dict. contain default datas like new_price, stock_output_account, stock_input_account, stock_journal
|
||||
@param context: A standard dictionary
|
||||
|
||||
@return:
|
||||
|
||||
""" Changes the Standard Price of Product and parent products and creates an account move accordingly.
|
||||
@param datas: dict. contain default datas like new_price, stock_output_account, stock_input_account, stock_journal
|
||||
@param context: A standard dictionary
|
||||
@return:
|
||||
"""
|
||||
#TODO : TO Check
|
||||
res = super(product_product, self).do_change_standard_price(cr, uid, ids, datas, context=context)
|
||||
@@ -73,15 +65,15 @@ class product_product(osv.osv):
|
||||
if bom.bom_id.bom_lines :
|
||||
for bom_line in bom.bom_id.bom_lines :
|
||||
prod_price = self.read(cr, uid, bom_line.product_id.id, ['standard_price'])['standard_price']
|
||||
price += bom_line.product_qty * prod_price
|
||||
price += bom_line.product_qty * prod_price
|
||||
|
||||
accounts = self.get_product_accounts(cr, uid, bom.bom_id.product_id.id , context)
|
||||
accounts = self.get_product_accounts(cr, uid, bom.bom_id.product_id.id, context)
|
||||
|
||||
datas = {
|
||||
'new_price' : price,
|
||||
'stock_output_account' : accounts['stock_account_output'],
|
||||
'stock_input_account' : accounts['stock_account_input'],
|
||||
'stock_journal' : accounts['stock_journal']
|
||||
'new_price': price,
|
||||
'stock_output_account': accounts['stock_account_output'],
|
||||
'stock_input_account': accounts['stock_account_input'],
|
||||
'stock_journal': accounts['stock_journal']
|
||||
}
|
||||
super(product_product, self).do_change_standard_price(cr, uid, [bom.bom_id.product_id.id], datas, context)
|
||||
_compute_price(bom.bom_id)
|
||||
|
||||
@@ -60,7 +60,7 @@ class mrp_procurement(osv.osv):
|
||||
cr.execute('select id from mrp_procurement where state=%s and procure_method=%s order by priority,date_planned limit 500 offset %s', ('confirmed', 'make_to_order', offset))
|
||||
ids = map(lambda x: x[0], cr.fetchall())
|
||||
for proc in procurement_obj.browse(cr, uid, ids):
|
||||
if (maxdate.strftime('%Y-%m-%d')>=proc.date_planned):
|
||||
if (maxdate.strftime('%Y-%m-%d') >= proc.date_planned):
|
||||
wf_service.trg_validate(uid, 'mrp.procurement', proc.id, 'button_check', cr)
|
||||
else:
|
||||
offset += 1
|
||||
@@ -81,7 +81,7 @@ class mrp_procurement(osv.osv):
|
||||
ids = []
|
||||
while True:
|
||||
report_ids = []
|
||||
ids = self.pool.get('mrp.procurement').search(cr, uid, [('state', '=', 'confirmed'), ('procure_method', '=', 'make_to_stock')], offset=offset)
|
||||
ids = procurement_obj.search(cr, uid, [('state', '=', 'confirmed'), ('procure_method', '=', 'make_to_stock')], offset=offset)
|
||||
for proc in procurement_obj.browse(cr, uid, ids):
|
||||
if ((maxdate).strftime('%Y-%m-%d') >= proc.date_planned) :
|
||||
wf_service.trg_validate(uid, 'mrp.procurement', proc.id, 'button_check', cr)
|
||||
@@ -140,7 +140,7 @@ class mrp_procurement(osv.osv):
|
||||
|
||||
for warehouse in warehouse_obj.browse(cr, uid, warehouse_ids, context=context):
|
||||
context['warehouse'] = warehouse
|
||||
for product in self.pool.get('product.product').browse(cr, uid, products_id, context=context):
|
||||
for product in product_obj.browse(cr, uid, products_id, context=context):
|
||||
if product.virtual_available >= 0.0:
|
||||
continue
|
||||
|
||||
|
||||
+33
-21
@@ -34,6 +34,7 @@ class stock_warehouse_orderpoint(osv.osv):
|
||||
"""
|
||||
_name = "stock.warehouse.orderpoint"
|
||||
_description = "Orderpoint minimum rule"
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Name', size=32, required=True),
|
||||
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the orderpoint without removing it."),
|
||||
@@ -59,28 +60,31 @@ class stock_warehouse_orderpoint(osv.osv):
|
||||
'qty_multiple': lambda *a: 1,
|
||||
'name': lambda x,y,z,c: x.pool.get('ir.sequence').get(y,z,'mrp.warehouse.orderpoint') or '',
|
||||
'product_uom': lambda sel, cr, uid, context: context.get('product_uom', False),
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.warehouse.orderpoint', context=c)
|
||||
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.warehouse.orderpoint', context=c)
|
||||
}
|
||||
|
||||
def onchange_warehouse_id(self, cr, uid, ids, warehouse_id, context={}):
|
||||
""" Finds location id for changed warehouse.
|
||||
@param warehouse_id: Changed id of warehouse.
|
||||
@return: Dictionary of values.
|
||||
"""
|
||||
if warehouse_id:
|
||||
w=self.pool.get('stock.warehouse').browse(cr,uid,warehouse_id, context)
|
||||
v = {'location_id':w.lot_stock_id.id}
|
||||
w = self.pool.get('stock.warehouse').browse(cr, uid, warehouse_id, context)
|
||||
v = {'location_id': w.lot_stock_id.id}
|
||||
return {'value': v}
|
||||
return {}
|
||||
|
||||
def onchange_product_id(self, cr, uid, ids, product_id, context={}):
|
||||
""" Finds UoM for changed product.
|
||||
@param product_id: Changed id of product.
|
||||
@return: Dictionary of values.
|
||||
"""
|
||||
if product_id:
|
||||
prod=self.pool.get('product.product').browse(cr,uid,product_id)
|
||||
v = {'product_uom':prod.uom_id.id}
|
||||
prod = self.pool.get('product.product').browse(cr,uid,product_id)
|
||||
v = {'product_uom': prod.uom_id.id}
|
||||
return {'value': v}
|
||||
return {}
|
||||
|
||||
def copy(self, cr, uid, id, default=None,context={}):
|
||||
if not default:
|
||||
default = {}
|
||||
@@ -88,14 +92,17 @@ class stock_warehouse_orderpoint(osv.osv):
|
||||
'name': self.pool.get('ir.sequence').get(cr, uid, 'mrp.warehouse.orderpoint') or '',
|
||||
})
|
||||
return super(stock_warehouse_orderpoint, self).copy(cr, uid, id, default, context)
|
||||
|
||||
stock_warehouse_orderpoint()
|
||||
|
||||
class StockMove(osv.osv):
|
||||
_inherit = 'stock.move'
|
||||
|
||||
_columns = {
|
||||
'production_id': fields.many2one('mrp.production', 'Production', select=True),
|
||||
'procurements': fields.one2many('mrp.procurement', 'move_id', 'Procurements'),
|
||||
}
|
||||
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
default = default or {}
|
||||
default['procurements'] = []
|
||||
@@ -106,19 +113,24 @@ class StockMove(osv.osv):
|
||||
@param move: Stock moves
|
||||
@return: True
|
||||
"""
|
||||
if move.product_id.supply_method=='produce' and move.product_id.procure_method=='make_to_order':
|
||||
bis = self.pool.get('mrp.bom').search(cr, uid, [
|
||||
bom_obj = self.pool.get('mrp.bom')
|
||||
move_obj = self.pool.get('stock.move')
|
||||
procurement_obj = self.pool.get('mrp.procurement')
|
||||
product_obj = self.pool.get('product.product')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
if move.product_id.supply_method == 'produce' and move.product_id.procure_method == 'make_to_order':
|
||||
bis = bom_obj.search(cr, uid, [
|
||||
('product_id','=',move.product_id.id),
|
||||
('bom_id','=',False),
|
||||
('type','=','phantom')])
|
||||
if bis:
|
||||
factor = move.product_qty
|
||||
bom_point = self.pool.get('mrp.bom').browse(cr, uid, bis[0])
|
||||
res = self.pool.get('mrp.bom')._bom_explode(cr, uid, bom_point, factor, [])
|
||||
bom_point = bom_obj.browse(cr, uid, bis[0])
|
||||
res = bom_obj._bom_explode(cr, uid, bom_point, factor, [])
|
||||
dest = move.product_id.product_tmpl_id.property_stock_production.id
|
||||
state = 'confirmed'
|
||||
if move.state=='assigned':
|
||||
state='assigned'
|
||||
if move.state == 'assigned':
|
||||
state = 'assigned'
|
||||
for line in res[0]:
|
||||
valdef = {
|
||||
'picking_id': move.picking_id.id,
|
||||
@@ -135,9 +147,9 @@ class StockMove(osv.osv):
|
||||
'move_history_ids2': [(6,0,[])],
|
||||
'procurements': [],
|
||||
}
|
||||
mid = self.pool.get('stock.move').copy(cr, uid, move.id, default=valdef)
|
||||
prodobj = self.pool.get('product.product').browse(cr, uid, line['product_id'], context=context)
|
||||
proc_id = self.pool.get('mrp.procurement').create(cr, uid, {
|
||||
mid = move_obj.copy(cr, uid, move.id, default=valdef)
|
||||
prodobj = product_obj.browse(cr, uid, line['product_id'], context=context)
|
||||
proc_id = procurement_obj.create(cr, uid, {
|
||||
'name': (move.picking_id.origin or ''),
|
||||
'origin': (move.picking_id.origin or ''),
|
||||
'date_planned': move.date_planned,
|
||||
@@ -151,21 +163,18 @@ class StockMove(osv.osv):
|
||||
'move_id': mid,
|
||||
'company_id': line['company_id'],
|
||||
})
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'mrp.procurement', proc_id, 'button_confirm', cr)
|
||||
self.pool.get('stock.move').write(cr, uid, [move.id], {
|
||||
move_obj.write(cr, uid, [move.id], {
|
||||
'location_id': move.location_dest_id.id,
|
||||
'auto_validate': True,
|
||||
'picking_id': False,
|
||||
'location_id': dest,
|
||||
'state': 'waiting'
|
||||
})
|
||||
for m in self.pool.get('mrp.procurement').search(cr, uid, [('move_id','=',move.id)], context):
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for m in procurement_obj.search(cr, uid, [('move_id','=',move.id)], context):
|
||||
wf_service.trg_validate(uid, 'mrp.procurement', m, 'button_wait_done', cr)
|
||||
return True
|
||||
|
||||
|
||||
def action_consume(self, cr, uid, ids, product_qty, location_id=False, context=None):
|
||||
""" Consumed product with specific quatity from specific source location.
|
||||
@param product_qty: Consumed product quantity
|
||||
@@ -232,8 +241,9 @@ class StockPicking(osv.osv):
|
||||
@param *args: Arguments
|
||||
@return: Picking ids.
|
||||
"""
|
||||
for move in self.pool.get('stock.move').browse(cr, uid, picks):
|
||||
self.pool.get('stock.move')._action_explode(cr, uid, move)
|
||||
move_obj = self.pool.get('stock.move')
|
||||
for move in move_obj.browse(cr, uid, picks):
|
||||
move_obj._action_explode(cr, uid, move)
|
||||
return picks
|
||||
|
||||
StockPicking()
|
||||
@@ -241,6 +251,7 @@ StockPicking()
|
||||
|
||||
class spilt_in_production_lot(osv.osv_memory):
|
||||
_inherit = "stock.move.split"
|
||||
|
||||
def split(self, cr, uid, ids, move_ids, context=None):
|
||||
""" Splits move lines into given quantities.
|
||||
@param move_ids: Stock moves.
|
||||
@@ -255,5 +266,6 @@ class spilt_in_production_lot(osv.osv_memory):
|
||||
for new_move in new_moves:
|
||||
production_obj.write(cr, uid, production_ids, {'move_lines': [(4, new_move)]})
|
||||
return res
|
||||
|
||||
spilt_in_production_lot()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -187,7 +187,17 @@ class mrp_production(osv.osv):
|
||||
for workcenter_line in obj.workcenter_lines:
|
||||
tmp=self.pool.get('mrp.production.workcenter.line').action_done(cr,uid,[workcenter_line.id])
|
||||
return super(mrp_production,self).action_production_end(cr,uid,ids)
|
||||
|
||||
|
||||
def action_in_production(self, cr, uid, ids):
|
||||
""" Changes state to In Production and writes starting date.
|
||||
@return: True
|
||||
"""
|
||||
obj = self.browse(cr, uid, ids)[0]
|
||||
workcenter_line_obj = self.pool.get('mrp.production.workcenter.line')
|
||||
for workcenter_line in obj.workcenter_lines:
|
||||
workcenter_line_obj.action_start_working(cr, uid, [workcenter_line.id])
|
||||
return super(mrp_production,self).action_in_production(cr, uid, ids)
|
||||
|
||||
def action_cancel(self, cr, uid, ids):
|
||||
obj=self.browse(cr,uid,ids)[0]
|
||||
for workcenter_line in obj.workcenter_lines:
|
||||
|
||||
+186
-68
@@ -33,8 +33,18 @@ class mrp_repair(osv.osv):
|
||||
_description = 'Repairs Order'
|
||||
|
||||
def _amount_untaxed(self, cr, uid, ids, field_name, arg, context):
|
||||
""" Calculates untaxed amount.
|
||||
@param self: The object pointer
|
||||
@param cr: The current row, from the database cursor,
|
||||
@param uid: The current user ID for security checks
|
||||
@param ids: List of selected IDs
|
||||
@param field_name: Name of field.
|
||||
@param arg: Argument
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return: Dictionary of values.
|
||||
"""
|
||||
res = {}
|
||||
cur_obj=self.pool.get('res.currency')
|
||||
cur_obj = self.pool.get('res.currency')
|
||||
for repair in self.browse(cr, uid, ids):
|
||||
res[repair.id] = 0.0
|
||||
for line in repair.operations:
|
||||
@@ -46,35 +56,46 @@ class mrp_repair(osv.osv):
|
||||
return res
|
||||
|
||||
def _amount_tax(self, cr, uid, ids, field_name, arg, context):
|
||||
""" Calculates taxed amount.
|
||||
@param field_name: Name of field.
|
||||
@param arg: Argument
|
||||
@return: Dictionary of values.
|
||||
"""
|
||||
res = {}
|
||||
cur_obj=self.pool.get('res.currency')
|
||||
cur_obj = self.pool.get('res.currency')
|
||||
tax_obj = self.pool.get('account.tax')
|
||||
for repair in self.browse(cr, uid, ids):
|
||||
val = 0.0
|
||||
cur=repair.pricelist_id.currency_id
|
||||
cur = repair.pricelist_id.currency_id
|
||||
for line in repair.operations:
|
||||
if line.to_invoice:
|
||||
for c in self.pool.get('account.tax').compute(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty, repair.partner_invoice_id.id, line.product_id, repair.partner_id):
|
||||
val+= c['amount']
|
||||
for c in tax_obj.compute(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty, repair.partner_invoice_id.id, line.product_id, repair.partner_id):
|
||||
val += c['amount']
|
||||
for line in repair.fees_lines:
|
||||
if line.to_invoice:
|
||||
for c in self.pool.get('account.tax').compute(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty, repair.partner_invoice_id.id, line.product_id, repair.partner_id):
|
||||
val+= c['amount']
|
||||
res[repair.id]=cur_obj.round(cr, uid, cur, val)
|
||||
for c in tax_obj.compute(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty, repair.partner_invoice_id.id, line.product_id, repair.partner_id):
|
||||
val += c['amount']
|
||||
res[repair.id] = cur_obj.round(cr, uid, cur, val)
|
||||
return res
|
||||
|
||||
def _amount_total(self, cr, uid, ids, field_name, arg, context):
|
||||
""" Calculates total amount.
|
||||
@param field_name: Name of field.
|
||||
@param arg: Argument
|
||||
@return: Dictionary of values.
|
||||
"""
|
||||
res = {}
|
||||
untax = self._amount_untaxed(cr, uid, ids, field_name, arg, context)
|
||||
tax = self._amount_tax(cr, uid, ids, field_name, arg, context)
|
||||
cur_obj=self.pool.get('res.currency')
|
||||
cur_obj = self.pool.get('res.currency')
|
||||
for id in ids:
|
||||
repair=self.browse(cr, uid, [id])[0]
|
||||
cur=repair.pricelist_id.currency_id
|
||||
repair = self.browse(cr, uid, [id])[0]
|
||||
cur = repair.pricelist_id.currency_id
|
||||
res[id] = cur_obj.round(cr, uid, cur, untax.get(id, 0.0) + tax.get(id, 0.0))
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'name' : fields.char('Repair Reference',size=24, required=True),
|
||||
'name': fields.char('Repair Reference',size=24, required=True),
|
||||
'product_id': fields.many2one('product.product', string='Product to Repair', required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'partner_id' : fields.many2one('res.partner', 'Partner', select=True, help='This field allow you to choose the parner that will be invoiced and delivered'),
|
||||
'address_id': fields.many2one('res.partner.address', 'Delivery Address', domain="[('partner_id','=',partner_id)]"),
|
||||
@@ -110,12 +131,12 @@ class mrp_repair(osv.osv):
|
||||
select=True, required=True, states={'draft':[('readonly',False)]}, readonly=True, help='This field allow you to change the workflow of the repair order. If value selected is different from \'No Invoice\', it also allow you to select the pricelist and invoicing address.'),
|
||||
'invoice_id': fields.many2one('account.invoice', 'Invoice', readonly=True),
|
||||
'picking_id': fields.many2one('stock.picking', 'Picking',readonly=True),
|
||||
'fees_lines' : fields.one2many('mrp.repair.fee', 'repair_id', 'Fees Lines', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'internal_notes' : fields.text('Internal Notes'),
|
||||
'quotation_notes' : fields.text('Quotation Notes'),
|
||||
'fees_lines': fields.one2many('mrp.repair.fee', 'repair_id', 'Fees Lines', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'internal_notes': fields.text('Internal Notes'),
|
||||
'quotation_notes': fields.text('Quotation Notes'),
|
||||
'deliver_bool': fields.boolean('Deliver', help="Check this box if you want to manage the delivery once the product is repaired. If cheked, it will create a picking with selected product. Note that you can select the locations in the Info tab, if you have the extended view."),
|
||||
'invoiced': fields.boolean('Invoiced', readonly=True),
|
||||
'repaired' : fields.boolean('Repaired', readonly=True),
|
||||
'repaired': fields.boolean('Repaired', readonly=True),
|
||||
'amount_untaxed': fields.function(_amount_untaxed, method=True, string='Untaxed Amount'),
|
||||
'amount_tax': fields.function(_amount_tax, method=True, string='Taxes'),
|
||||
'amount_total': fields.function(_amount_total, method=True, string='Total'),
|
||||
@@ -144,6 +165,10 @@ class mrp_repair(osv.osv):
|
||||
|
||||
|
||||
def onchange_product_id(self, cr, uid, ids, product_id=None):
|
||||
""" On change of product sets some values.
|
||||
@param product_id: Changed product
|
||||
@return: Dictionary of values.
|
||||
"""
|
||||
return {'value': {
|
||||
'prodlot_id': False,
|
||||
'move_id': False,
|
||||
@@ -154,6 +179,12 @@ class mrp_repair(osv.osv):
|
||||
}
|
||||
|
||||
def onchange_move_id(self, cr, uid, ids, prod_id=False, move_id=False):
|
||||
""" On change of move id sets values of guarantee limit, source location,
|
||||
destination location, partner and partner address.
|
||||
@param prod_id: Id of product in current record.
|
||||
@param move_id: Changed move.
|
||||
@return: Dictionary of values.
|
||||
"""
|
||||
data = {}
|
||||
data['value'] = {}
|
||||
if not prod_id:
|
||||
@@ -179,15 +210,23 @@ class mrp_repair(osv.osv):
|
||||
return True
|
||||
|
||||
def onchange_partner_id(self, cr, uid, ids, part, address_id):
|
||||
""" On change of partner sets the values of partner address,
|
||||
partner invoice address and pricelist.
|
||||
@param part: Changed id of partner.
|
||||
@param address_id: Address id from current record.
|
||||
@return: Dictionary of values.
|
||||
"""
|
||||
part_obj = self.pool.get('res.partner')
|
||||
pricelist_obj = self.pool.get('product.pricelist')
|
||||
if not part:
|
||||
return {'value': {
|
||||
'address_id': False,
|
||||
'partner_invoice_id': False,
|
||||
'pricelist_id': self.pool.get('product.pricelist').search(cr,uid,[('type','=','sale')])[0]
|
||||
'pricelist_id': pricelist_obj.search(cr, uid, [('type','=','sale')])[0]
|
||||
}
|
||||
}
|
||||
addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['delivery', 'invoice', 'default'])
|
||||
partner = self.pool.get('res.partner').browse(cr, uid, part)
|
||||
addr = part_obj.address_get(cr, uid, [part], ['delivery', 'invoice', 'default'])
|
||||
partner = part_obj.browse(cr, uid, part)
|
||||
pricelist = partner.property_product_pricelist and partner.property_product_pricelist.id or False
|
||||
return {'value': {
|
||||
'address_id': address_id or addr['delivery'],
|
||||
@@ -197,6 +236,14 @@ class mrp_repair(osv.osv):
|
||||
}
|
||||
|
||||
def onchange_lot_id(self, cr, uid, ids, lot, product_id):
|
||||
""" On change of production lot sets the values of source location,
|
||||
destination location, move and guarantee limit.
|
||||
@param lot: Changed id of production lot.
|
||||
@param product_id: Product id from current record.
|
||||
@return: Dictionary of values.
|
||||
"""
|
||||
prodlot_obj = self.pool.get('stock.production.lot')
|
||||
move_obj = self.pool.get('stock.move')
|
||||
data = {}
|
||||
data['value'] = {
|
||||
'location_id': False,
|
||||
@@ -207,8 +254,8 @@ class mrp_repair(osv.osv):
|
||||
|
||||
if not lot:
|
||||
return data
|
||||
lot_info = self.pool.get('stock.production.lot').browse(cr, uid, lot)
|
||||
move_ids = self.pool.get('stock.move').search(cr, uid, [('prodlot_id', '=', lot)])
|
||||
lot_info = prodlot_obj.browse(cr, uid, lot)
|
||||
move_ids = move_obj.search(cr, uid, [('prodlot_id', '=', lot)])
|
||||
|
||||
if not len(move_ids):
|
||||
return data
|
||||
@@ -219,13 +266,17 @@ class mrp_repair(osv.osv):
|
||||
return lst_move
|
||||
|
||||
move_id = move_ids[0]
|
||||
move = get_last_move(self.pool.get('stock.move').browse(cr, uid, move_id))
|
||||
move = get_last_move(move_obj.browse(cr, uid, move_id))
|
||||
data['value']['move_id'] = move.id
|
||||
d = self.onchange_move_id(cr, uid, ids, product_id, move.id)
|
||||
data['value'].update(d['value'])
|
||||
return data
|
||||
|
||||
def action_cancel_draft(self, cr, uid, ids, *args):
|
||||
""" Cancels repair order when it is in 'Draft' state.
|
||||
@param *arg: Arguments
|
||||
@return: True
|
||||
"""
|
||||
if not len(ids):
|
||||
return False
|
||||
mrp_line_obj = self.pool.get('mrp.repair.line')
|
||||
@@ -238,6 +289,11 @@ class mrp_repair(osv.osv):
|
||||
return True
|
||||
|
||||
def action_confirm(self, cr, uid, ids, *args):
|
||||
""" Repair order state is set to 'To be invoiced' when invoice method
|
||||
is 'Before repair' else state becomes 'Confirmed'.
|
||||
@param *arg: Arguments
|
||||
@return: True
|
||||
"""
|
||||
mrp_line_obj = self.pool.get('mrp.repair.line')
|
||||
for o in self.browse(cr, uid, ids):
|
||||
if (o.invoice_method == 'b4repair'):
|
||||
@@ -248,6 +304,9 @@ class mrp_repair(osv.osv):
|
||||
return True
|
||||
|
||||
def action_cancel(self, cr, uid, ids, context=None):
|
||||
""" Cancels repair order.
|
||||
@return: True
|
||||
"""
|
||||
ok=True
|
||||
mrp_line_obj = self.pool.get('mrp.repair.line')
|
||||
for repair in self.browse(cr, uid, ids):
|
||||
@@ -259,25 +318,33 @@ class mrp_repair(osv.osv):
|
||||
return self.action_invoice_create(cr, uid, ids)
|
||||
|
||||
def action_invoice_create(self, cr, uid, ids, group=False, context=None):
|
||||
res={}
|
||||
""" Creates invoice(s) for repair order.
|
||||
@param group: It is set to true when group invoice is to be generated.
|
||||
@return: Invoice Ids.
|
||||
"""
|
||||
res = {}
|
||||
invoices_group = {}
|
||||
inv_line_obj = self.pool.get('account.invoice.line')
|
||||
inv_obj = self.pool.get('account.invoice')
|
||||
repair_line_obj = self.pool.get('mrp.repair.line')
|
||||
repair_fee_obj = self.pool.get('mrp.repair.fee')
|
||||
for repair in self.browse(cr, uid, ids, context=context):
|
||||
res[repair.id]=False
|
||||
res[repair.id] = False
|
||||
if repair.state in ('draft','cancel') or repair.invoice_id:
|
||||
continue
|
||||
if not (repair.partner_id.id and repair.partner_invoice_id.id):
|
||||
raise osv.except_osv(_('No partner !'),_('You have to select a Partner Invoice Address in the repair form !'))
|
||||
comment=repair.quotation_notes
|
||||
comment = repair.quotation_notes
|
||||
if (repair.invoice_method != 'none'):
|
||||
if group and repair.partner_invoice_id.id in invoices_group:
|
||||
inv_id= invoices_group[repair.partner_invoice_id.id]
|
||||
invoice=invoice_obj.browse(cr, uid,inv_id)
|
||||
inv_id = invoices_group[repair.partner_invoice_id.id]
|
||||
invoice = inv_obj.browse(cr, uid, inv_id)
|
||||
invoice_vals = {
|
||||
'name': invoice.name +', '+repair.name,
|
||||
'origin': invoice.origin+', '+repair.name,
|
||||
'comment':(comment and (invoice.comment and invoice.comment+"\n"+comment or comment)) or (invoice.comment and invoice.comment or ''),
|
||||
}
|
||||
invoice_obj.write(cr, uid, [inv_id],invoice_vals,context=context)
|
||||
invoice_obj.write(cr, uid, [inv_id], invoice_vals, context=context)
|
||||
else:
|
||||
a = repair.partner_id.property_account_receivable.id
|
||||
inv = {
|
||||
@@ -291,10 +358,9 @@ class mrp_repair(osv.osv):
|
||||
'comment': repair.quotation_notes,
|
||||
'fiscal_position': repair.partner_id.property_account_position.id
|
||||
}
|
||||
inv_obj = self.pool.get('account.invoice')
|
||||
inv_id = inv_obj.create(cr, uid, inv)
|
||||
invoices_group[repair.partner_invoice_id.id] = inv_id
|
||||
self.write(cr, uid, repair.id , {'invoiced':True,'invoice_id' : inv_id})
|
||||
self.write(cr, uid, repair.id, {'invoiced': True, 'invoice_id': inv_id})
|
||||
|
||||
for operation in repair.operations:
|
||||
if operation.to_invoice == True:
|
||||
@@ -302,29 +368,29 @@ class mrp_repair(osv.osv):
|
||||
name = repair.name + '-' + operation.name
|
||||
else:
|
||||
name = operation.name
|
||||
invoice_line_id=self.pool.get('account.invoice.line').create(cr, uid, {
|
||||
invoice_line_id = inv_line_obj.create(cr, uid, {
|
||||
'invoice_id': inv_id,
|
||||
'name': name,
|
||||
'origin':repair.name,
|
||||
'origin': repair.name,
|
||||
'account_id': operation.product_id and operation.product_id.property_account_income and operation.product_id.property_account_income.id,
|
||||
'quantity' : operation.product_uom_qty,
|
||||
'quantity': operation.product_uom_qty,
|
||||
'invoice_line_tax_id': [(6,0,[x.id for x in operation.tax_id])],
|
||||
'uos_id' : operation.product_uom.id,
|
||||
'price_unit' : operation.price_unit,
|
||||
'price_subtotal' : operation.product_uom_qty*operation.price_unit,
|
||||
'product_id' : operation.product_id and operation.product_id.id or False
|
||||
'uos_id': operation.product_uom.id,
|
||||
'price_unit': operation.price_unit,
|
||||
'price_subtotal': operation.product_uom_qty*operation.price_unit,
|
||||
'product_id': operation.product_id and operation.product_id.id or False
|
||||
})
|
||||
self.pool.get('mrp.repair.line').write(cr, uid, [operation.id], {'invoiced':True,'invoice_line_id':invoice_line_id})
|
||||
repair_line_obj.write(cr, uid, [operation.id], {'invoiced': True, 'invoice_line_id': invoice_line_id})
|
||||
for fee in repair.fees_lines:
|
||||
if fee.to_invoice == True:
|
||||
if group:
|
||||
name = repair.name + '-' + fee.name
|
||||
else:
|
||||
name = fee.name
|
||||
invoice_fee_id=self.pool.get('account.invoice.line').create(cr, uid, {
|
||||
invoice_fee_id = inv_line_obj.create(cr, uid, {
|
||||
'invoice_id': inv_id,
|
||||
'name': name,
|
||||
'origin':repair.name,
|
||||
'origin': repair.name,
|
||||
'account_id': a,
|
||||
'quantity': fee.product_uom_qty,
|
||||
'invoice_line_tax_id': [(6,0,[x.id for x in fee.tax_id])],
|
||||
@@ -333,27 +399,39 @@ class mrp_repair(osv.osv):
|
||||
'price_unit': fee.price_unit,
|
||||
'price_subtotal': fee.product_uom_qty*fee.price_unit
|
||||
})
|
||||
self.pool.get('mrp.repair.fee').write(cr, uid, [fee.id], {'invoiced':True,'invoice_line_id':invoice_fee_id})
|
||||
res[repair.id]=inv_id
|
||||
repair_fee_obj.write(cr, uid, [fee.id], {'invoiced': True, 'invoice_line_id': invoice_fee_id})
|
||||
res[repair.id] = inv_id
|
||||
#self.action_invoice_end(cr, uid, ids)
|
||||
return res
|
||||
|
||||
def action_repair_ready(self, cr, uid, ids, context=None):
|
||||
self.write(cr, uid, ids, {'state':'ready'})
|
||||
""" Writes repair order state to 'Ready'
|
||||
@return: True
|
||||
"""
|
||||
self.write(cr, uid, ids, {'state': 'ready'})
|
||||
return True
|
||||
|
||||
def action_invoice_cancel(self, cr, uid, ids, context=None):
|
||||
self.write(cr, uid, ids, {'state':'invoice_except'})
|
||||
""" Writes repair order state to 'Exception in invoice'
|
||||
@return: True
|
||||
"""
|
||||
self.write(cr, uid, ids, {'state': 'invoice_except'})
|
||||
return True
|
||||
|
||||
def action_repair_start(self, cr, uid, ids, context=None):
|
||||
self.write(cr, uid, ids, {'state':'under_repair'})
|
||||
""" Writes repair order state to 'Under Repair'
|
||||
@return: True
|
||||
"""
|
||||
self.write(cr, uid, ids, {'state': 'under_repair'})
|
||||
return True
|
||||
|
||||
def action_invoice_end(self, cr, uid, ids, context=None):
|
||||
""" Writes repair order state to 'Ready' if invoice method is Before repair.
|
||||
@return: True
|
||||
"""
|
||||
for order in self.browse(cr, uid, ids):
|
||||
val = {}
|
||||
if (order.invoice_method=='b4repair'):
|
||||
if (order.invoice_method == 'b4repair'):
|
||||
val['state'] = 'ready'
|
||||
else:
|
||||
#val['state'] = 'done'
|
||||
@@ -362,9 +440,13 @@ class mrp_repair(osv.osv):
|
||||
return True
|
||||
|
||||
def action_repair_end(self, cr, uid, ids, context=None):
|
||||
""" Writes repair order state to 'To be invoiced' if invoice method is
|
||||
After repair else state is set to 'Ready'.
|
||||
@return: True
|
||||
"""
|
||||
for order in self.browse(cr, uid, ids):
|
||||
val = {}
|
||||
val['repaired']=True
|
||||
val['repaired'] = True
|
||||
if (not order.invoiced and order.invoice_method=='after_repair'):
|
||||
val['state'] = '2binvoiced'
|
||||
elif (not order.invoiced and order.invoice_method=='b4repair'):
|
||||
@@ -376,15 +458,23 @@ class mrp_repair(osv.osv):
|
||||
return True
|
||||
|
||||
def wkf_repair_done(self, cr, uid, ids, *args):
|
||||
res=self.action_repair_done(cr,uid,ids)
|
||||
res = self.action_repair_done(cr, uid, ids)
|
||||
return True
|
||||
|
||||
def action_repair_done(self, cr, uid, ids, context=None):
|
||||
""" Creates stock move and picking for repair order.
|
||||
@return: Picking ids.
|
||||
"""
|
||||
res = {}
|
||||
move_obj = self.pool.get('stock.move')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
repair_line_obj = self.pool.get('mrp.repair.line')
|
||||
seq_obj = self.pool.get('ir.sequence')
|
||||
pick_obj = self.pool.get('stock.picking')
|
||||
company = self.pool.get('res.users').browse(cr, uid, uid).company_id
|
||||
for repair in self.browse(cr, uid, ids, context=context):
|
||||
for move in repair.operations:
|
||||
move_id = self.pool.get('stock.move').create(cr, uid, {
|
||||
move_id = move_obj.create(cr, uid, {
|
||||
'name': move.name,
|
||||
'product_id': move.product_id.id,
|
||||
'product_qty': move.product_uom_qty,
|
||||
@@ -395,11 +485,11 @@ class mrp_repair(osv.osv):
|
||||
'tracking_id': False,
|
||||
'state': 'done',
|
||||
})
|
||||
self.pool.get('mrp.repair.line').write(cr, uid, [move.id], {'move_id': move_id})
|
||||
repair_line_obj.write(cr, uid, [move.id], {'move_id': move_id})
|
||||
|
||||
if repair.deliver_bool:
|
||||
pick_name = self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.out')
|
||||
picking = self.pool.get('stock.picking').create(cr, uid, {
|
||||
pick_name = seq_obj.get(cr, uid, 'stock.picking.out')
|
||||
picking = pick_obj.create(cr, uid, {
|
||||
'name': pick_name,
|
||||
'origin': repair.name,
|
||||
'state': 'draft',
|
||||
@@ -409,10 +499,9 @@ class mrp_repair(osv.osv):
|
||||
'invoice_state': 'none',
|
||||
'type': 'out',
|
||||
})
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'stock.picking', picking, 'button_confirm', cr)
|
||||
|
||||
move_id = self.pool.get('stock.move').create(cr, uid, {
|
||||
move_id = move_obj.create(cr, uid, {
|
||||
'name': repair.name,
|
||||
'picking_id': picking,
|
||||
'product_id': repair.product_id.id,
|
||||
@@ -427,10 +516,10 @@ class mrp_repair(osv.osv):
|
||||
'tracking_id': False,
|
||||
'state': 'assigned', # FIXME done ?
|
||||
})
|
||||
self.write(cr, uid, [repair.id], {'state':'done', 'picking_id':picking})
|
||||
self.write(cr, uid, [repair.id], {'state': 'done', 'picking_id': picking})
|
||||
res[repair.id] = picking
|
||||
else:
|
||||
self.write(cr, uid, [repair.id], {'state':'done'})
|
||||
self.write(cr, uid, [repair.id], {'state': 'done'})
|
||||
return res
|
||||
|
||||
|
||||
@@ -438,7 +527,18 @@ mrp_repair()
|
||||
|
||||
|
||||
class ProductChangeMixin(object):
|
||||
def product_id_change(self, cr, uid, ids, pricelist, product, uom=False, product_uom_qty=0, partner_id=False, guarantee_limit=False):
|
||||
def product_id_change(self, cr, uid, ids, pricelist, product, uom=False,
|
||||
product_uom_qty=0, partner_id=False, guarantee_limit=False):
|
||||
""" On change of product it sets product quantity, tax account, name,
|
||||
uom of product, unit price and price subtotal.
|
||||
@param pricelist: Pricelist of current record.
|
||||
@param product: Changed id of product.
|
||||
@param uom: UoM of current record.
|
||||
@param product_uom_qty: Quantity of current record.
|
||||
@param partner_id: Partner of current record.
|
||||
@param guarantee_limit: Guarantee limit of current record.
|
||||
@return: Dictionary of values and warning message.
|
||||
"""
|
||||
result = {}
|
||||
warning = {}
|
||||
|
||||
@@ -447,7 +547,7 @@ class ProductChangeMixin(object):
|
||||
result['product_uom_qty'] = product_uom_qty
|
||||
|
||||
if product:
|
||||
product_obj = self.pool.get('product.product').browse(cr, uid, product)
|
||||
product_obj = self.pool.get('product.product').browse(cr, uid, product)
|
||||
if partner_id:
|
||||
partner = self.pool.get('res.partner').browse(cr, uid, partner_id)
|
||||
result['tax_id'] = self.pool.get('account.fiscal.position').map_tax(cr, uid, partner.property_account_position, product_obj.taxes_id)
|
||||
@@ -455,7 +555,7 @@ class ProductChangeMixin(object):
|
||||
result['name'] = product_obj.partner_ref
|
||||
result['product_uom'] = product_obj.uom_id and product_obj.uom_id.id or False
|
||||
if not pricelist:
|
||||
warning={
|
||||
warning = {
|
||||
'title':'No Pricelist !',
|
||||
'message':
|
||||
'You have to select a pricelist in the Repair form !\n'
|
||||
@@ -466,14 +566,14 @@ class ProductChangeMixin(object):
|
||||
product, product_uom_qty, partner_id, {'uom': uom,})[pricelist]
|
||||
|
||||
if price is False:
|
||||
warning={
|
||||
warning = {
|
||||
'title':'No valid pricelist line found !',
|
||||
'message':
|
||||
"Couldn't find a pricelist line matching this product and quantity.\n"
|
||||
"You have to change either the product, the quantity or the pricelist."
|
||||
}
|
||||
else:
|
||||
result.update({'price_unit': price, 'price_subtotal' :price*product_uom_qty})
|
||||
result.update({'price_unit': price, 'price_subtotal': price*product_uom_qty})
|
||||
|
||||
return {'value': result, 'warning': warning}
|
||||
|
||||
@@ -484,10 +584,15 @@ class mrp_repair_line(osv.osv, ProductChangeMixin):
|
||||
|
||||
def copy_data(self, cr, uid, id, default=None, context=None):
|
||||
if not default: default = {}
|
||||
default.update( {'invoice_line_id':False,'move_id':False,'invoiced':False,'state':'draft'})
|
||||
default.update( {'invoice_line_id': False, 'move_id': False, 'invoiced': False, 'state': 'draft'})
|
||||
return super(mrp_repair_line, self).copy_data(cr, uid, id, default, context)
|
||||
|
||||
def _amount_line(self, cr, uid, ids, field_name, arg, context):
|
||||
""" Calculates amount.
|
||||
@param field_name: Name of field.
|
||||
@param arg: Argument
|
||||
@return: Dictionary of values.
|
||||
"""
|
||||
res = {}
|
||||
cur_obj=self.pool.get('res.currency')
|
||||
for line in self.browse(cr, uid, ids):
|
||||
@@ -524,10 +629,16 @@ class mrp_repair_line(osv.osv, ProductChangeMixin):
|
||||
}
|
||||
_defaults = {
|
||||
'state': lambda *a: 'draft',
|
||||
'product_uom_qty':lambda *a:1,
|
||||
'product_uom_qty': lambda *a: 1,
|
||||
}
|
||||
|
||||
def onchange_operation_type(self, cr, uid, ids, type, guarantee_limit):
|
||||
""" On change of operation type it sets source location, destination location
|
||||
and to invoice field.
|
||||
@param product: Changed operation type.
|
||||
@param guarantee_limit: Guarantee limit of current record.
|
||||
@return: Dictionary of values.
|
||||
"""
|
||||
if not type:
|
||||
return {'value': {
|
||||
'location_id': False,
|
||||
@@ -537,19 +648,19 @@ class mrp_repair_line(osv.osv, ProductChangeMixin):
|
||||
produc_id = self.pool.get('stock.location').search(cr, uid, [('name','=','Production')])[0]
|
||||
if type == 'add':
|
||||
stock_id = self.pool.get('stock.location').search(cr, uid, [('name','=','Stock')])[0]
|
||||
to_invoice=False
|
||||
to_invoice = False
|
||||
if guarantee_limit and today() > mx.DateTime.strptime(guarantee_limit, '%Y-%m-%d'):
|
||||
to_invoice=True
|
||||
return {'value': {
|
||||
'to_invoice': to_invoice,
|
||||
'location_id': stock_id,
|
||||
'location_dest_id' : produc_id
|
||||
'location_dest_id': produc_id
|
||||
}
|
||||
}
|
||||
return {'value': {
|
||||
'to_invoice': False,
|
||||
'location_id': produc_id,
|
||||
'location_dest_id':False
|
||||
'location_dest_id': False
|
||||
}
|
||||
}
|
||||
|
||||
@@ -558,13 +669,20 @@ mrp_repair_line()
|
||||
class mrp_repair_fee(osv.osv, ProductChangeMixin):
|
||||
_name = 'mrp.repair.fee'
|
||||
_description = 'Repair Fees line'
|
||||
|
||||
def copy_data(self, cr, uid, id, default=None, context=None):
|
||||
if not default: default = {}
|
||||
default.update( {'invoice_line_id':False,'invoiced':False})
|
||||
default.update({'invoice_line_id': False, 'invoiced': False})
|
||||
return super(mrp_repair_fee, self).copy_data(cr, uid, id, default, context)
|
||||
|
||||
def _amount_line(self, cr, uid, ids, field_name, arg, context):
|
||||
""" Calculates amount.
|
||||
@param field_name: Name of field.
|
||||
@param arg: Argument
|
||||
@return: Dictionary of values.
|
||||
"""
|
||||
res = {}
|
||||
cur_obj=self.pool.get('res.currency')
|
||||
cur_obj = self.pool.get('res.currency')
|
||||
for line in self.browse(cr, uid, ids):
|
||||
res[line.id] = line.to_invoice and line.price_unit * line.product_uom_qty or 0
|
||||
cur = line.repair_id.pricelist_id.currency_id
|
||||
|
||||
@@ -28,17 +28,13 @@ class repair_cancel(osv.osv_memory):
|
||||
_description = 'Cancel Repair'
|
||||
|
||||
def cancel_repair(self, cr, uid, ids, context):
|
||||
"""
|
||||
Cancels the repair
|
||||
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param ids: List of IDs selected
|
||||
@param context: A standard dictionary
|
||||
|
||||
@return:
|
||||
|
||||
""" Cancels the repair
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param ids: List of IDs selected
|
||||
@param context: A standard dictionary
|
||||
@return:
|
||||
"""
|
||||
record_id = context and context.get('active_id', False) or False
|
||||
assert record_id, _('Active ID is not Found')
|
||||
@@ -54,16 +50,12 @@ class repair_cancel(osv.osv_memory):
|
||||
return {}
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
"""
|
||||
Changes the view dynamically
|
||||
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param context: A standard dictionary
|
||||
|
||||
@return: New arch of view.
|
||||
|
||||
""" Changes the view dynamically
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param context: A standard dictionary
|
||||
@return: New arch of view.
|
||||
"""
|
||||
record_id = context and context.get('active_id', False) or False
|
||||
res = super(repair_cancel, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
|
||||
|
||||
@@ -31,21 +31,18 @@ class make_invoice(osv.osv_memory):
|
||||
}
|
||||
|
||||
def make_invoices(self, cr, uid, ids, context):
|
||||
"""
|
||||
Generates invoice(s) of selected records.
|
||||
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param ids: List of IDs selected
|
||||
@param context: A standard dictionary
|
||||
|
||||
@return: Loads the view of new invoice(s).
|
||||
|
||||
""" Generates invoice(s) of selected records.
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param ids: List of IDs selected
|
||||
@param context: A standard dictionary
|
||||
@return: Loads the view of new invoice(s).
|
||||
"""
|
||||
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)
|
||||
newinv = order_obj.action_invoice_create(cr, uid, context['active_ids'],
|
||||
group=inv.group,context=context)
|
||||
|
||||
return {
|
||||
'domain': [('id','in', newinv.values())],
|
||||
|
||||
@@ -14,7 +14,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: olap_sale
|
||||
|
||||
@@ -14,7 +14,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: olap_sale
|
||||
|
||||
@@ -28,6 +28,7 @@ from tools.translate import _
|
||||
|
||||
|
||||
class account_journal(osv.osv):
|
||||
|
||||
_inherit = 'account.journal'
|
||||
_columns = {
|
||||
'auto_cash': fields.boolean('Automatic Opening', help="This field authorize the automatic creation of the cashbox"),
|
||||
@@ -44,21 +45,30 @@ account_journal()
|
||||
|
||||
|
||||
class singer_statement(osv.osv):
|
||||
|
||||
""" Singer Statements """
|
||||
|
||||
_name = 'singer.statement'
|
||||
_description = 'Statements'
|
||||
|
||||
def _sub_total(self, cr, uid, ids, name, arg, context=None):
|
||||
|
||||
""" Calculates Sub total"
|
||||
@param name: Names of fields.
|
||||
@param arg: User defined arguments
|
||||
@return: Dictionary of values.
|
||||
"""
|
||||
res = {}
|
||||
for obj in self.browse(cr, uid, ids):
|
||||
res[obj.id] = obj.pieces * obj.number
|
||||
return res
|
||||
|
||||
def on_change_sub2(self, cr, uid, ids, pieces, number, *a):
|
||||
sub=pieces*number
|
||||
return {'value':{'subtotal': sub or 0.0}}
|
||||
|
||||
|
||||
def on_change_sub(self, cr, uid, ids, pieces, number,*a):
|
||||
|
||||
""" Calculates Sub total on change of number
|
||||
@param pieces: Names of fields.
|
||||
@param number:
|
||||
"""
|
||||
sub=pieces*number
|
||||
return {'value':{'subtotal': sub or 0.0}}
|
||||
|
||||
@@ -73,8 +83,16 @@ class singer_statement(osv.osv):
|
||||
singer_statement()
|
||||
|
||||
class account_bank_statement(osv.osv):
|
||||
|
||||
_inherit = 'account.bank.statement'
|
||||
|
||||
def _get_starting_balance(self, cr, uid, ids, name, arg, context=None):
|
||||
|
||||
""" Find starting balance "
|
||||
@param name: Names of fields.
|
||||
@param arg: User defined arguments
|
||||
@return: Dictionary of values.
|
||||
"""
|
||||
res ={}
|
||||
for statement in self.browse(cr, uid, ids):
|
||||
amount_total=0.0
|
||||
@@ -84,6 +102,12 @@ class account_bank_statement(osv.osv):
|
||||
return res
|
||||
|
||||
def _get_sum_entry_encoding(self, cr, uid, ids, name, arg, context=None):
|
||||
|
||||
""" Find encoding total of statements "
|
||||
@param name: Names of fields.
|
||||
@param arg: User defined arguments
|
||||
@return: Dictionary of values.
|
||||
"""
|
||||
res2={}
|
||||
for statement in self.browse(cr, uid, ids):
|
||||
encoding_total=0.0
|
||||
@@ -93,8 +117,12 @@ class account_bank_statement(osv.osv):
|
||||
return res2
|
||||
|
||||
def _default_journal_id(self, cr, uid, context={}):
|
||||
|
||||
""" To get default journal for the object"
|
||||
@param name: Names of fields.
|
||||
@return: journal
|
||||
"""
|
||||
company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
|
||||
print [('type','=','cash'),('auto_cash','=',False), ('company_id', '=', company_id)]
|
||||
journal = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'cash'), ('auto_cash','=',False), ('company_id', '=', company_id)])
|
||||
if journal:
|
||||
return journal[0]
|
||||
@@ -140,6 +168,12 @@ class account_bank_statement(osv.osv):
|
||||
return res
|
||||
|
||||
def onchange_journal_id(self, cursor, user, statement_id, journal_id, context=None):
|
||||
|
||||
""" Changes balance start and starting details if journal_id changes"
|
||||
@param statement_id: Changed statement_id
|
||||
@param journal_id: Changed journal_id
|
||||
@return: Dictionary of changed values
|
||||
"""
|
||||
id_s=[]
|
||||
if not journal_id:
|
||||
return {'value': {'balance_start': 0.0}}
|
||||
@@ -171,6 +205,10 @@ class account_bank_statement(osv.osv):
|
||||
return {'value': {'balance_start': balance_start, 'starting_details_ids':new}}
|
||||
|
||||
def button_open(self, cr, uid, ids, context=None):
|
||||
|
||||
""" Changes statement state to Running.
|
||||
@return: True
|
||||
"""
|
||||
obj_inv = self.browse(cr, uid, ids)[0]
|
||||
s_id=obj_inv.journal_id
|
||||
if s_id.statement_sequence_id:
|
||||
@@ -184,6 +222,10 @@ class account_bank_statement(osv.osv):
|
||||
return True
|
||||
|
||||
def button_confirm(self, cr, uid, ids, context=None):
|
||||
|
||||
""" Check the starting and ending detail of statement
|
||||
@return: True
|
||||
"""
|
||||
val = 0.0
|
||||
val2 = 0.0
|
||||
val_statement_line = 0.0
|
||||
|
||||
+127
-11
@@ -31,8 +31,11 @@ import re
|
||||
|
||||
|
||||
class pos_config_journal(osv.osv):
|
||||
|
||||
""" Point of Sale journal configuration"""
|
||||
|
||||
_name = 'pos.config.journal'
|
||||
_description = "Point of Sale journal configuration."
|
||||
_description = "Point of Sale journal configuration"
|
||||
_columns = {
|
||||
'name': fields.char('Description', size=64),
|
||||
'code': fields.char('Code', size=64),
|
||||
@@ -42,8 +45,12 @@ class pos_config_journal(osv.osv):
|
||||
pos_config_journal()
|
||||
|
||||
class res_mode_contact(osv.osv):
|
||||
|
||||
""" Contact mode for Partner """
|
||||
|
||||
_name = "res.mode.contact"
|
||||
_description = "Contact mode"
|
||||
|
||||
_columns={
|
||||
'name': fields.char('Mode', size=64, select=1),
|
||||
'active': fields.boolean('Active', select=2),
|
||||
@@ -51,6 +58,8 @@ class res_mode_contact(osv.osv):
|
||||
res_mode_contact()
|
||||
|
||||
class contact_mode_partner(osv.osv):
|
||||
|
||||
|
||||
_inherit = 'res.partner'
|
||||
_columns = {
|
||||
'contact_mode_id': fields.many2one('res.mode.contact','Contact Mode'),
|
||||
@@ -59,6 +68,9 @@ contact_mode_partner()
|
||||
|
||||
|
||||
class pos_company_discount(osv.osv):
|
||||
|
||||
""" Company Discount and Cashboxes """
|
||||
|
||||
_inherit = 'res.company'
|
||||
_columns = {
|
||||
'company_discount': fields.float('Max Discount(%)', digits=(16,2)),
|
||||
@@ -71,12 +83,18 @@ pos_company_discount()
|
||||
|
||||
|
||||
class pos_order(osv.osv):
|
||||
|
||||
""" Point of sale gives business owners a convenient way of checking out customers
|
||||
and of recording sales """
|
||||
|
||||
_name = "pos.order"
|
||||
_description = "Point of Sale"
|
||||
_order = "date_order, create_date desc"
|
||||
_order = "date_order desc"
|
||||
|
||||
|
||||
def unlink(self, cr, uid, ids, context={}):
|
||||
|
||||
for rec in self.browse(cr, uid, ids, context=context):
|
||||
for rec_statement in rec.statement_ids:
|
||||
if (rec_statement.statement_id and rec_statement.statement_id.state=='confirm') or rec.state=='done':
|
||||
@@ -84,12 +102,20 @@ class pos_order(osv.osv):
|
||||
return super(pos_order, self).unlink(cr, uid, ids, context=context)
|
||||
|
||||
def onchange_partner_pricelist(self, cr, uid, ids, part, context={}):
|
||||
|
||||
""" Changed price list on_change of partner_id"""
|
||||
|
||||
if not part:
|
||||
return {}
|
||||
pricelist = self.pool.get('res.partner').browse(cr, uid, part).property_product_pricelist.id
|
||||
return {'value':{'pricelist_id': pricelist}}
|
||||
|
||||
def _amount_total(self, cr, uid, ids, field_name, arg, context):
|
||||
|
||||
""" Calculates amount_tax of order line
|
||||
@param field_names: Names of fields.
|
||||
@return: Dictionary of values """
|
||||
|
||||
cr.execute("""
|
||||
SELECT
|
||||
p.id,
|
||||
@@ -110,6 +136,13 @@ class pos_order(osv.osv):
|
||||
return res
|
||||
|
||||
def _get_date_payment2(self, cr, uid, ids, context, *a):
|
||||
|
||||
# Todo need to check this function
|
||||
""" Find payment Date
|
||||
|
||||
@param field_names: Names of fields.
|
||||
@return: Dictionary of values """
|
||||
|
||||
res = {}
|
||||
pay_obj = self.pool.get('account.bank.statement')
|
||||
stat_obj_line = self.pool.get('account.bank.statement.line')
|
||||
@@ -132,7 +165,12 @@ class pos_order(osv.osv):
|
||||
if val:
|
||||
res[order.id]=val
|
||||
return res
|
||||
|
||||
def _get_date_payment(self, cr, uid, ids, context, *a):
|
||||
|
||||
""" Find Validation Date
|
||||
@return: Dictionary of values """
|
||||
|
||||
res = {}
|
||||
pay_obj = self.pool.get('pos.payment')
|
||||
tot =0.0
|
||||
@@ -162,6 +200,10 @@ class pos_order(osv.osv):
|
||||
return res
|
||||
|
||||
def _amount_tax(self, cr, uid, ids, field_name, arg, context):
|
||||
|
||||
""" Calculates Taxes of order
|
||||
@return: Dictionary of values """
|
||||
|
||||
res = {}
|
||||
tax_obj = self.pool.get('account.tax')
|
||||
for order in self.browse(cr, uid, ids):
|
||||
@@ -184,6 +226,10 @@ class pos_order(osv.osv):
|
||||
return res
|
||||
|
||||
def _total_payment(self, cr, uid, ids, field_name, arg, context):
|
||||
|
||||
""" Calculates Total payment of order
|
||||
@return: Dictionary of values """
|
||||
|
||||
res = {}
|
||||
i=0
|
||||
for order in self.browse(cr, uid, ids):
|
||||
@@ -195,6 +241,10 @@ class pos_order(osv.osv):
|
||||
return {order.id:val}
|
||||
|
||||
def _total_return(self, cr, uid, ids, field_name, arg, context):
|
||||
|
||||
""" Calculates Total Returned from the order
|
||||
@return: Dictionary of values """
|
||||
|
||||
res = {}
|
||||
for order in self.browse(cr, uid, ids):
|
||||
val = 0.0
|
||||
@@ -203,11 +253,17 @@ class pos_order(osv.osv):
|
||||
res[order.id] = val
|
||||
return res
|
||||
|
||||
def payment_get(self, cr, uid, ids, context=None):
|
||||
cr.execute("select id from pos_payment where order_id =ANY(%s)",(ids,))
|
||||
return [i[0] for i in cr.fetchall()]
|
||||
# def payment_get(self, cr, uid, ids, context=None):
|
||||
# """ Calculates Total Returned from the order
|
||||
# @return: Dictionary of values """
|
||||
# cr.execute("select id from pos_payment where order_id =ANY(%s)",(ids,))
|
||||
# return [i[0] for i in cr.fetchall()]
|
||||
|
||||
def _sale_journal_get(self, cr, uid, context):
|
||||
|
||||
""" To get sale journal for this order"
|
||||
@return: journal """
|
||||
|
||||
journal_obj = self.pool.get('account.journal')
|
||||
res = journal_obj.search(cr, uid,
|
||||
[('type', '=', 'sale')], limit=1)
|
||||
@@ -217,6 +273,10 @@ class pos_order(osv.osv):
|
||||
return False
|
||||
|
||||
def _shop_get(self, cr, uid, context):
|
||||
|
||||
""" To get Shop for this order"
|
||||
@return: Shop id """
|
||||
|
||||
company = self.pool.get('res.users').browse(cr, uid, uid, context).company_id
|
||||
res = self.pool.get('sale.shop').search(cr, uid, [])
|
||||
# res = self.pool.get('sale.shop').search(cr, uid, [('company_id', '=', company.id)])
|
||||
@@ -225,12 +285,9 @@ class pos_order(osv.osv):
|
||||
else:
|
||||
return False
|
||||
|
||||
def _receivable_get(self, cr, uid, context=None):
|
||||
prop_obj = self.pool.get('ir.property')
|
||||
res = prop_obj.get(cr, uid, 'property_account_receivable', 'res.partner', context=context)
|
||||
return res
|
||||
|
||||
def copy(self, cr, uid, id, default=None, context={}):
|
||||
|
||||
if not default:
|
||||
default = {}
|
||||
default.update({
|
||||
@@ -246,6 +303,10 @@ class pos_order(osv.osv):
|
||||
return super(pos_order, self).copy(cr, uid, id, default, context)
|
||||
|
||||
def _get_v( self, cr, uid, ids,*a):
|
||||
|
||||
""" Changed the Validation state of order
|
||||
@return: State """
|
||||
|
||||
flag=False
|
||||
res_company = self.pool.get('res.company')
|
||||
res_obj = self.pool.get('res.users')
|
||||
@@ -333,6 +394,11 @@ class pos_order(osv.osv):
|
||||
|
||||
|
||||
def _select_pricelist(self, cr, uid, context):
|
||||
|
||||
""" To get default pricelist for the order"
|
||||
@param name: Names of fields.
|
||||
@return: pricelist ID
|
||||
"""
|
||||
pricelist = self.pool.get('product.pricelist').search(cr, uid, [('name', '=', 'Public Pricelist')])
|
||||
if pricelist:
|
||||
return pricelist[0]
|
||||
@@ -340,6 +406,11 @@ class pos_order(osv.osv):
|
||||
return False
|
||||
|
||||
def _journal_default(self, cr, uid, context={}):
|
||||
|
||||
""" To get default pricelist for the order"
|
||||
@param name: Names of fields.
|
||||
@return: journal ID
|
||||
"""
|
||||
journal_list = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'cash')])
|
||||
if journal_list:
|
||||
return journal_list[0]
|
||||
@@ -365,6 +436,11 @@ class pos_order(osv.osv):
|
||||
|
||||
|
||||
def test_order_lines(self, cr, uid, order, context={}):
|
||||
|
||||
""" Test order line is created or not for the order "
|
||||
@param name: Names of fields.
|
||||
@return: True
|
||||
"""
|
||||
if not order.lines:
|
||||
raise osv.except_osv(_('Error'), _('No order lines defined for this sale.'))
|
||||
|
||||
@@ -376,6 +452,10 @@ class pos_order(osv.osv):
|
||||
return True
|
||||
|
||||
def test_paid(self, cr, uid, ids, context=None):
|
||||
|
||||
""" Test all amount is paid for this order
|
||||
@return: True
|
||||
"""
|
||||
for order in self.browse(cr, uid, ids, context):
|
||||
if order.lines and not order.amount_total:
|
||||
return True
|
||||
@@ -385,7 +465,9 @@ class pos_order(osv.osv):
|
||||
return True
|
||||
|
||||
def _get_qty_differences(self, orders, old_picking):
|
||||
"""check if the customer changed the product quantity"""
|
||||
|
||||
"""check if the customer changed the product quantity """
|
||||
|
||||
order_dict = {}
|
||||
for order in orders:
|
||||
for line in order.lines:
|
||||
@@ -407,7 +489,9 @@ class pos_order(osv.osv):
|
||||
return diff_dict
|
||||
|
||||
def _split_picking(self, cr, uid, ids, context, old_picking, diff_dict):
|
||||
|
||||
"""if the customer changes the product quantity, split the picking in two"""
|
||||
|
||||
# create a copy of the original picking and adjust the product qty:
|
||||
picking_model = self.pool.get('stock.picking')
|
||||
defaults = {
|
||||
@@ -445,7 +529,9 @@ class pos_order(osv.osv):
|
||||
line.unlink(context=context)
|
||||
|
||||
def create_picking(self, cr, uid, ids, context={}):
|
||||
|
||||
"""Create a picking for each order and validate it."""
|
||||
|
||||
picking_obj = self.pool.get('stock.picking')
|
||||
|
||||
orders = self.browse(cr, uid, ids, context)
|
||||
@@ -510,6 +596,10 @@ class pos_order(osv.osv):
|
||||
return True
|
||||
|
||||
def set_to_draft(self, cr, uid, ids, *args):
|
||||
|
||||
""" Changes order state to draft
|
||||
@return: True
|
||||
"""
|
||||
if not len(ids):
|
||||
return False
|
||||
|
||||
@@ -521,6 +611,10 @@ class pos_order(osv.osv):
|
||||
return True
|
||||
|
||||
def button_invalidate(self, cr, uid, ids, *args):
|
||||
|
||||
""" Check the access for the sale order
|
||||
@return: True
|
||||
"""
|
||||
res_obj = self.pool.get('res.company')
|
||||
try:
|
||||
part_company=res_obj.browse(cr,uid,uid) and res_obj.browse(cr,uid,uid).parent_id and res_obj.browse(cr,uid,uid).parent_id.id or None
|
||||
@@ -531,6 +625,10 @@ class pos_order(osv.osv):
|
||||
return True
|
||||
|
||||
def button_validate(self, cr, uid, ids, *args):
|
||||
|
||||
""" Check the access for the sale order and update the date_payment
|
||||
@return: True
|
||||
"""
|
||||
res_obj = self.pool.get('res.company')
|
||||
try:
|
||||
part_company=res_obj.browse(cr,uid,uid) and res_obj.browse(cr,uid,uid).parent_id and res_obj.browse(cr,uid,uid).parent_id.id or None
|
||||
@@ -549,12 +647,18 @@ class pos_order(osv.osv):
|
||||
|
||||
|
||||
def cancel_order(self, cr, uid, ids, context=None):
|
||||
|
||||
""" Changes order state to cancel
|
||||
@return: True
|
||||
"""
|
||||
self.write(cr, uid, ids, {'state': 'cancel'})
|
||||
self.cancel_picking(cr, uid, ids, context={})
|
||||
return True
|
||||
|
||||
def add_payment(self, cr, uid, order_id, data, context=None):
|
||||
|
||||
"""Create a new payment for the order"""
|
||||
|
||||
res_obj = self.pool.get('res.company')
|
||||
statementl_obj = self.pool.get('account.bank.statement.line')
|
||||
prod_obj = self.pool.get('product.product')
|
||||
@@ -597,7 +701,7 @@ class pos_order(osv.osv):
|
||||
args['statement_id']= statement_id
|
||||
args['pos_statement_id']= order_id
|
||||
args['journal_id']= data['journal']
|
||||
statement_line_id = self.pool.get('account.bank.statement.line').create(cr, uid, args)
|
||||
statement_line_id = statementl_obj.create(cr, uid, args)
|
||||
ids_new.append(statement_id)
|
||||
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
@@ -607,7 +711,9 @@ class pos_order(osv.osv):
|
||||
return statement_id
|
||||
|
||||
def add_product(self, cr, uid, order_id, product_id, qty, context=None):
|
||||
|
||||
"""Create a new order line the order"""
|
||||
|
||||
line_obj = self.pool.get('pos.order.line')
|
||||
values = self.read(cr, uid, order_id, ['partner_id', 'pricelist_id'])
|
||||
|
||||
@@ -629,6 +735,9 @@ class pos_order(osv.osv):
|
||||
return order_line_id
|
||||
|
||||
def refund(self, cr, uid, ids, context={}):
|
||||
|
||||
"""Create a copy of order for refund order"""
|
||||
|
||||
clone_list = []
|
||||
line_obj = self.pool.get('pos.order.line')
|
||||
|
||||
@@ -653,9 +762,13 @@ class pos_order(osv.osv):
|
||||
return clone_list
|
||||
|
||||
def action_invoice(self, cr, uid, ids, context={}):
|
||||
|
||||
"""Create a invoice of order """
|
||||
|
||||
res_obj = self.pool.get('res.company')
|
||||
inv_ref = self.pool.get('account.invoice')
|
||||
inv_line_ref = self.pool.get('account.invoice.line')
|
||||
product_obj= self.pool.get('product.product')
|
||||
inv_ids = []
|
||||
|
||||
for order in self.browse(cr, uid, ids, context):
|
||||
@@ -693,7 +806,7 @@ class pos_order(osv.osv):
|
||||
'product_id': line.product_id.id,
|
||||
'quantity': line.qty,
|
||||
}
|
||||
inv_name = self.pool.get('product.product').name_get(cr, uid, [line.product_id.id], context=context)[0][1]
|
||||
inv_name = product_obj.name_get(cr, uid, [line.product_id.id], context=context)[0][1]
|
||||
|
||||
inv_line.update(inv_line_ref.product_id_change(cr, uid, [],
|
||||
line.product_id.id,
|
||||
@@ -714,6 +827,9 @@ class pos_order(osv.osv):
|
||||
return inv_ids
|
||||
|
||||
def create_account_move(self, cr, uid, ids, context=None):
|
||||
|
||||
"""Create a account move line of order """
|
||||
|
||||
account_move_obj = self.pool.get('account.move')
|
||||
account_move_line_obj = self.pool.get('account.move.line')
|
||||
account_period_obj = self.pool.get('account.period')
|
||||
|
||||
@@ -26,6 +26,7 @@ import netsvc
|
||||
|
||||
|
||||
class account_bank_statement(osv.osv):
|
||||
|
||||
_inherit = 'account.bank.statement'
|
||||
_columns = {
|
||||
'company_id':fields.many2one('res.company', 'Company', required=True),
|
||||
@@ -36,11 +37,24 @@ class account_bank_statement(osv.osv):
|
||||
account_bank_statement()
|
||||
|
||||
class account_bank_statement_line(osv.osv):
|
||||
|
||||
def _default_company(self, cr, uid, context={}):
|
||||
|
||||
""" To get default company for the object"
|
||||
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of bank statement ids
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return: company
|
||||
"""
|
||||
|
||||
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
||||
if user.company_id:
|
||||
return user.company_id.id
|
||||
return self.pool.get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
|
||||
|
||||
_inherit = 'account.bank.statement.line'
|
||||
_columns = {
|
||||
'company_id':fields.many2one('res.company', 'Company', required=True),
|
||||
|
||||
@@ -33,7 +33,7 @@ class pos_invoice(report_sxw.rml_parse):
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
})
|
||||
print
|
||||
|
||||
|
||||
def set_context(self, objects, data, ids, report_type=None):
|
||||
super(pos_invoice, self).set_context(objects, data, ids, report_type)
|
||||
|
||||
@@ -52,7 +52,7 @@ class pos_payment_report(report_sxw.rml_parse):
|
||||
"where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id " \
|
||||
"and po.state in ('paid','invoiced') and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date = current_date")
|
||||
data=self.cr.dictfetchall()
|
||||
print data
|
||||
|
||||
for d in data:
|
||||
self.total += d['price_unit'] * d['qty']
|
||||
return data
|
||||
|
||||
@@ -58,12 +58,12 @@
|
||||
<field name="starting_details_ids" nolabel = "1" colspan="4">
|
||||
<tree string = "Starting Details" editable="bottom">
|
||||
<field name="pieces"/>
|
||||
<field name="number" on_change="on_change_sub2(pieces,number, parent.balance_end)"/>
|
||||
<field name="number" on_change="on_change_sub(pieces,number, parent.balance_end)"/>
|
||||
<field name="subtotal" sum="Total"/>
|
||||
</tree>
|
||||
<form string = "Ending Details">
|
||||
<field name="pieces"/>
|
||||
<field name="number" on_change="on_change_sub2(pieces,number, parent.balance_end)"/>
|
||||
<field name="number" on_change="on_change_sub(pieces,number, parent.balance_end)"/>
|
||||
<field name="subtotal"/>
|
||||
</form>
|
||||
</field>
|
||||
@@ -72,12 +72,12 @@
|
||||
<field name="ending_details_ids" nolabel = "1" colspan="4">
|
||||
<tree string = "Ending Details" editable="bottom">
|
||||
<field name="pieces"/>
|
||||
<field name="number" on_change="on_change_sub2(pieces,number, parent.balance_end)"/>
|
||||
<field name="number" on_change="on_change_sub(pieces,number, parent.balance_end)"/>
|
||||
<field name="subtotal" sum="Total"/>
|
||||
</tree>
|
||||
<form string = "Ending Details">
|
||||
<field name="pieces"/>
|
||||
<field name="number" on_change="on_change_sub2(pieces,number, parent.balance_end)"/>
|
||||
<field name="number" on_change="on_change_sub(pieces,number, parent.balance_end)"/>
|
||||
<field name="subtotal"/>
|
||||
</form>
|
||||
</field>
|
||||
@@ -135,12 +135,12 @@
|
||||
<field name="ending_details_ids" nolabel = "1" colspan="4">
|
||||
<tree string = "Ending Details" editable="bottom">
|
||||
<field name="pieces"/>
|
||||
<field name="number" on_change="on_change_sub2(pieces,number, parent.balance_end)"/>
|
||||
<field name="number" on_change="on_change_sub(pieces,number, parent.balance_end)"/>
|
||||
<field name="subtotal" sum="Total"/>
|
||||
</tree>
|
||||
<form string = "Ending Details">
|
||||
<field name="pieces"/>
|
||||
<field name="number" on_change="on_change_sub2(pieces,number, parent.balance_end)"/>
|
||||
<field name="number" on_change="on_change_sub(pieces,number, parent.balance_end)"/>
|
||||
<field name="subtotal"/>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
@@ -137,17 +137,21 @@ class pos_make_payment(osv.osv_memory):
|
||||
jrnl_used=jrnl_obj.browse(cr,uid,data['journal'])
|
||||
order_obj.write(cr, uid, [record_id], {'invoice_wanted': invoice_wanted})
|
||||
order_obj.add_payment(cr, uid, record_id, data, context=context)
|
||||
|
||||
if amount<=0.0:
|
||||
context.update({'flag':True})
|
||||
order_obj.action_paid(cr,uid,[record_id],context)
|
||||
# Todo need to check
|
||||
# if amount<=0.0:
|
||||
# context.update({'flag':True})
|
||||
# order_obj.action_paid(cr,uid,[record_id],context)
|
||||
if order_obj.test_paid(cr, uid, [record_id]):
|
||||
if order.partner_id and order.invoice_wanted:
|
||||
return self.create_invoice(cr,uid,ids,context)
|
||||
else:
|
||||
order_obj.action_paid(cr,uid,[record_id],context)
|
||||
order_obj.write(cr, uid, [record_id],{'state':'paid'})
|
||||
return self.print_report(cr, uid, ids, context)
|
||||
if order.amount_paid > 0.0:
|
||||
context.update({'flag': True})
|
||||
# Todo need to check
|
||||
order_obj.action_paid(cr, uid, [record_id], context)
|
||||
self.pool.get('pos.order').write(cr, uid, [record_id],{'state':'advance'})
|
||||
return self.print_report(cr, uid, ids, context)
|
||||
return {}
|
||||
|
||||
@@ -266,6 +266,7 @@ def _create_returns(self, cr, uid, data, context):
|
||||
return res
|
||||
|
||||
def _create_returns2(self, cr, uid, data, context):
|
||||
act={}
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
order_obj = pool.get('pos.order')
|
||||
line_obj = pool.get('pos.order.line')
|
||||
@@ -283,46 +284,49 @@ def _create_returns2(self, cr, uid, data, context):
|
||||
res=cr.fetchone()
|
||||
location_id=res and res[0] or None
|
||||
stock_dest_id = int(val.split(',')[1])
|
||||
if order_id.last_out_picking.id:
|
||||
new_picking=picking_obj.copy(cr, uid, order_id.last_out_picking.id, {'name':'%s (return)' % order_id.name,
|
||||
'move_lines':[], 'state':'draft', 'type':'in',
|
||||
'type':'in',
|
||||
'date':date_cur, })
|
||||
new_order=order_obj.copy(cr,uid,order_id.id, {'name': 'Refund %s'%order_id.name,
|
||||
'lines':[],
|
||||
'statement_ids':[],
|
||||
'last_out_picking':[]})
|
||||
for line in order_id.lines:
|
||||
for r in data['form'].get('returns',[]):
|
||||
if line.id==r and (data['form']['return%s' %r]!=0.0):
|
||||
new_move=stock_move_obj.create(cr, uid,{
|
||||
'product_qty': data['form']['return%s' %r],
|
||||
'product_uos_qty': uom_obj._compute_qty(cr, uid,data['form']['return%s' %r] ,line.product_id.uom_id.id),
|
||||
'picking_id':new_picking,
|
||||
'product_uom':line.product_id.uom_id.id,
|
||||
'location_id':location_id,
|
||||
'product_id':line.product_id.id,
|
||||
'location_dest_id':stock_dest_id,
|
||||
'name':'%s (return)' %order_id.name,
|
||||
'date':date_cur,
|
||||
'date_planned':date_cur,})
|
||||
line_obj.copy(cr,uid,line.id,{'qty':-data['form']['return%s' %r],
|
||||
'order_id': new_order,
|
||||
})
|
||||
order_obj.write(cr,uid, new_order, {'state':'done'})
|
||||
wf_service.trg_validate(uid, 'stock.picking',new_picking,'button_confirm', cr)
|
||||
picking_obj.force_assign(cr, uid, [new_picking], context)
|
||||
act = {
|
||||
'domain': "[('id', 'in', ["+str(new_order)+"])]",
|
||||
'name': 'Refunded Orders',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form,tree',
|
||||
'res_model': 'pos.order',
|
||||
'auto_refresh':0,
|
||||
'res_id':new_order,
|
||||
'view_id': False,
|
||||
'type': 'ir.actions.act_window'
|
||||
}
|
||||
else:
|
||||
raise wizard.except_wizard(_('Error'), _('Last out picking No find!'))
|
||||
|
||||
new_picking=picking_obj.copy(cr, uid, order_id.last_out_picking.id, {'name':'%s (return)' % order_id.name,
|
||||
'move_lines':[], 'state':'draft', 'type':'in',
|
||||
'type':'in',
|
||||
'date':date_cur, })
|
||||
new_order=order_obj.copy(cr,uid,order_id.id, {'name': 'Refund %s'%order_id.name,
|
||||
'lines':[],
|
||||
'statement_ids':[],
|
||||
'last_out_picking':[]})
|
||||
for line in order_id.lines:
|
||||
for r in data['form'].get('returns',[]):
|
||||
if line.id==r and (data['form']['return%s' %r]!=0.0):
|
||||
new_move=stock_move_obj.create(cr, uid,{
|
||||
'product_qty': data['form']['return%s' %r],
|
||||
'product_uos_qty': uom_obj._compute_qty(cr, uid,data['form']['return%s' %r] ,line.product_id.uom_id.id),
|
||||
'picking_id':new_picking,
|
||||
'product_uom':line.product_id.uom_id.id,
|
||||
'location_id':location_id,
|
||||
'product_id':line.product_id.id,
|
||||
'location_dest_id':stock_dest_id,
|
||||
'name':'%s (return)' %order_id.name,
|
||||
'date':date_cur,
|
||||
'date_planned':date_cur,})
|
||||
line_obj.copy(cr,uid,line.id,{'qty':-data['form']['return%s' %r],
|
||||
'order_id': new_order,
|
||||
})
|
||||
order_obj.write(cr,uid, new_order, {'state':'done'})
|
||||
wf_service.trg_validate(uid, 'stock.picking',new_picking,'button_confirm', cr)
|
||||
picking_obj.force_assign(cr, uid, [new_picking], context)
|
||||
act = {
|
||||
'domain': "[('id', 'in', ["+str(new_order)+"])]",
|
||||
'name': 'Refunded Orders',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form,tree',
|
||||
'res_model': 'pos.order',
|
||||
'auto_refresh':0,
|
||||
'res_id':new_order,
|
||||
'view_id': False,
|
||||
'type': 'ir.actions.act_window'
|
||||
}
|
||||
return act
|
||||
def test(self,cr,uid,data,context={}):
|
||||
# import pdb; pdb.set_trace()
|
||||
|
||||
@@ -7,13 +7,13 @@ msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 5.0.0_rc3\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
|
||||
"PO-Revision-Date: 2010-03-10 13:51+0000\n"
|
||||
"PO-Revision-Date: 2010-04-20 09:57+0000\n"
|
||||
"Last-Translator: Carlo Vettore <Unknown>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-17 04:10+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: product
|
||||
@@ -458,7 +458,7 @@ msgstr "Margine Minimo"
|
||||
#. module: product
|
||||
#: view:product.pricelist.item:0
|
||||
msgid "* ( 1 + "
|
||||
msgstr "* ( 1 + "
|
||||
msgstr "( 1 - "
|
||||
|
||||
#. module: product
|
||||
#: model:product.template,name:product.product_product_cpu1_product_template
|
||||
|
||||
@@ -106,8 +106,8 @@
|
||||
|
||||
<group colspan="2" col="2" name="uom">
|
||||
<separator string="UOM" colspan="2"/>
|
||||
<field name="uom_id" on_change="onchange_uom(uom_id,uom_po_id)"/>
|
||||
<field name="uom_po_id"/>
|
||||
<field name="uom_id" on_change="onchange_uom(uom_id,uom_po_id)" widget="selection"/>
|
||||
<field name="uom_po_id" widget="selection"/>
|
||||
</group>
|
||||
|
||||
<group colspan="2" col="2" name="uos" groups="product.group_uos">
|
||||
|
||||
@@ -13,7 +13,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-20 03:33+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-21 04:06+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: profile_manufacturing
|
||||
|
||||
@@ -7,13 +7,13 @@ msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 5.0.0\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
|
||||
"PO-Revision-Date: 2010-04-16 16:06+0000\n"
|
||||
"Last-Translator: Grzegorz Grzelak (Cirrus.pl) <Unknown>\n"
|
||||
"PO-Revision-Date: 2010-04-20 08:36+0000\n"
|
||||
"Last-Translator: PROSID <Unknown>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-20 03:32+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-21 04:05+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: project
|
||||
|
||||
@@ -34,12 +34,15 @@
|
||||
'depends': ['base', 'account', 'stock', 'process'],
|
||||
'init_xml': [],
|
||||
'update_xml': [
|
||||
|
||||
'security/purchase_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'purchase_workflow.xml',
|
||||
'purchase_sequence.xml',
|
||||
'purchase_data.xml',
|
||||
'wizard/purchase_order_group_view.xml',
|
||||
'wizard/purchase_installer.xml',
|
||||
'wizard/purchase_line_invoice_view.xml',
|
||||
'purchase_view.xml',
|
||||
'purchase_report.xml',
|
||||
'stock_view.xml',
|
||||
|
||||
@@ -246,6 +246,7 @@ class purchase_order(osv.osv):
|
||||
return {'value':{'location_id': res, 'dest_address_id': False}}
|
||||
|
||||
def onchange_partner_id(self, cr, uid, ids, part):
|
||||
|
||||
if not part:
|
||||
return {'value':{'partner_address_id': False, 'fiscal_position': False}}
|
||||
addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['default'])
|
||||
@@ -259,12 +260,18 @@ class purchase_order(osv.osv):
|
||||
return True
|
||||
|
||||
def wkf_confirm_order(self, cr, uid, ids, context={}):
|
||||
todo = []
|
||||
for po in self.browse(cr, uid, ids):
|
||||
|
||||
if self.pool.get('res.partner.event.type').check(cr, uid, 'purchase_open'):
|
||||
self.pool.get('res.partner.event').create(cr, uid, {'name':'Purchase Order: '+po.name, 'partner_id':po.partner_id.id, 'date':time.strftime('%Y-%m-%d %H:%M:%S'), 'user_id':uid, 'partner_type':'retailer', 'probability': 1.0, 'planned_cost':po.amount_untaxed})
|
||||
if not po.order_line:
|
||||
raise osv.except_osv(_('Error !'),_('You can not confirm purchase order without Purchase Order Lines.'))
|
||||
for line in po.order_line:
|
||||
if line.state=='draft':
|
||||
todo.append(line.id)
|
||||
current_name = self.name_get(cr, uid, ids)[0][1]
|
||||
self.pool.get('purchase.order.line').action_confirm(cr, uid, todo, context)
|
||||
for id in ids:
|
||||
self.write(cr, uid, [id], {'state' : 'confirmed', 'validator' : uid})
|
||||
return True
|
||||
@@ -312,11 +319,13 @@ class purchase_order(osv.osv):
|
||||
|
||||
def action_invoice_create(self, cr, uid, ids, *args):
|
||||
res = False
|
||||
|
||||
journal_obj = self.pool.get('account.journal')
|
||||
for o in self.browse(cr, uid, ids):
|
||||
il = []
|
||||
todo = []
|
||||
for ol in o.order_line:
|
||||
|
||||
todo.append(ol.id)
|
||||
if ol.product_id:
|
||||
a = ol.product_id.product_tmpl_id.property_account_expense.id
|
||||
if not a:
|
||||
@@ -352,7 +361,7 @@ class purchase_order(osv.osv):
|
||||
}
|
||||
inv_id = self.pool.get('account.invoice').create(cr, uid, inv, {'type':'in_invoice'})
|
||||
self.pool.get('account.invoice').button_compute(cr, uid, [inv_id], {'type':'in_invoice'}, set_total=True)
|
||||
|
||||
self.pool.get('purchase.order.line').write(cr, uid, todo, {'invoiced':True})
|
||||
self.write(cr, uid, [o.id], {'invoice_id': inv_id})
|
||||
res = inv_id
|
||||
return res
|
||||
@@ -579,10 +588,22 @@ class purchase_order_line(osv.osv):
|
||||
'notes': fields.text('Notes', translate=True),
|
||||
'order_id': fields.many2one('purchase.order', 'Order Reference', select=True, required=True, ondelete='cascade'),
|
||||
'account_analytic_id':fields.many2one('account.analytic.account', 'Analytic Account',),
|
||||
'company_id': fields.related('order_id','company_id',type='many2one',relation='res.company',string='Company')
|
||||
'company_id': fields.related('order_id','company_id',type='many2one',relation='res.company',string='Company'),
|
||||
'state': fields.selection([('draft', 'Draft'), ('confirmed', 'Confirmed'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', required=True, readonly=True,
|
||||
help=' * The \'Draft\' state is set automatically when purchase order in draft state. \
|
||||
\n* The \'Confirmed\' state is set automatically as confirm when purchase order in confirm state. \
|
||||
\n* The \'Done\' state is set automatically when purchase order is set as done. \
|
||||
\n* The \'Cancelled\' state is set automatically when user cancel purchase order.'),
|
||||
'invoice_lines': fields.many2many('account.invoice.line', 'purchase_order_line_invoice_rel', 'order_line_id', 'invoice_id', 'Invoice Lines', readonly=True),
|
||||
'invoiced': fields.boolean('Invoiced', readonly=True),
|
||||
'partner_id': fields.related('order_id','partner_id',string='Partner',readonly=True,type="many2one", relation="res.partner"),
|
||||
'date_order': fields.related('order_id','date_order',string='Order Date',readonly=True,type="date")
|
||||
|
||||
}
|
||||
_defaults = {
|
||||
'product_qty': lambda *a: 1.0
|
||||
'product_qty': lambda *a: 1.0,
|
||||
'state': lambda *args: 'draft',
|
||||
'invoiced': lambda *a: 0,
|
||||
}
|
||||
_table = 'purchase_order_line'
|
||||
_name = 'purchase.order.line'
|
||||
@@ -590,7 +611,7 @@ class purchase_order_line(osv.osv):
|
||||
def copy_data(self, cr, uid, id, default=None,context={}):
|
||||
if not default:
|
||||
default = {}
|
||||
default.update({'state':'draft', 'move_ids':[]})
|
||||
default.update({'state':'draft', 'move_ids':[],'invoiced':0,'invoice_lines':[]})
|
||||
return super(purchase_order_line, self).copy_data(cr, uid, id, default, context)
|
||||
|
||||
def product_id_change(self, cr, uid, ids, pricelist, product, qty, uom,
|
||||
@@ -658,14 +679,17 @@ class purchase_order_line(osv.osv):
|
||||
return res
|
||||
|
||||
def product_uom_change(self, cr, uid, ids, pricelist, product, qty, uom,
|
||||
partner_id, date_order=False):
|
||||
partner_id, date_order=False,fiscal_position=False):
|
||||
res = self.product_id_change(cr, uid, ids, pricelist, product, qty, uom,
|
||||
partner_id, date_order=date_order)
|
||||
partner_id, date_order=date_order,fiscal_position=fiscal_position)
|
||||
if 'product_uom' in res['value']:
|
||||
del res['value']['product_uom']
|
||||
if not uom:
|
||||
res['value']['price_unit'] = 0.0
|
||||
return res
|
||||
def action_confirm(self, cr, uid, ids, context={}):
|
||||
self.write(cr, uid, ids, {'state': 'confirmed'}, context)
|
||||
return True
|
||||
purchase_order_line()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
|
||||
|
||||
<!--Inventory control-->
|
||||
<menuitem id="menu_procurement_management_nventory" name="Inventory Control"
|
||||
<menuitem id="menu_procurement_management_inventory" name="Inventory Control"
|
||||
parent="base.menu_purchase_root" sequence="4"/>
|
||||
<menuitem action="stock.action_picking_tree4" id="menu_action_picking_tree4" parent="menu_procurement_management_nventory"
|
||||
<menuitem action="stock.action_picking_tree4" id="menu_action_picking_tree4" parent="menu_procurement_management_inventory"
|
||||
name="Incoming Shipments" sequence="9"/>
|
||||
<menuitem action="stock.action_reception_picking_move" id="menu_action_reception_picking_move"
|
||||
name="Incoming Products" parent="menu_procurement_management_nventory" sequence="10"/>
|
||||
name="Incoming Products" parent="menu_procurement_management_inventory" sequence="10"/>
|
||||
|
||||
<!--Invoice control-->
|
||||
<menuitem id="menu_procurement_management_invoice" name="Invoice Control"
|
||||
@@ -92,7 +92,9 @@
|
||||
<field name="product_qty"/>
|
||||
<field name="product_uom"/>
|
||||
<field name="price_unit"/>
|
||||
<field name="price_subtotal" groups="base.group_extended"/>
|
||||
<field name="price_subtotal" groups="base.group_extended"/>
|
||||
<field name="invoiced"/>
|
||||
<field name="state"/>
|
||||
</tree>
|
||||
<!-- default form view -->
|
||||
</field>
|
||||
@@ -224,7 +226,7 @@
|
||||
<page string="Order Line">
|
||||
<field colspan="4" context="partner_id=parent.partner_id,quantity=product_qty,pricelist=parent.pricelist_id,uom=product_uom,warehouse=parent.warehouse_id" name="product_id" on_change="product_id_change(parent.pricelist_id,product_id,product_qty,product_uom,parent.partner_id, parent.date_order,parent.fiscal_position,date_planned,name,price_unit,notes)"/>
|
||||
<field context="partner_id=parent.partner_id,quantity=product_qty,pricelist=parent.pricelist_id,uom=product_uom,warehouse=parent.warehouse_id" name="product_qty" on_change="product_id_change(parent.pricelist_id,product_id,product_qty,product_uom,parent.partner_id,parent.date_order,parent.fiscal_position,date_planned,name,price_unit,notes)"/>
|
||||
<field name="product_uom" on_change="product_uom_change(parent.pricelist_id,product_id,product_qty,product_uom,parent.partner_id, parent.date_order)"/>
|
||||
<field name="product_uom" on_change="product_uom_change(parent.pricelist_id,product_id,product_qty,product_uom,parent.partner_id, parent.date_order,parent.fiscal_position)"/>
|
||||
<field colspan="4" name="name"/>
|
||||
<field name="date_planned" widget="date"/>
|
||||
<field name="price_unit"/>
|
||||
@@ -242,8 +244,15 @@
|
||||
<field name="account_analytic_id" colspan="4"/>
|
||||
<separator colspan="4" string="Taxes"/>
|
||||
<field colspan="4" nolabel="1" name="taxes_id" domain="[('parent_id','=',False),('type_tax_use','!=','sale')]"/>
|
||||
<separator colspan="4" string="Manual Invoices"/>
|
||||
<field name="invoiced"/>
|
||||
<newline/>
|
||||
<field colspan="4" name="invoice_lines" nolabel="1" widget="many2many"/>
|
||||
</page>
|
||||
</notebook>
|
||||
<group>
|
||||
<field name="state" />
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
@@ -262,6 +271,7 @@
|
||||
<field name="product_uom"/>
|
||||
<field name="price_unit"/>
|
||||
<field name="price_subtotal"/>
|
||||
<field name="invoiced"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -280,5 +290,39 @@
|
||||
name="Product purchases"
|
||||
res_model="purchase.order.line"
|
||||
src_model="product.product"/>
|
||||
<!--
|
||||
<record model="ir.values" id="action_merge_purchase_order">
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Purchase Order</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_view_purchase_order_group'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">purchase.order</field>
|
||||
</record>
|
||||
-->
|
||||
|
||||
<record id="purchase_line_form_action2" model="ir.actions.act_window">
|
||||
<field name="name">Lines To Invoices</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">purchase.order.line</field>
|
||||
<field name="domain">[('state','in',('confirmed','done')), ('invoiced','=',False)]</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
<record id="purchase_line_form_action_tree2" model="ir.actions.act_window.view">
|
||||
<field eval="1" name="sequence"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="purchase_order_line_tree"/>
|
||||
<field name="act_window_id" ref="purchase_line_form_action2"/>
|
||||
</record>
|
||||
<record id="purchase_line_form_action_form2" model="ir.actions.act_window.view">
|
||||
<field eval="2" name="sequence"/>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="purchase_order_line_form"/>
|
||||
<field name="act_window_id" ref="purchase_line_form_action2"/>
|
||||
</record>
|
||||
<menuitem action="purchase_line_form_action2" id="menu_purchase_line_order_draft" parent="menu_procurement_management_invoice"/>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
##############################################################################
|
||||
|
||||
import purchase_order_group
|
||||
|
||||
import purchase_installer
|
||||
import purchase_line_invoice
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
+13
-4
@@ -1,8 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
@@ -15,8 +15,17 @@
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
from osv import fields, osv
|
||||
|
||||
class purchase_installer(osv.osv_memory):
|
||||
_name = 'purchase.installer'
|
||||
_inherit = 'res.config.installer'
|
||||
|
||||
_columns = {
|
||||
'purchase_requisition':fields.boolean('Purchase Requisition'),
|
||||
}
|
||||
purchase_installer()
|
||||
|
||||
import wizard_purchase_line_invoice
|
||||
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_purchase_install_module_form" model="ir.ui.view">
|
||||
<field name="name">Purchase Requisition</field>
|
||||
<field name="model">purchase.installer</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="base.res_config_installer"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<form position="attributes">
|
||||
<attribute name="string">Purchase Modules Installation</attribute>
|
||||
</form>
|
||||
|
||||
<separator string="title" position="attributes">
|
||||
<attribute name="string"
|
||||
>Configure Your Purchase System</attribute>
|
||||
</separator>
|
||||
<xpath expr="//label[@string='description']"
|
||||
position="attributes">
|
||||
<attribute name="string">After having installed the core purchase application, you can extend it with more modules on needs of your organization</attribute>
|
||||
</xpath>
|
||||
|
||||
<group colspan="8">
|
||||
<separator string="Purchase Application" colspan="4"/>
|
||||
<field name="purchase_requisition"/>
|
||||
</group>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_purchase_install_module" model="ir.actions.act_window">
|
||||
<field name="name">Purchase Profile : Install Extra Modules</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">purchase.installer</field>
|
||||
<field name="view_id" ref="view_purchase_install_module_form"/>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record id="purchase_installer_todo" model="ir.actions.todo">
|
||||
<field name="action_id" ref="action_purchase_install_module"/>
|
||||
<field name="sequence">3</field>
|
||||
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -0,0 +1,132 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import netsvc
|
||||
import ir
|
||||
from osv import osv
|
||||
from tools.translate import _
|
||||
|
||||
class purchase_line_invoice(osv.osv_memory):
|
||||
|
||||
""" To create invoice for purchase order line"""
|
||||
|
||||
_name = 'purchase.order.line_invoice'
|
||||
_description = 'Purchase Order Line Make Invoice'
|
||||
|
||||
def makeInvoices(self, cr, uid, ids, context):
|
||||
"""
|
||||
To get Purchase Order line and create Invoice
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param context: A standard dictionary
|
||||
@return : retrun view of Invoice
|
||||
"""
|
||||
record_ids = context.get('active_ids',[])
|
||||
if record_ids:
|
||||
res = False
|
||||
invoices = {}
|
||||
invoice_obj=self.pool.get('account.invoice')
|
||||
purchase_line_obj=self.pool.get('purchase.order.line')
|
||||
property_obj=self.pool.get('ir.property')
|
||||
account_fiscal_obj=self.pool.get('account.fiscal.position')
|
||||
invoice_line_obj=self.pool.get('account.invoice.line')
|
||||
|
||||
def make_invoice(order, lines):
|
||||
a = order.partner_id.property_account_payable.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': 'in_invoice',
|
||||
'reference': "P%dPO%d" % (order.partner_id.id, order.id),
|
||||
'account_id': a,
|
||||
'partner_id': order.partner_id.id,
|
||||
'address_invoice_id': order.partner_address_id.id,
|
||||
'address_contact_id': order.partner_address_id.id,
|
||||
'invoice_line': [(6,0,lines)],
|
||||
'currency_id' : order.pricelist_id.currency_id.id,
|
||||
'comment': order.notes,
|
||||
'payment_term': pay_term,
|
||||
'fiscal_position': order.partner_id.property_account_position.id
|
||||
}
|
||||
inv_id = invoice_obj.create(cr, uid, inv)
|
||||
return inv_id
|
||||
|
||||
for line in purchase_line_obj.browse(cr,uid,record_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] = []
|
||||
if line.product_id:
|
||||
a = line.product_id.product_tmpl_id.property_account_expense.id
|
||||
if not a:
|
||||
a = line.product_id.categ_id.property_account_expense_categ.id
|
||||
if not a:
|
||||
raise osv.except_osv(_('Error !'),
|
||||
_('There is no expense account defined ' \
|
||||
'for this product: "%s" (id:%d)') % \
|
||||
(line.product_id.name, line.product_id.id,))
|
||||
else:
|
||||
a = property_obj.get(cr, uid,
|
||||
'property_account_expense_categ', 'product.category',
|
||||
context=context)
|
||||
fpos = line.order_id.fiscal_position or False
|
||||
a = account_fiscal_obj.map_account(cr, uid, fpos, a)
|
||||
inv_id = invoice_line_obj.create(cr, uid, {
|
||||
'name': line.name,
|
||||
'origin': line.order_id.name,
|
||||
'account_id': a,
|
||||
'price_unit': line.price_unit,
|
||||
'quantity': line.product_qty,
|
||||
'uos_id': line.product_uom.id,
|
||||
'product_id': line.product_id.id or False,
|
||||
'invoice_line_tax_id': [(6, 0, [x.id for x in line.taxes_id])],
|
||||
'note': line.notes,
|
||||
'account_analytic_id': line.account_analytic_id and line.account_analytic_id.id or False,
|
||||
})
|
||||
cr.execute('insert into purchase_order_line_invoice_rel (order_line_id,invoice_id) values (%s,%s)', (line.id, inv_id))
|
||||
purchase_line_obj.write(cr, uid, [line.id], {'invoiced': True})
|
||||
invoices[line.order_id.id].append((line,inv_id))
|
||||
|
||||
res = []
|
||||
for result in invoices.values():
|
||||
order = result[0][0].order_id
|
||||
il = map(lambda x: x[1], result)
|
||||
res.append(make_invoice(order, il))
|
||||
|
||||
return {
|
||||
'domain': "[('id','in', ["+','.join(map(str,res))+"])]",
|
||||
'name': _('Supplier Invoices'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'account.invoice',
|
||||
'view_id': False,
|
||||
'context': "{'type':'in_invoice'}",
|
||||
'type': 'ir.actions.act_window'
|
||||
}
|
||||
purchase_line_invoice()
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Make the invoice-->
|
||||
|
||||
<record id="view_purchase_line_invoice" model="ir.ui.view">
|
||||
<field name="name">Control invoices</field>
|
||||
<field name="model">purchase.order.line_invoice</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Select an Open Sale Order">
|
||||
<separator colspan="4" string="Do you want to generate the supplier invoices ?" />
|
||||
<group col="2" colspan="4">
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Cancel" />
|
||||
<button name="makeInvoices" string="Confirm"
|
||||
colspan="1" type="object" icon="gtk-ok" />
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<act_window name="Control invoices"
|
||||
res_model="purchase.order.line_invoice"
|
||||
src_model="purchase.order.line"
|
||||
view_mode="form"
|
||||
target="new"
|
||||
key2="client_action_multi"
|
||||
id="action_view_purchase_line_invoice"/>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
||||
{
|
||||
'name': 'Purchase Management - Manual Control of Invoice',
|
||||
'version': '1.1',
|
||||
'category': 'Generic Modules/Sales & Purchases',
|
||||
'description': """Module for purchase management, manual control of invoice""",
|
||||
'author': 'Tiny',
|
||||
'website': 'http://www.openerp.com',
|
||||
'depends': ['purchase'],
|
||||
'init_xml': [],
|
||||
'update_xml': [
|
||||
'purchase_manual_view.xml',
|
||||
'purchase_manual_wizard.xml',
|
||||
],
|
||||
'demo_xml': [],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
# 'certificate': False,
|
||||
}
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -1,81 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields
|
||||
from osv import osv
|
||||
import netsvc
|
||||
|
||||
class purchase_order_line(osv.osv):
|
||||
_inherit='purchase.order.line'
|
||||
_columns = {
|
||||
'state': fields.selection([('draft', 'Draft'), ('confirmed', 'Confirmed'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', required=True, readonly=True,
|
||||
help=' * The \'Draft\' state is set automatically when purchase order in draft state. \
|
||||
\n* The \'Confirmed\' state is set automatically as confirm when purchase order in confirm state. \
|
||||
\n* The \'Done\' state is set automatically when purchase order is set as done. \
|
||||
\n* The \'Cancelled\' state is set automatically when user cancel purchase order.'),
|
||||
'invoice_lines': fields.many2many('account.invoice.line', 'purchase_order_line_invoice_rel', 'order_line_id', 'invoice_id', 'Invoice Lines', readonly=True),
|
||||
'invoiced': fields.boolean('Invoiced', readonly=True),
|
||||
'partner_id': fields.related('order_id','partner_id',string='Partner',readonly=True,type="many2one", relation="res.partner"),
|
||||
'date_order': fields.related('order_id','date_order',string='Order Date',readonly=True,type="date")
|
||||
}
|
||||
_defaults = {
|
||||
'state': lambda *args: 'draft',
|
||||
'invoiced': lambda *a: 0,
|
||||
|
||||
}
|
||||
def copy_data(self, cr, uid, id, default=None, context={}):
|
||||
print 'copy called'
|
||||
if not default:
|
||||
default = {}
|
||||
default.update({
|
||||
'state':'draft',
|
||||
'invoiced':0,
|
||||
'invoice_lines':[],
|
||||
})
|
||||
return super(purchase_order_line, self).copy_data(cr, uid, id, default, context)
|
||||
|
||||
def action_confirm(self, cr, uid, ids, context={}):
|
||||
self.write(cr, uid, ids, {'state': 'confirmed'}, context)
|
||||
return True
|
||||
purchase_order_line()
|
||||
|
||||
class purchase_order(osv.osv):
|
||||
_inherit='purchase.order'
|
||||
def action_invoice_create(self, cr, uid, ids, context={}):
|
||||
print 'Invoice Create'
|
||||
res = super(purchase_order, self).action_invoice_create(cr, uid, ids, context)
|
||||
for po in self.browse(cr, uid, ids, context):
|
||||
todo = []
|
||||
for line in po.order_line:
|
||||
todo.append(line.id)
|
||||
self.pool.get('purchase.order.line').write(cr, uid, todo, {'invoiced':True}, context)
|
||||
return res
|
||||
|
||||
def wkf_confirm_order(self, cr, uid, ids, context={}):
|
||||
res = super(purchase_order, self).wkf_confirm_order(cr, uid, ids, context)
|
||||
todo = []
|
||||
for po in self.browse(cr, uid, ids, context):
|
||||
for line in po.order_line:
|
||||
if line.state=='draft':
|
||||
todo.append(line.id)
|
||||
self.pool.get('purchase.order.line').action_confirm(cr, uid, todo, context)
|
||||
return res
|
||||
purchase_order()
|
||||
@@ -1,103 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
#
|
||||
# Define PO Line Views
|
||||
#
|
||||
|
||||
<record id="purchase_order_form" model="ir.ui.view">
|
||||
<field name="name">purchase.order.form</field>
|
||||
<field name="model">purchase.order</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="purchase.purchase_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="/form/notebook/page[@string='Purchase Order']/field[@name='order_line']/tree/field[@name='price_subtotal']" position="after">
|
||||
<field name="invoiced"/>
|
||||
<field name="state"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="purchase_order_line_form" model="ir.ui.view">
|
||||
<field name="name">purchase.order.line.form</field>
|
||||
<field name="model">purchase.order.line</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="purchase.purchase_order_line_form"/>
|
||||
<field name="priority">17</field>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="/form/notebook/page[@string='Invoicing']" position="inside">
|
||||
<separator colspan="4" string="Manual Invoices"/>
|
||||
<field name="invoiced"/>
|
||||
<newline/>
|
||||
<field colspan="4" name="invoice_lines" nolabel="1" widget="many2many"/>
|
||||
</xpath>
|
||||
<xpath expr="/form/notebook" position="after">
|
||||
<group>
|
||||
<field name="state" />
|
||||
</group>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="purchase_order_line_tree" model="ir.ui.view">
|
||||
<field name="name">purchase.order.line.tree</field>
|
||||
<field name="model">purchase.order.line</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="inherit_id" ref="purchase.purchase_order_line_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="price_subtotal" position="after">
|
||||
<field name="invoiced"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
#
|
||||
# Inherit PO view to get buttons
|
||||
#
|
||||
|
||||
<record id="purchase_line_form_action" model="ir.actions.act_window">
|
||||
<field name="name">Purchase Order Lines</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">purchase.order.line</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
<record id="purchase_line_form_action_tree" model="ir.actions.act_window.view">
|
||||
<field eval="1" name="sequence"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="purchase_order_line_tree"/>
|
||||
<field name="act_window_id" ref="purchase_line_form_action"/>
|
||||
</record>
|
||||
<record id="purchase_line_form_action_form" model="ir.actions.act_window.view">
|
||||
<field eval="2" name="sequence"/>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="purchase_order_line_form"/>
|
||||
<field name="act_window_id" ref="purchase_line_form_action"/>
|
||||
</record>
|
||||
|
||||
<record id="purchase_line_form_action2" model="ir.actions.act_window">
|
||||
<field name="name">Uninvoiced Purchase Order Lines</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">purchase.order.line</field>
|
||||
<field name="domain">[('state','in',('confirmed','done')), ('invoiced','=',False)]</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
<record id="purchase_line_form_action_tree2" model="ir.actions.act_window.view">
|
||||
<field eval="1" name="sequence"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="purchase_order_line_tree"/>
|
||||
<field name="act_window_id" ref="purchase_line_form_action2"/>
|
||||
</record>
|
||||
<record id="purchase_line_form_action_form2" model="ir.actions.act_window.view">
|
||||
<field eval="2" name="sequence"/>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="purchase_order_line_form"/>
|
||||
<field name="act_window_id" ref="purchase_line_form_action2"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user