[MERGE] merge from trunk addons
bzr revid: mra@mra-laptop-20101018123412-fk56ukzdm98eyq1u
This commit is contained in:
@@ -150,7 +150,7 @@
|
||||
<field name="journal_id" on_change="onchange_journal_id(journal_id)" widget="selection"/>
|
||||
<field name="number" readonly="1"/>
|
||||
<field name="type" invisible="1"/>
|
||||
<field name="currency_id" on_change="onchange_currency_id(currency_id, company_id)" width="50"/>
|
||||
<field name="currency_id" width="50"/>
|
||||
<button name="%(action_account_change_currency)d" type="action" icon="terp-stock_effects-object-colorize" string="Change" attrs="{'invisible':[('state','!=','draft')]}" groups="account.group_account_user"/>
|
||||
<newline/>
|
||||
<field string="Supplier" name="partner_id" domain="[('supplier','=', 1)]" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id)" context="{'default_customer': 0}"/>
|
||||
@@ -259,7 +259,7 @@
|
||||
<field name="journal_id" groups="base.group_user" on_change="onchange_journal_id(journal_id)" widget="selection"/>
|
||||
<field name="number"/>
|
||||
<field name="type" invisible="1"/>
|
||||
<field name="currency_id" on_change="onchange_currency_id(currency_id, company_id)" width="50"/>
|
||||
<field name="currency_id" width="50"/>
|
||||
<button name="%(action_account_change_currency)d" type="action" icon="terp-stock_effects-object-colorize" string="Change" attrs="{'invisible':[('state','!=','draft')]}" groups="account.group_account_user"/>
|
||||
<newline/>
|
||||
<field string="Customer" name="partner_id" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id)" groups="base.group_user"/>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<menuitem id="menu_finance_management_belgian_reports" name="Belgian Reports" parent="menu_finance_reporting"/>
|
||||
<menuitem id="menu_finance_configuration" name="Configuration" parent="menu_finance" sequence="13" groups="group_account_manager"/>
|
||||
<menuitem id="menu_finance_accounting" name="Financial Accounting" parent="menu_finance_configuration"/>
|
||||
<menuitem id="menu_analytic_accounting" name="Analytic Accounting" parent="menu_finance_configuration" groups="group_account_manager"/>
|
||||
<menuitem id="menu_analytic_accounting" name="Analytic Accounting" parent="menu_finance_configuration" groups="analytic.group_analytic_accounting"/>
|
||||
<menuitem id="menu_analytic" parent="menu_analytic_accounting" name="Accounts" groups="analytic.group_analytic_accounting"/>
|
||||
<menuitem id="menu_low_level" name="Low Level" parent="menu_finance_accounting" groups="base.group_extended,group_account_manager"/>
|
||||
<menuitem id="menu_configuration_misc" name="Miscellaneous" parent="menu_finance_configuration" sequence="30" groups="group_account_manager"/>
|
||||
|
||||
@@ -1114,7 +1114,6 @@ class account_move_line(osv.osv):
|
||||
self._update_journal_check(cr, uid, context['journal_id'], context['period_id'], context)
|
||||
move_id = vals.get('move_id', False)
|
||||
journal = journal_obj.browse(cr, uid, context['journal_id'])
|
||||
# is_new_move = False
|
||||
if not move_id:
|
||||
if journal.centralisation:
|
||||
#Check for centralisation
|
||||
@@ -1133,7 +1132,6 @@ class account_move_line(osv.osv):
|
||||
vals['move_id'] = move_id
|
||||
else:
|
||||
raise osv.except_osv(_('No piece number !'), _('Can not create an automatic sequence for this piece !\n\nPut a sequence in the journal definition for automatic numbering or create a sequence manually for this piece.'))
|
||||
# is_new_move = True
|
||||
ok = not (journal.type_control_ids or journal.account_control_ids)
|
||||
if ('account_id' in vals):
|
||||
account = account_obj.browse(cr, uid, vals['account_id'])
|
||||
@@ -1247,4 +1245,4 @@ class account_move_line(osv.osv):
|
||||
|
||||
account_move_line()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -464,14 +464,6 @@ class account_invoice(osv.osv):
|
||||
result['value'].update(to_update['value'])
|
||||
return result
|
||||
|
||||
def onchange_currency_id(self, cr, uid, ids, curr_id, company_id):
|
||||
if curr_id and company_id:
|
||||
currency = self.pool.get('res.currency').browse(cr, uid, curr_id)
|
||||
if currency.company_id.id != company_id:
|
||||
raise osv.except_osv(_('Configuration Error !'),
|
||||
_('Can not select currency that is not related to current company.\nPlease select accordingly !.'))
|
||||
return {}
|
||||
|
||||
def onchange_journal_id(self, cr, uid, ids, journal_id=False):
|
||||
result = {}
|
||||
if journal_id:
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
<field name="period_id"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By...">
|
||||
<group expand="1" string="Group By...">
|
||||
<filter string="Partner" icon="terp-partner" context="{'group_by':'partner_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Product" icon="terp-accessories-archiver" context="{'group_by':['product_id','product_uom_id'], 'quantity_visible':1}"/>
|
||||
|
||||
@@ -100,14 +100,14 @@
|
||||
<field name="name">Account fiscal Mapping company rule</field>
|
||||
<field model="ir.model" name="model_id" ref="model_account_fiscal_position"/>
|
||||
<field eval="True" name="global"/>
|
||||
<field name="domain_force">[('company_id','=',user.company_id.id)]</field>
|
||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||
</record>
|
||||
|
||||
<record id="account_model_comp_rule" model="ir.rule">
|
||||
<field name="name">Account model company rule</field>
|
||||
<field model="ir.model" name="model_id" ref="model_account_model"/>
|
||||
<field eval="True" name="global"/>
|
||||
<field name="domain_force">[('company_id','=',user.company_id.id)]</field>
|
||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||
</record>
|
||||
|
||||
</data></openerp>
|
||||
|
||||
@@ -65,23 +65,23 @@
|
||||
-
|
||||
!python {model: res.partner}: |
|
||||
import netsvc, tools, os, time
|
||||
import datetime
|
||||
from mx.DateTime import *
|
||||
from datetime import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
import warnings
|
||||
import md5
|
||||
import hashlib
|
||||
warnings.filterwarnings('ignore',".*struct integer overflow masking is deprecated*")
|
||||
start = datetime.date.fromtimestamp(time.mktime(time.strptime(time.strftime('%Y-%m-%d'), "%Y-%m-%d")))
|
||||
start = DateTime(int(start.year), int(start.month), int(start.day))
|
||||
start = datetime.fromtimestamp(time.mktime(time.strptime(time.strftime('%Y-%m-%d'), "%Y-%m-%d")))
|
||||
start = datetime(int(start.year), int(start.month), int(start.day))
|
||||
res = {}
|
||||
for i in range(5)[::-1]:
|
||||
stop = start - RelativeDateTime(days=30)
|
||||
stop = start - relativedelta(days=30)
|
||||
res[str(i)] = {
|
||||
'name': (i!=0 and (str((5-(i+1)) * 30) + '-' + str((5-i) * 30)) or ('+'+str(4 * 30))),
|
||||
'stop': start.strftime('%Y-%m-%d'),
|
||||
'start': (i!=0 and stop.strftime('%Y-%m-%d') or False),
|
||||
}
|
||||
start = stop - RelativeDateTime(days=1)
|
||||
start = stop - relativedelta(days=1)
|
||||
obj_move = self.pool.get('account.move.line')
|
||||
ctx = {}
|
||||
fy_id = ref('account.data_fiscalyear')
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data noupdate="0">
|
||||
<data noupdate="0">
|
||||
|
||||
<record id="budget_post_comp_rule" model="ir.rule">
|
||||
<field name="name">Budget post multi-company</field>
|
||||
<field name="model_id" ref="model_account_budget_post"/>
|
||||
<field eval="True" name="global"/>
|
||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||
</record>
|
||||
<record id="budget_post_comp_rule" model="ir.rule">
|
||||
<field name="name">Budget post multi-company</field>
|
||||
<field name="model_id" ref="model_account_budget_post"/>
|
||||
<field eval="True" name="global"/>
|
||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||
</record>
|
||||
|
||||
<record id="budget_comp_rule" model="ir.rule">
|
||||
<field name="name">Budget multi-company</field>
|
||||
<field name="model_id" ref="model_crossovered_budget"/>
|
||||
<field eval="True" name="global"/>
|
||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||
</record>
|
||||
<record id="budget_comp_rule" model="ir.rule">
|
||||
<field name="name">Budget multi-company</field>
|
||||
<field name="model_id" ref="model_crossovered_budget"/>
|
||||
<field eval="True" name="global"/>
|
||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||
</record>
|
||||
|
||||
<record id="budget_lines_comp_rule" model="ir.rule">
|
||||
<field name="name">Budget lines multi-company</field>
|
||||
<field name="model_id" ref="model_crossovered_budget_lines"/>
|
||||
<field eval="True" name="global"/>
|
||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||
</record>
|
||||
<record id="budget_lines_comp_rule" model="ir.rule">
|
||||
<field name="name">Budget lines multi-company</field>
|
||||
<field name="model_id" ref="model_crossovered_budget_lines"/>
|
||||
<field eval="True" name="global"/>
|
||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<field name="name">Account Coda model company rule</field>
|
||||
<field model="ir.model" name="model_id" ref="model_account_coda"/>
|
||||
<field eval="True" name="global"/>
|
||||
<field name="domain_force">[('company_id','=',user.company_id.id)]</field>
|
||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||
</record>
|
||||
|
||||
</data></openerp>
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from mx import DateTime
|
||||
|
||||
from datetime import datetime
|
||||
from osv import fields, osv
|
||||
|
||||
class Invoice(osv.osv):
|
||||
@@ -36,8 +35,8 @@ class Invoice(osv.osv):
|
||||
if invoice.move_id:
|
||||
for line in invoice.move_id.line_id:
|
||||
if not line.date_maturity or \
|
||||
DateTime.strptime(line.date_maturity, '%Y-%m-%d') \
|
||||
< DateTime.now():
|
||||
datetime.strptime(line.date_maturity, '%Y-%m-%d') \
|
||||
< datetime.today():
|
||||
res[invoice.id] += line.amount_to_pay
|
||||
return res
|
||||
|
||||
@@ -50,4 +49,4 @@ class Invoice(osv.osv):
|
||||
|
||||
Invoice()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<field name="name">Payment Mode company rule</field>
|
||||
<field model="ir.model" name="model_id" ref="model_payment_mode"/>
|
||||
<field eval="True" name="global"/>
|
||||
<field name="domain_force">[('company_id','=',user.company_id.id)]</field>
|
||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
|
||||
@@ -792,7 +792,6 @@ class account_voucher_line(osv.osv):
|
||||
move_line = move_line_pool.browse(cr, user, move_line_id, context=context)
|
||||
if move_line.credit:
|
||||
ttype = 'dr'
|
||||
# amount = move_line.credit
|
||||
else:
|
||||
ttype = 'cr'
|
||||
account_id = move_line.account_id.id
|
||||
@@ -917,4 +916,4 @@ class account_bank_statement_line(osv.osv):
|
||||
|
||||
account_bank_statement_line()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:=======
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:=======
|
||||
|
||||
@@ -36,7 +36,7 @@ class invoice(osv.osv):
|
||||
'res_model': 'account.voucher',
|
||||
'type': 'ir.actions.act_window',
|
||||
'nodestroy': True,
|
||||
'target': 'new',
|
||||
'target': 'current',
|
||||
'domain': '[]',
|
||||
'context': {
|
||||
'default_partner_id': inv.partner_id.id,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<field name="name">Analytic multi company rule</field>
|
||||
<field model="ir.model" name="model_id" ref="model_account_analytic_account"/>
|
||||
<field eval="True" name="global"/>
|
||||
<field name="domain_force">[('company_id','=',user.company_id.id)]</field>
|
||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||
</record>
|
||||
<record id="group_analytic_accounting" model="res.groups" context="{'noadmin':True}">
|
||||
<field name="name">Useability / Analytic Accounting</field>
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
from mx import DateTime
|
||||
from osv import fields, osv, orm
|
||||
from tools import config
|
||||
from tools.translate import _
|
||||
|
||||
@@ -1531,6 +1531,9 @@ true, it will allow you to hide the event alarm information without removing it.
|
||||
result = []
|
||||
if fields and 'date' not in fields:
|
||||
fields.append('date')
|
||||
if fields and 'duration' not in fields:
|
||||
fields.append('duration')
|
||||
|
||||
|
||||
for base_calendar_id, real_id in select:
|
||||
#REVET: Revision ID: olt@tinyerp.com-20100924131709-cqsd1ut234ni6txn
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
parent="base.menu_base_partner" sequence="1" />
|
||||
|
||||
<menuitem parent="base.menu_sales" name="Leads"
|
||||
groups="base.group_extended,base.group_sale_salesman"
|
||||
groups="base.group_extended"
|
||||
id="menu_crm_case_categ0_act_leads"
|
||||
action="crm_case_category_act_leads_all" sequence="1" />
|
||||
|
||||
|
||||
@@ -21,10 +21,8 @@
|
||||
|
||||
from base_calendar import base_calendar
|
||||
from crm import crm_case
|
||||
from datetime import datetime, timedelta
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
import time
|
||||
import logging
|
||||
|
||||
class crm_lead(crm_case, osv.osv):
|
||||
@@ -187,7 +185,7 @@ class res_users(osv.osv):
|
||||
try:
|
||||
data_id = data_obj._get_id(cr, uid, 'crm', 'ir_ui_view_sc_calendar0')
|
||||
view_id = data_obj.browse(cr, uid, data_id, context=context).res_id
|
||||
copy_id = self.pool.get('ir.ui.view_sc').copy(cr, uid, view_id, default = {
|
||||
self.pool.get('ir.ui.view_sc').copy(cr, uid, view_id, default = {
|
||||
'user_id': user_id}, context=context)
|
||||
except ValueError:
|
||||
# Tolerate a missing shortcut. See product/product.py for similar code.
|
||||
|
||||
@@ -34,6 +34,6 @@
|
||||
<record model="ir.ui.menu" id="base.menu_base_config">
|
||||
<field eval="[(4, ref('base.group_sale_manager'))]" name="groups_id"/>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -19,9 +19,8 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
from osv import osv
|
||||
from base_calendar import base_calendar
|
||||
from crm import crm
|
||||
from caldav import calendar
|
||||
from datetime import datetime
|
||||
import re
|
||||
|
||||
@@ -12,15 +12,4 @@
|
||||
<field eval="'()'" name="args"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<data>
|
||||
|
||||
<record id="fetchmail_user_server_rule" model="ir.rule">
|
||||
<field name="name">User wise Server</field>
|
||||
<field ref="model_email_server" name="model_id" model="ir.model"/>
|
||||
<field eval="True" name="global"/>
|
||||
<field name="domain_force">[('user_id', '=', user.id)]</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -36,15 +36,16 @@
|
||||
'hr_attendance_view.xml',
|
||||
'hr_attendance_report.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'security/ir_rule.xml',
|
||||
'wizard/hr_attendance_bymonth_view.xml',
|
||||
'wizard/hr_attendance_byweek_view.xml',
|
||||
'wizard/hr_attendance_error_view.xml',
|
||||
'wizard/hr_attendance_sign_in_out_view.xml',
|
||||
],
|
||||
],
|
||||
'demo_xml': ['hr_attendance_demo.xml'],
|
||||
'test': ['test/test_hr_attendance.yml',
|
||||
'test/hr_attendance_report.yml'
|
||||
],
|
||||
],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
'certificate': '0063495605613',
|
||||
|
||||
@@ -121,17 +121,6 @@
|
||||
<field name="action">sign_out</field>
|
||||
<field name="employee_id" ref="hr.employee1"/>
|
||||
</record>
|
||||
<record id="property_rule_attendace" model="ir.rule">
|
||||
<field name="name">Employee Attendance</field>
|
||||
<field model="ir.model" name="model_id" ref="model_hr_attendance"/>
|
||||
<field name="domain_force">[('employee_id.user_id','=',user.id)]</field>
|
||||
<field name="groups" eval="[(6,0,[ref('base.group_hr_user')])]"/>
|
||||
</record>
|
||||
<record id="property_rule_attendace_manager" model="ir.rule">
|
||||
<field name="name">Manager Attendance</field>
|
||||
<field model="ir.model" name="model_id" ref="model_hr_attendance"/>
|
||||
<field name="domain_force">['|',('employee_id.user_id','=',user.id),('employee_id.parent_id.user_id','=',user.id )]</field>
|
||||
<field name="groups" eval="[(6,0,[ref('base.group_hr_manager')])]"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data noupdate="True">
|
||||
|
||||
<record id="property_rule_attendace" model="ir.rule">
|
||||
<field name="name">Employee Attendance</field>
|
||||
<field model="ir.model" name="model_id" ref="model_hr_attendance"/>
|
||||
<field name="domain_force">[('employee_id.user_id','=',user.id)]</field>
|
||||
<field name="groups" eval="[(4,ref('base.group_hr_user'))]"/>
|
||||
</record>
|
||||
<record id="property_rule_attendace_manager" model="ir.rule">
|
||||
<field name="name">Manager Attendance</field>
|
||||
<field model="ir.model" name="model_id" ref="model_hr_attendance"/>
|
||||
<field name="domain_force">[('1','=',1)]</field>
|
||||
<field name="groups" eval="[(4,ref('base.group_hr_manager'))]"/>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -20,8 +20,9 @@
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
from mx import DateTime as dt
|
||||
|
||||
from datetime import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from dateutil import parser
|
||||
from osv import fields, osv
|
||||
import tools
|
||||
from tools.translate import _
|
||||
@@ -109,8 +110,8 @@ class hr_employee(osv.osv):
|
||||
context = {}
|
||||
for id in self.browse(cr, uid, self.search(cr, uid, [], context=context), context=context):
|
||||
if id.evaluation_plan_id and id.evaluation_date:
|
||||
if (dt.ISO.ParseAny(id.evaluation_date) + dt.RelativeDateTime(months = int(id.evaluation_plan_id.month_next))).strftime('%Y-%m-%d') <= time.strftime("%Y-%m-%d"):
|
||||
self.write(cr, uid, id.id, {'evaluation_date' : (dt.ISO.ParseAny(id.evaluation_date) + dt.RelativeDateTime(months =+ int(id.evaluation_plan_id.month_next))).strftime('%Y-%m-%d')}, context=context)
|
||||
if (parser.parse(id.evaluation_date) + relativedelta(months = int(id.evaluation_plan_id.month_next))).strftime('%Y-%m-%d') <= time.strftime("%Y-%m-%d"):
|
||||
self.write(cr, uid, id.id, {'evaluation_date' : (parser.parse(id.evaluation_date) + relativedelta(months =+ int(id.evaluation_plan_id.month_next))).strftime('%Y-%m-%d')}, context=context)
|
||||
obj_evaluation.create(cr, uid, {'employee_id' : id.id, 'plan_id': id.evaluation_plan_id}, context=context)
|
||||
return True
|
||||
|
||||
@@ -123,11 +124,11 @@ class hr_employee(osv.osv):
|
||||
flag = False
|
||||
evaluation_plan = evaluation_plan_obj.browse(cr, uid, [evaluation_plan_id], context=context)[0]
|
||||
if not evaluation_date:
|
||||
evaluation_date=(dt.ISO.ParseAny(dt.now().strftime('%Y-%m-%d'))+ dt.RelativeDateTime(months=+evaluation_plan.month_first)).strftime('%Y-%m-%d')
|
||||
evaluation_date=(parser.parse(datetime.date.today().strftime('%Y-%m-%d'))+ relativedelta(months=+evaluation_plan.month_first)).strftime('%Y-%m-%d')
|
||||
flag = True
|
||||
else:
|
||||
if (dt.ISO.ParseAny(evaluation_date) + dt.RelativeDateTime(months = int(evaluation_plan.month_next))).strftime('%Y-%m-%d') <= time.strftime("%Y-%m-%d"):
|
||||
evaluation_date=(dt.ISO.ParseAny(evaluation_date)+ dt.RelativeDateTime(months=+evaluation_plan.month_next)).strftime('%Y-%m-%d')
|
||||
if (parser.parse(evaluation_date) + relativedelta(months = int(evaluation_plan.month_next))).strftime('%Y-%m-%d') <= time.strftime("%Y-%m-%d"):
|
||||
evaluation_date=(parser.parse(evaluation_date)+ relativedelta(months=+evaluation_plan.month_next)).strftime('%Y-%m-%d')
|
||||
flag = True
|
||||
if ids and flag:
|
||||
obj_evaluation.create(cr, uid, {'employee_id': ids[0], 'plan_id': evaluation_plan_id}, context=context)
|
||||
@@ -174,7 +175,7 @@ class hr_evaluation(osv.osv):
|
||||
'progress' : fields.float("Progress"),
|
||||
}
|
||||
_defaults = {
|
||||
'date' : lambda *a: (dt.ISO.ParseAny(dt.now().strftime('%Y-%m-%d')) + dt.RelativeDateTime(months =+ 1)).strftime('%Y-%m-%d'),
|
||||
'date' : lambda *a: (parser.parse(datetime.date.today().strftime('%Y-%m-%d')) + relativedelta(months =+ 1)).strftime('%Y-%m-%d'),
|
||||
'state' : lambda *a: 'draft',
|
||||
}
|
||||
|
||||
@@ -225,7 +226,7 @@ class hr_evaluation(osv.osv):
|
||||
int_id = hr_eval_inter_obj.create(cr, uid, {
|
||||
'evaluation_id': evaluation.id,
|
||||
'survey_id': phase.survey_id.id,
|
||||
'date_deadline': (dt.ISO.ParseAny(dt.now().strftime('%Y-%m-%d')) + dt.RelativeDateTime(months =+ 1)).strftime('%Y-%m-%d'),
|
||||
'date_deadline': (parser.parse(datetime.date.today().strftime('%Y-%m-%d')) + relativedelta(months =+ 1)).strftime('%Y-%m-%d'),
|
||||
'user_id': child.user_id.id,
|
||||
'user_to_review_id': evaluation.employee_id.id
|
||||
}, context=context)
|
||||
|
||||
@@ -1599,31 +1599,31 @@ Once the form had been filled, the employee send it to his supervisor.
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<data>
|
||||
<record forcecreate="True" id="ir_cron_scheduler_evaluation" model="ir.cron">
|
||||
<field name="name">Run Employee Evaluation</field>
|
||||
<field eval="True" name="active" />
|
||||
<field name="user_id" ref="base.user_root" />
|
||||
<field name="interval_number">1</field>
|
||||
<field name="interval_type">minutes</field>
|
||||
<field name="numbercall">-1</field>
|
||||
<field eval="'hr.employee'" name="model" />
|
||||
<field eval="'run_employee_evaluation'" name="function" />
|
||||
<field eval="'(False,)'" name="args" />
|
||||
</record>
|
||||
<data>
|
||||
<record forcecreate="True" id="ir_cron_scheduler_evaluation" model="ir.cron">
|
||||
<field name="name">Run Employee Evaluation</field>
|
||||
<field eval="True" name="active" />
|
||||
<field name="user_id" ref="base.user_root" />
|
||||
<field name="interval_number">1</field>
|
||||
<field name="interval_type">minutes</field>
|
||||
<field name="numbercall">-1</field>
|
||||
<field eval="'hr.employee'" name="model" />
|
||||
<field eval="'run_employee_evaluation'" name="function" />
|
||||
<field eval="'(False,)'" name="args" />
|
||||
</record>
|
||||
|
||||
<record id="property_rule_evaluation" model="ir.rule">
|
||||
<field name="name">Employee Evaluation</field>
|
||||
<field model="ir.model" name="model_id" ref="model_hr_evaluation_evaluation"/>
|
||||
<field name="domain_force">[('employee_id.user_id','=',user.id)]</field>
|
||||
<field name="groups" eval="[(6,0,[ref('base.group_hr_user')])]"/>
|
||||
<field name="groups" eval="[(4,ref('base.group_hr_user'))]"/>
|
||||
</record>
|
||||
<record id="property_rule_evaluation_manager" model="ir.rule">
|
||||
<field name="name">Manager Evaluation</field>
|
||||
<field model="ir.model" name="model_id" ref="model_hr_evaluation_evaluation"/>
|
||||
<field name="domain_force">['|',('employee_id.user_id','=',user.id),('employee_id.parent_id.user_id','=',user.id )]</field>
|
||||
<field name="groups" eval="[(6,0,[ref('base.group_hr_manager')])]"/>
|
||||
<field name="groups" eval="[(4,ref('base.group_hr_manager'))]"/>
|
||||
</record>
|
||||
</data>
|
||||
</data>
|
||||
|
||||
</openerp>
|
||||
|
||||
@@ -49,10 +49,11 @@
|
||||
'hr_expense_view.xml',
|
||||
'hr_expense_report.xml',
|
||||
'process/hr_expense_process.xml',
|
||||
'security/ir_rule.xml',
|
||||
'report/hr_expense_report_view.xml',
|
||||
'board_hr_expense_view.xml',
|
||||
'board_hr_expense_manager_view.xml'
|
||||
],
|
||||
],
|
||||
'demo_xml': [
|
||||
'hr_expense_demo.xml',
|
||||
],
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
<data noupdate="1">
|
||||
|
||||
<record id="product_product_expense_air" model="product.product">
|
||||
<record id="product_product_expense_air" model="product.product">
|
||||
<field name="list_price">1.0</field>
|
||||
<field name="standard_price">1.0</field>
|
||||
<field name="uom_id" ref="product.product_uom_unit"/>
|
||||
@@ -38,61 +38,61 @@
|
||||
<field name="hr_expense_ok" eval="True" />
|
||||
</record>
|
||||
|
||||
<record id="hr_expense_expense_septemberexpenses0" model="hr.expense.expense">
|
||||
<field name="currency_id" ref="base.EUR"/>
|
||||
<field name="employee_id" ref="hr.employee1"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="name">May Expenses</field>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
<field name="date">2010-05-03</field>
|
||||
<field name="state">draft</field>
|
||||
</record>
|
||||
<record id="hr_expense_expense_septemberexpenses0" model="hr.expense.expense">
|
||||
<field name="currency_id" ref="base.EUR"/>
|
||||
<field name="employee_id" ref="hr.employee1"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="name">May Expenses</field>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
<field name="date">2010-05-03</field>
|
||||
<field name="state">draft</field>
|
||||
</record>
|
||||
|
||||
<record id="hr_expense_line_travelbycarcustomerseagatedouble0" model="hr.expense.line">
|
||||
<field name="name">Travel by Air</field>
|
||||
<field name="date_value">2010-05-03</field>
|
||||
<field name="analytic_account" ref="account.analytic_consultancy"/>
|
||||
<field name="product_id" ref="product_product_expense_air"/>
|
||||
<field model="hr.expense.expense" name="expense_id" search="[('name', '=', u'May Expenses')]"/>
|
||||
<field eval="700.0" name="unit_amount"/>
|
||||
<field name="uom_id" ref="product.product_uom_unit"/>
|
||||
<field eval="1.0" name="unit_quantity"/>
|
||||
</record>
|
||||
<record id="hr_expense_line_travelbycarcustomerseagatedouble0" model="hr.expense.line">
|
||||
<field name="name">Travel by Air</field>
|
||||
<field name="date_value">2010-05-03</field>
|
||||
<field name="analytic_account" ref="account.analytic_consultancy"/>
|
||||
<field name="product_id" ref="product_product_expense_air"/>
|
||||
<field model="hr.expense.expense" name="expense_id" search="[('name', '=', u'May Expenses')]"/>
|
||||
<field eval="700.0" name="unit_amount"/>
|
||||
<field name="uom_id" ref="product.product_uom_unit"/>
|
||||
<field eval="1.0" name="unit_quantity"/>
|
||||
</record>
|
||||
|
||||
<record id="hr_expense_line_basicpcserverforseagate0" model="hr.expense.line">
|
||||
<field name="name">Basic PC - Server for Seagate</field>
|
||||
<field name="date_value">2010-05-03</field>
|
||||
<field name="analytic_account" ref="account.analytic_seagate_p2"/>
|
||||
<field name="product_id" ref="product.product_product_pc4"/>
|
||||
<field model="hr.expense.expense" name="expense_id" search="[('name', '=', u'May Expenses')]"/>
|
||||
<field eval="1200.0" name="unit_amount"/>
|
||||
<field name="uom_id" ref="product.product_uom_unit"/>
|
||||
<field eval="1.0" name="unit_quantity"/>
|
||||
</record>
|
||||
<record id="hr_expense_line_basicpcserverforseagate0" model="hr.expense.line">
|
||||
<field name="name">Basic PC - Server for Seagate</field>
|
||||
<field name="date_value">2010-05-03</field>
|
||||
<field name="analytic_account" ref="account.analytic_seagate_p2"/>
|
||||
<field name="product_id" ref="product.product_product_pc4"/>
|
||||
<field model="hr.expense.expense" name="expense_id" search="[('name', '=', u'May Expenses')]"/>
|
||||
<field eval="1200.0" name="unit_amount"/>
|
||||
<field name="uom_id" ref="product.product_uom_unit"/>
|
||||
<field eval="1.0" name="unit_quantity"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</data>
|
||||
|
||||
<data noupdate="1">
|
||||
<record id="hr_expense_expense_septemberexpenses1" model="hr.expense.expense">
|
||||
<field name="currency_id" ref="base.EUR"/>
|
||||
<field name="employee_id" ref="hr.employee1"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="name">Travel Expenses</field>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
<field name="date">2010-04-20</field>
|
||||
<field name="state">draft</field>
|
||||
</record>
|
||||
<data noupdate="1">
|
||||
<record id="hr_expense_expense_septemberexpenses1" model="hr.expense.expense">
|
||||
<field name="currency_id" ref="base.EUR"/>
|
||||
<field name="employee_id" ref="hr.employee1"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="name">Travel Expenses</field>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
<field name="date">2010-04-20</field>
|
||||
<field name="state">draft</field>
|
||||
</record>
|
||||
|
||||
<record id="hr_expense_line_hotelexpensesthymbra0" model="hr.expense.line">
|
||||
<field name="name">Hotel Expenses - Thymbra</field>
|
||||
<field name="date_value">2010-05-03</field>
|
||||
<field name="analytic_account" ref="account.analytic_thymbra"/>
|
||||
<field name="product_id" ref="product_product_expense_hotel"/>
|
||||
<field model="hr.expense.expense" name="expense_id" search="[('name', '=', u'Travel Expenses')]"/>
|
||||
<field eval="400.0" name="unit_amount"/>
|
||||
<field name="uom_id" ref="product.product_uom_unit"/>
|
||||
<field eval="5.0" name="unit_quantity"/>
|
||||
</record>
|
||||
<record id="hr_expense_line_hotelexpensesthymbra0" model="hr.expense.line">
|
||||
<field name="name">Hotel Expenses - Thymbra</field>
|
||||
<field name="date_value">2010-05-03</field>
|
||||
<field name="analytic_account" ref="account.analytic_thymbra"/>
|
||||
<field name="product_id" ref="product_product_expense_hotel"/>
|
||||
<field model="hr.expense.expense" name="expense_id" search="[('name', '=', u'Travel Expenses')]"/>
|
||||
<field eval="400.0" name="unit_amount"/>
|
||||
<field name="uom_id" ref="product.product_uom_unit"/>
|
||||
<field eval="5.0" name="unit_quantity"/>
|
||||
</record>
|
||||
|
||||
<record id="hr_expense_line_car_travel" model="hr.expense.line">
|
||||
<field name="name">Bruxelles - Paris</field>
|
||||
@@ -104,17 +104,5 @@
|
||||
<field name="uom_id" ref="product.product_uom_km"/>
|
||||
<field eval="622.0" name="unit_quantity"/>
|
||||
</record>
|
||||
<record id="property_rule_expense" model="ir.rule">
|
||||
<field name="name">Employee Expense</field>
|
||||
<field model="ir.model" name="model_id" ref="model_hr_expense_expense"/>
|
||||
<field name="domain_force">[('employee_id.user_id','=',user.id)]</field>
|
||||
<field name="groups" eval="[(6,0,[ref('base.group_hr_user')])]"/>
|
||||
</record>
|
||||
<record id="property_rule_expense_manager" model="ir.rule">
|
||||
<field name="name">Manager Expense</field>
|
||||
<field model="ir.model" name="model_id" ref="model_hr_expense_expense"/>
|
||||
<field name="domain_force">['|',('employee_id.user_id','=',user.id),('employee_id.parent_id.user_id','=',user.id )]</field>
|
||||
<field name="groups" eval="[(6,0,[ref('base.group_hr_manager')])]"/>
|
||||
</record>
|
||||
</data>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
|
||||
<record id="property_rule_expense" model="ir.rule">
|
||||
<field name="name">Employee Expense</field>
|
||||
<field model="ir.model" name="model_id" ref="model_hr_expense_expense"/>
|
||||
<field name="domain_force">[('employee_id.user_id','=',user.id)]</field>
|
||||
<field name="groups" eval="[(4,ref('base.group_hr_user'))]"/>
|
||||
</record>
|
||||
<record id="property_rule_expense_manager" model="ir.rule">
|
||||
<field name="name">Manager Expense</field>
|
||||
<field model="ir.model" name="model_id" ref="model_hr_expense_expense"/>
|
||||
<field name="domain_force">[('1','=',1)]</field>
|
||||
<field name="groups" eval="[(4,ref('base.group_hr_manager'))]"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -54,6 +54,7 @@
|
||||
'init_xml': [],
|
||||
'update_xml': [
|
||||
'security/ir.model.access.csv',
|
||||
'security/ir_rule.xml',
|
||||
'hr_holidays_workflow.xml',
|
||||
'hr_holidays_view.xml',
|
||||
'hr_holidays_data.xml',
|
||||
|
||||
@@ -33,19 +33,5 @@
|
||||
|
||||
<workflow action="confirm" model="hr.holidays" ref="hr_holidays_employee1_sl"/>
|
||||
<workflow action="validate" model="hr.holidays" ref="hr_holidays_employee1_sl"/>
|
||||
|
||||
<record id="property_rule_holidays" model="ir.rule">
|
||||
<field name="name">Employee Holidays</field>
|
||||
<field model="ir.model" name="model_id" ref="model_hr_holidays"/>
|
||||
<field name="domain_force">[('employee_id.user_id','=',user.id)]</field>
|
||||
<field name="groups" eval="[(6,0,[ref('base.group_hr_user')])]"/>
|
||||
</record>
|
||||
<record id="property_rule_holidays_manager" model="ir.rule">
|
||||
<field name="name">Manager Holidays</field>
|
||||
<field model="ir.model" name="model_id" ref="model_hr_holidays"/>
|
||||
<field name="domain_force">['|',('employee_id.user_id','=',user.id),('employee_id.parent_id.user_id','=',user.id )]</field>
|
||||
<field name="groups" eval="[(6,0,[ref('base.group_hr_manager')])]"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="property_rule_holidays" model="ir.rule">
|
||||
<field name="name">Employee Holidays</field>
|
||||
<field model="ir.model" name="model_id" ref="model_hr_holidays"/>
|
||||
<field name="domain_force">[('employee_id.user_id','=',user.id)]</field>
|
||||
<field name="groups" eval="[(6,0,[ref('base.group_hr_user')])]"/>
|
||||
</record>
|
||||
<record id="property_rule_holidays_manager" model="ir.rule">
|
||||
<field name="name">Manager Holidays</field>
|
||||
<field model="ir.model" name="model_id" ref="model_hr_holidays"/>
|
||||
<field name="domain_force">[('1','=',1)]</field>
|
||||
<field name="groups" eval="[(6,0,[ref('base.group_hr_manager')])]"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -23,7 +23,8 @@ import time
|
||||
import netsvc
|
||||
|
||||
from osv import fields, osv
|
||||
from mx import DateTime
|
||||
from datetime import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from tools.translate import _
|
||||
|
||||
class one2many_mod2(fields.one2many):
|
||||
@@ -210,9 +211,9 @@ class hr_timesheet_sheet(osv.osv):
|
||||
if context is None:
|
||||
context = {}
|
||||
for sheet in self.browse(cr, uid, ids, context=context):
|
||||
if DateTime.now() <= DateTime.strptime(sheet.date_from, '%Y-%m-%d'):
|
||||
if datetime.today() <= datetime.strptime(sheet.date_from, '%Y-%m-%d'):
|
||||
self.write(cr, uid, [sheet.id], {'date_current': sheet.date_from,}, context=context)
|
||||
elif DateTime.now() >= DateTime.strptime(sheet.date_to, '%Y-%m-%d'):
|
||||
elif datetime.now() >= datetime.strptime(sheet.date_to, '%Y-%m-%d'):
|
||||
self.write(cr, uid, [sheet.id], {'date_current': sheet.date_to,}, context=context)
|
||||
else:
|
||||
self.write(cr, uid, [sheet.id], {'date_current': time.strftime('%Y-%m-%d')}, context=context)
|
||||
@@ -222,11 +223,11 @@ class hr_timesheet_sheet(osv.osv):
|
||||
if context is None:
|
||||
context = {}
|
||||
for sheet in self.browse(cr, uid, ids, context=context):
|
||||
if DateTime.strptime(sheet.date_current, '%Y-%m-%d') <= DateTime.strptime(sheet.date_from, '%Y-%m-%d'):
|
||||
if datetime.strptime(sheet.date_current, '%Y-%m-%d') <= datetime.strptime(sheet.date_from, '%Y-%m-%d'):
|
||||
self.write(cr, uid, [sheet.id], {'date_current': sheet.date_from,}, context=context)
|
||||
else:
|
||||
self.write(cr, uid, [sheet.id], {
|
||||
'date_current': (DateTime.strptime(sheet.date_current, '%Y-%m-%d') + DateTime.RelativeDateTime(days=-1)).strftime('%Y-%m-%d'),
|
||||
'date_current': (datetime.strptime(sheet.date_current, '%Y-%m-%d') + relativedelta(days=-1)).strftime('%Y-%m-%d'),
|
||||
}, context=context)
|
||||
return True
|
||||
|
||||
@@ -234,11 +235,11 @@ class hr_timesheet_sheet(osv.osv):
|
||||
if context is None:
|
||||
context = {}
|
||||
for sheet in self.browse(cr, uid, ids, context=context):
|
||||
if DateTime.strptime(sheet.date_current, '%Y-%m-%d') >= DateTime.strptime(sheet.date_to, '%Y-%m-%d'):
|
||||
if datetime.strptime(sheet.date_current, '%Y-%m-%d') >= datetime.strptime(sheet.date_to, '%Y-%m-%d'):
|
||||
self.write(cr, uid, [sheet.id], {'date_current': sheet.date_to,}, context=context)
|
||||
else:
|
||||
self.write(cr, uid, [sheet.id], {
|
||||
'date_current': (DateTime.strptime(sheet.date_current, '%Y-%m-%d') + DateTime.RelativeDateTime(days=1)).strftime('%Y-%m-%d'),
|
||||
'date_current': (datetime.strptime(sheet.date_current, '%Y-%m-%d') + relativedelta(days=1)).strftime('%Y-%m-%d'),
|
||||
}, context=context)
|
||||
return True
|
||||
|
||||
@@ -246,9 +247,9 @@ class hr_timesheet_sheet(osv.osv):
|
||||
if context is None:
|
||||
context = {}
|
||||
for sheet in self.browse(cr, uid, ids, context=context):
|
||||
if DateTime.strptime(sheet.date_current, '%Y-%m-%d') <= DateTime.strptime(sheet.date_from, '%Y-%m-%d'):
|
||||
if datetime.strptime(sheet.date_current, '%Y-%m-%d') <= datetime.strptime(sheet.date_from, '%Y-%m-%d'):
|
||||
self.write(cr, uid, [sheet.id], {'date_current': sheet.date_from,}, context=context)
|
||||
elif DateTime.strptime(sheet.date_current, '%Y-%m-%d') >= DateTime.strptime(sheet.date_to, '%Y-%m-%d'):
|
||||
elif datetime.strptime(sheet.date_current, '%Y-%m-%d') >= datetime.strptime(sheet.date_to, '%Y-%m-%d'):
|
||||
self.write(cr, uid, [sheet.id], {'date_current': sheet.date_to,}, context=context)
|
||||
return True
|
||||
|
||||
@@ -318,7 +319,7 @@ class hr_timesheet_sheet(osv.osv):
|
||||
if r=='month':
|
||||
return time.strftime('%Y-%m-01')
|
||||
elif r=='week':
|
||||
return (DateTime.now() + DateTime.RelativeDateTime(weekday=(DateTime.Monday,0))).strftime('%Y-%m-%d')
|
||||
return (datetime.today() + relativedelta(weekday=0)).strftime('%Y-%m-%d')
|
||||
elif r=='year':
|
||||
return time.strftime('%Y-01-01')
|
||||
return time.strftime('%Y-%m-%d')
|
||||
@@ -327,9 +328,9 @@ class hr_timesheet_sheet(osv.osv):
|
||||
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
||||
r = user.company_id and user.company_id.timesheet_range or 'month'
|
||||
if r=='month':
|
||||
return (DateTime.now() + DateTime.RelativeDateTime(months=+1,day=1,days=-1)).strftime('%Y-%m-%d')
|
||||
return (datetime.today() + relativedelta(months=+1,day=1,days=-1)).strftime('%Y-%m-%d')
|
||||
elif r=='week':
|
||||
return (DateTime.now() + DateTime.RelativeDateTime(weekday=(DateTime.Sunday,0))).strftime('%Y-%m-%d')
|
||||
return (datetime.today() + relativedelta(weekday=6)).strftime('%Y-%m-%d')
|
||||
elif r=='year':
|
||||
return time.strftime('%Y-12-31')
|
||||
return time.strftime('%Y-%m-%d')
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<data>
|
||||
|
||||
<record model="ir.rule" id="timesheet_comp_rule">
|
||||
<field name="name">Timesheet multi-company</field>
|
||||
<field name="model_id" search="[('model','=','hr_timesheet_sheet.sheet')]" model="ir.model"/>
|
||||
<field name="global" eval="True"/>
|
||||
<field name="domain_force">[('company_id','child_of',[user.company_id.id])]</field>
|
||||
</record>
|
||||
<record model="ir.rule" id="timesheet_comp_rule">
|
||||
<field name="name">Timesheet multi-company</field>
|
||||
<field name="model_id" search="[('model','=','hr_timesheet_sheet.sheet')]" model="ir.model"/>
|
||||
<field name="global" eval="True"/>
|
||||
<field name="domain_force">[('company_id','child_of',[user.company_id.id])]</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from mx import DateTime
|
||||
from datetime import datetime
|
||||
|
||||
from osv import fields, osv
|
||||
from tools import mod10r
|
||||
@@ -71,8 +71,8 @@ class account_invoice(osv.osv):
|
||||
if invoice.move_id:
|
||||
for line in invoice.move_id.line_id:
|
||||
if not line.date_maturity or \
|
||||
DateTime.strptime(line.date_maturity, '%Y-%m-%d') \
|
||||
< DateTime.now():
|
||||
datetime.strptime(line.date_maturity, '%Y-%m-%d') \
|
||||
< datetime.today():
|
||||
res[invoice.id] += line.amount_to_pay
|
||||
return res
|
||||
|
||||
@@ -209,4 +209,4 @@ class account_tax_code(osv.osv):
|
||||
|
||||
account_tax_code()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -396,8 +396,8 @@ msgid ""
|
||||
"partner location if you subcontract the manufacturing operations."
|
||||
msgstr ""
|
||||
"Leer lassen, wenn die Produktion an jenen Orten erfolgt, an denen die "
|
||||
"Fertigprodukte gebraucht werden.\r\n"
|
||||
"Setze einen Ort, wenn an fixen Orten produziert wird.\r\n"
|
||||
"Fertigprodukte gebraucht werden.\n"
|
||||
"Setze einen Ort, wenn an fixen Orten produziert wird.\n"
|
||||
"Das kann auch ein Partner-Ort sein, wenn Sie Subkontrakte haben."
|
||||
|
||||
#. module: mrp
|
||||
|
||||
+7
-4
@@ -81,9 +81,11 @@ class mrp_routing(osv.osv):
|
||||
"Set a location if you produce at a fixed location. This can be a partner location " \
|
||||
"if you subcontract the manufacturing operations."
|
||||
),
|
||||
'company_id': fields.many2one('res.company', 'Company'),
|
||||
}
|
||||
_defaults = {
|
||||
'active': lambda *a: 1,
|
||||
'company_id': lambda self, cr, uid, context: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.routing', context=context)
|
||||
}
|
||||
mrp_routing()
|
||||
|
||||
@@ -103,7 +105,8 @@ class mrp_routing_workcenter(osv.osv):
|
||||
'routing_id': fields.many2one('mrp.routing', 'Parent Routing', select=True, ondelete='cascade',
|
||||
help="Routing indicates all the workcenters used, for how long and/or cycles." \
|
||||
"If Routing is indicated then,the third tab of a production order (workcenters) will be automatically pre-completed."),
|
||||
'note': fields.text('Description')
|
||||
'note': fields.text('Description'),
|
||||
'company_id': fields.related('routing_id', 'company_id', type='many2one', relation='res.company', string='Company'),
|
||||
}
|
||||
_defaults = {
|
||||
'cycle_nbr': lambda *a: 1.0,
|
||||
@@ -192,7 +195,7 @@ class mrp_bom(osv.osv):
|
||||
'product_qty': fields.float('Product Qty', required=True),
|
||||
'product_uom': fields.many2one('product.uom', 'Product UOM', required=True, help="UoM (Unit of Measure) is the unit of measurement for the inventory control"),
|
||||
'product_rounding': fields.float('Product Rounding', help="Rounding applied on the product quantity."),
|
||||
'product_efficiency': fields.float('Product Efficiency', required=True, help="Material efficiency. A factor of 0.9 means a loss of 10% in the production."),
|
||||
'product_efficiency': fields.float('Manufacturing Efficiency', required=True, help="A factor of 0.9 means a loss of 10% within the production process."),
|
||||
'bom_lines': fields.one2many('mrp.bom', 'bom_id', 'BoM Lines'),
|
||||
'bom_id': fields.many2one('mrp.bom', 'Parent BoM', ondelete='cascade', select=True),
|
||||
'routing_id': fields.many2one('mrp.routing', 'Routing', help="The list of operations (list of workcenters) to produce the finished product. The routing is mainly used to compute workcenter costs during operations and to plan future loads on workcenters based on production planning."),
|
||||
@@ -441,7 +444,7 @@ class mrp_production(osv.osv):
|
||||
'origin': fields.char('Source Document', size=64, help="Reference of the document that generated this production order request."),
|
||||
'priority': fields.selection([('0','Not urgent'),('1','Normal'),('2','Urgent'),('3','Very Urgent')], 'Priority'),
|
||||
|
||||
'product_id': fields.many2one('product.product', 'Product', required=True, domain=[('type','<>','service')]),
|
||||
'product_id': fields.many2one('product.product', 'Product', required=True, ),
|
||||
'product_qty': fields.float('Product Qty', required=True, states={'draft':[('readonly',False)]}, readonly=True),
|
||||
'product_uom': fields.many2one('product.uom', 'Product UOM', required=True, states={'draft':[('readonly',False)]}, readonly=True),
|
||||
'product_uos_qty': fields.float('Product UoS Qty', states={'draft':[('readonly',False)]}, readonly=True),
|
||||
@@ -951,7 +954,7 @@ class mrp_production_workcenter_line(osv.osv):
|
||||
'cycle': fields.float('Nbr of cycles', digits=(16,2)),
|
||||
'hour': fields.float('Nbr of hours', digits=(16,2)),
|
||||
'sequence': fields.integer('Sequence', required=True, help="Gives the sequence order when displaying a list of work orders."),
|
||||
'production_id': fields.many2one('mrp.production', 'Production Order', select=True, ondelete='cascade'),
|
||||
'production_id': fields.many2one('mrp.production', 'Production Order', select=True, ondelete='cascade', required=True),
|
||||
}
|
||||
_defaults = {
|
||||
'sequence': lambda *a: 1,
|
||||
|
||||
@@ -701,6 +701,17 @@
|
||||
<field name="bom_id" ref="mrp_bom_defaultbomforshelfofcm1"/>
|
||||
</record>
|
||||
|
||||
<record id="mrp_production_order1" model="mrp.production">
|
||||
<field name="product_id" ref="product.product_product_pc1"/>
|
||||
<field name="product_uom" ref="product.product_uom_unit"/>
|
||||
<field name="location_src_id" ref="stock.stock_location_stock"/>
|
||||
<field name="location_dest_id" ref="stock.stock_location_output"/>
|
||||
<field name="bom_id" ref="mrp.mrp_bom_9"/>
|
||||
<field name="routing_id" ref="mrp.mrp_routing_0"/>
|
||||
</record>
|
||||
|
||||
<workflow action="button_confirm" model="mrp.production" ref="mrp_production_order1"/>
|
||||
|
||||
<!-- Run Scheduler -->
|
||||
<function model="procurement.order" name="run_scheduler"/>
|
||||
|
||||
|
||||
+80
-61
@@ -129,7 +129,6 @@
|
||||
<tree string="Work Center">
|
||||
<field name="code"/>
|
||||
<field name="name"/>
|
||||
<field name="resource_id"/>
|
||||
<field name="resource_type"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
</tree>
|
||||
@@ -145,31 +144,31 @@
|
||||
<field name="name" select="1"/>
|
||||
<field name="code" select="1"/>
|
||||
<field name="active"/>
|
||||
<field name="resource_type"/>
|
||||
<field name="calendar_id" widget="selection"/>
|
||||
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Work Center">
|
||||
<field name="resource_type"/>
|
||||
<field name="calendar_id" widget="selection"/>
|
||||
<page string="General Information">
|
||||
<group col="2" colspan="2">
|
||||
<separator colspan="2" string="Capacity Information"/>
|
||||
<field name="time_efficiency"/>
|
||||
<field name="capacity_per_cycle"/>
|
||||
<field name="time_cycle" widget="float_time"/>
|
||||
<field name="time_start" widget="float_time"/>
|
||||
<field name="time_stop" widget="float_time"/>
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<separator colspan="2" string="Costing Information"/>
|
||||
<field name="costs_hour"/>
|
||||
<field name="costs_hour_account_id" groups="analytic.group_analytic_accounting"/>
|
||||
<field name="costs_cycle"/>
|
||||
<field name="costs_cycle_account_id" groups="analytic.group_analytic_accounting"/>
|
||||
<field name="costs_journal_id" groups="analytic.group_analytic_accounting"/>
|
||||
<field name="costs_general_account_id" groups="analytic.group_analytic_accounting"/>
|
||||
</group>
|
||||
<separator colspan="4" string="Description"/>
|
||||
<field colspan="4" name="note" nolabel="1"/>
|
||||
<separator colspan="4" string="Capacity Information"/>
|
||||
<group col="4" colspan="4">
|
||||
<field name="capacity_per_cycle"/>
|
||||
<newline/>
|
||||
<field name="time_cycle" widget="float_time"/>
|
||||
<field name="time_efficiency"/>
|
||||
<field name="time_start" widget="float_time"/>
|
||||
<field name="time_stop" widget="float_time"/>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Analytic Accounting" groups="analytic.group_analytic_accounting">
|
||||
<field name="costs_hour"/>
|
||||
<field name="costs_hour_account_id"/>
|
||||
<field name="costs_cycle"/>
|
||||
<field name="costs_cycle_account_id"/>
|
||||
<field name="costs_journal_id"/>
|
||||
<field name="costs_general_account_id"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
@@ -185,14 +184,14 @@
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search for mrp workcenter">
|
||||
<group col='15' colspan='4'>
|
||||
<field name="code"/>
|
||||
<field name="name"/>
|
||||
<field name="resource_type"/>
|
||||
<filter string="Inactive" icon="terp-gdu-smart-failing" domain="[('active','=',False)]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="code"/>
|
||||
<field name="name"/>
|
||||
<field name="resource_type"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="4" col="20" groups="base.group_extended">
|
||||
<filter string="Resource" icon="terp-personal" domain="[]" context="{'group_by':'resource_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'resource_type'}"/>
|
||||
<separator orientation="vertical" groups="base.group_multi_company"/>
|
||||
<filter string="Company" icon="terp-go-home" domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
|
||||
@@ -222,9 +221,11 @@
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Routing Work Centers">
|
||||
<field name="sequence"/>
|
||||
<field name="name"/>
|
||||
<field name="workcenter_id"/>
|
||||
<field name="cycle_nbr"/>
|
||||
<field name="hour_nbr"/>
|
||||
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -238,9 +239,10 @@
|
||||
<separator colspan="4" string="General Information"/>
|
||||
<field colspan="4" name="name" select="1"/>
|
||||
<field name="sequence" select="1"/>
|
||||
<field name="workcenter_id" select="1"/>
|
||||
<field name="workcenter_id" select="1" widget="selection"/>
|
||||
<field name="cycle_nbr"/>
|
||||
<field name="hour_nbr" widget="float_time"/>
|
||||
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
|
||||
<separator colspan="4" string="Description"/>
|
||||
<field colspan="4" name="note" nolabel="1"/>
|
||||
</form>
|
||||
@@ -253,10 +255,13 @@
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Routing">
|
||||
<field name="name"/>
|
||||
<field name="code"/>
|
||||
<field name="location_id"/>
|
||||
<field name="active" groups="base.group_extended"/>
|
||||
<group colspan="4" col="6">
|
||||
<field name="name"/>
|
||||
<field name="code"/>
|
||||
<field name="active" groups="base.group_extended"/>
|
||||
<field name="location_id"/>
|
||||
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Work Center Operations">
|
||||
<field colspan="4" name="workcenter_lines" nolabel="1" widget="one2many_list"/>
|
||||
@@ -277,6 +282,7 @@
|
||||
<field name="code"/>
|
||||
<field name="name"/>
|
||||
<field name="location_id"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -286,9 +292,16 @@
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Routing">
|
||||
<filter string="Inactive" icon="terp-gdu-smart-failing" domain="[('active','=',False)]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="code"/>
|
||||
<field name="name"/>
|
||||
<field name="location_id"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="4" col="8" groups="base.group_extended">
|
||||
<filter string="Production Location" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'location_id'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
@@ -320,11 +333,11 @@
|
||||
<field name="code" select="1" string="Reference" groups="base.group_extended"/>
|
||||
<newline/>
|
||||
<field name="product_qty"/>
|
||||
<field name="product_uom"/>
|
||||
<field name="routing_id" groups="base.group_extended"/>
|
||||
<field name="product_uom" widget="selection"/>
|
||||
<field name="routing_id" widget="selection" groups="base.group_extended"/>
|
||||
<newline/>
|
||||
<field name="product_uos" groups="product.group_uos"/>
|
||||
<field name="product_uos_qty" groups="product.group_uos" />
|
||||
<field name="product_uos" widget="selection" groups="product.group_uos"/>
|
||||
<newline/>
|
||||
<field name="type" groups="base.group_extended"/>
|
||||
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
|
||||
@@ -410,7 +423,7 @@
|
||||
</field>
|
||||
</record>
|
||||
<record id="mrp_bom_form_action" model="ir.actions.act_window">
|
||||
<field name="name">Master Bill of Materials</field>
|
||||
<field name="name">Bill of Materials</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">mrp.bom</field>
|
||||
<field name="view_type">form</field>
|
||||
@@ -566,8 +579,9 @@
|
||||
<field name="product_id" on_change="product_id_change(product_id)"/>
|
||||
<field name="product_qty"/>
|
||||
<group colspan="2" col="3">
|
||||
<field name="product_uom"/>
|
||||
<field name="product_uom" widget="selection"/>
|
||||
<button type="action"
|
||||
icon="terp-accessories-archiver+"
|
||||
name="%(mrp.action_change_production_qty)d"
|
||||
string="Change Qty" states="ready,confirmed" />
|
||||
</group>
|
||||
@@ -578,10 +592,10 @@
|
||||
|
||||
<notebook colspan="4">
|
||||
<page string="Consumed Products">
|
||||
<field name="bom_id" domain="[('product_id','=',product_id),('bom_id','=',False)]" on_change="bom_id_change(bom_id)" />
|
||||
<field name="routing_id" groups="base.group_extended" select="1"/>
|
||||
<field name="location_src_id" domain="[('usage','=','internal')]" on_change="location_id_change(location_src_id,location_dest_id)"/>
|
||||
<field name="location_dest_id" domain="[('usage','=','internal')]"/>
|
||||
<field name="bom_id" domain="[('product_id','=',product_id),('bom_id','=',False)]" on_change="bom_id_change(bom_id)"/>
|
||||
<field name="routing_id" groups="base.group_extended" select="1" widget="selection"/>
|
||||
<field name="location_src_id" domain="[('usage','=','internal')]" on_change="location_id_change(location_src_id,location_dest_id)" widget="selection"/>
|
||||
<field name="location_dest_id" domain="[('usage','=','internal')]" widget="selection"/>
|
||||
<separator string="" colspan="4"/>
|
||||
|
||||
<field colspan="2" name="move_lines" nolabel="1" widget="one2many_list"
|
||||
@@ -610,7 +624,7 @@
|
||||
<field name="product_qty" readonly="1" string="Qty"/>
|
||||
<field name="product_uom" readonly="1" string="UOM" widget="selection"/>
|
||||
<field name="location_dest_id" readonly="1" string="Destination Loc." widget="selection"/>
|
||||
<field name="prodlot_id" />
|
||||
<field name="prodlot_id" context="{'product_id': product_id}"/>
|
||||
<field name="state" invisible="1"/>
|
||||
<field name="scrapped" invisible="1"/>
|
||||
<button
|
||||
@@ -646,6 +660,10 @@
|
||||
<field name="product_uom" string="UOM" widget="selection"/>
|
||||
<field name="location_id" string="Source Loc." widget="selection"/>
|
||||
<field name="state" invisible="1"/>
|
||||
<button name="%(stock.action_partial_move)d"
|
||||
string="Partial"
|
||||
type="action" states="confirmed,assigned"
|
||||
icon="gtk-justify-fill"/>
|
||||
<button name="%(stock.move_scrap)d"
|
||||
string="Scrap Products" type="action"
|
||||
icon="gtk-convert" context="{'scrap': True}"
|
||||
@@ -660,8 +678,9 @@
|
||||
<field name="product_qty" readonly="1" string="Qty"/>
|
||||
<field name="product_uom" readonly="1" string="UOM" widget="selection"/>
|
||||
<field name="location_dest_id" readonly="1" string="Destination Loc." widget="selection"/>
|
||||
<field name="prodlot_id" />
|
||||
<field name="prodlot_id" context="{'product_id': product_id}"/>
|
||||
<field name="scrapped" invisible="1"/>
|
||||
<field name="state" invisible="1"/>
|
||||
<button name="%(stock.track_line)d"
|
||||
string="Split in production lots" type="action" icon="gtk-justify-fill" states="done,cancel"/>
|
||||
<button name="%(stock.move_scrap)d"
|
||||
@@ -674,7 +693,7 @@
|
||||
<field colspan="4" name="workcenter_lines" nolabel="1">
|
||||
<form string="Production Work Centers">
|
||||
<field colspan="4" name="name"/>
|
||||
<field colspan="4" name="workcenter_id"/>
|
||||
<field name="workcenter_id" widget="selection"/>
|
||||
<field name="sequence"/>
|
||||
<field name="cycle"/>
|
||||
<field name="hour"/>
|
||||
@@ -682,7 +701,7 @@
|
||||
<tree string="Production Work Centers">
|
||||
<field name="sequence"/>
|
||||
<field name="name"/>
|
||||
<field name="workcenter_id"/>
|
||||
<field name="workcenter_id" widget="selection"/>
|
||||
<field name="cycle"/>
|
||||
<field name="hour"/>
|
||||
</tree>
|
||||
@@ -715,16 +734,10 @@
|
||||
<filter icon="terp-document-new" string="Draft"
|
||||
domain="[('state','=','draft')]"
|
||||
help="Non confirmed manufacturing orders"/>
|
||||
<filter icon="terp-check" string="Current" name="Current"
|
||||
<filter icon="terp-check" string="Current" name="current"
|
||||
default="1"
|
||||
domain="[('state','in',('confirmed','ready','exception'))]"
|
||||
help="Manufacturing Orders which are waiting for raw materials"/>
|
||||
<filter icon="terp-camera_test" string="Ready"
|
||||
domain="[('state','=','ready')]"
|
||||
help="Manufacturing Orders which are ready to produce" />
|
||||
<filter icon="terp-check" string="In Production"
|
||||
domain="[('state','=','in_production')]"
|
||||
help="Manufacturing Orders which are in production" />
|
||||
domain="[('state','in',('confirmed','ready','exception','in_production'))]"
|
||||
help="Manufacturing Orders which are waiting for raw materials, confirmed, ready to start or currently in production."/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-gnome-cpu-frequency-applet+" string="Late"
|
||||
domain="['&', ('date_planned::date','<', current_date), ('state', 'in', ('draft', 'confirmed', 'ready'))]"
|
||||
@@ -754,20 +767,19 @@
|
||||
<field name="res_model">mrp.production</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form,calendar,graph,gantt</field>
|
||||
<field name="context">{'search_default_current':1}</field>
|
||||
<field name="view_id" eval="False"/>
|
||||
<field name="search_view_id" ref="view_mrp_production_filter"/>
|
||||
<field name="context">{'search_default_Current':1}</field>
|
||||
<field name="context">{'search_default_current':1}</field>
|
||||
<field name="help">Manufacturing Orders are usually proposed automatically by OpenERP based on the bill of materials and the procurement rules, but you can also create manufacturing orders manually. OpenERP will handle the consumation of the raw materials (stock decrease) and the production of the finished products (stock increase) when the order is processed.</field>
|
||||
</record>
|
||||
<menuitem action="mrp_production_action" id="menu_mrp_production_action" parent="menu_mrp_manufacturing" groups="mrp.group_mrp_user,mrp.group_mrp_manager" sequence="1"/>
|
||||
|
||||
<record id="mrp_production_action_planning" model="ir.actions.act_window">
|
||||
<field name="name">Manufacturing Orders Planning</field>
|
||||
<field name="name">Manufacturing Orders</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">mrp.production</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form,calendar,graph</field>
|
||||
<field name="view_mode">calendar,tree,form,graph</field>
|
||||
<field name="domain">[('state','in',('ready','confirmed','in_production'))]</field>
|
||||
<field name="help">Manufacturing Orders describe the operations that need to be carried out and the raw materials usage for each stage of production. You use specifications (bills of materials or BoM) to work out the raw material requirements and the manufacturing orders needed for the finished products. Once the bills of materials have been defined, OpenERP becomes capable of automatically deciding on the manufacturing route depending on the needs of the company.</field>
|
||||
</record>
|
||||
@@ -911,13 +923,20 @@
|
||||
|
||||
<!-- Menu for Resource for MRP-->
|
||||
|
||||
<menuitem id="menu_pm_resources_mrp" name="Resources" parent="base.menu_mrp_root"
|
||||
groups="base.group_extended"
|
||||
sequence="4"/>
|
||||
<menuitem id="menu_pm_resources_config" name="Resources" parent="menu_mrp_configuration"/>
|
||||
<menuitem action="resource.action_resource_resource_tree" id="menu_view_resource_search_mrp" parent="menu_pm_resources_mrp" sequence="1"/>
|
||||
<menuitem action="resource.action_resource_resource_tree" id="menu_view_resource_search_mrp" parent="menu_pm_resources_config" sequence="1"/>
|
||||
<menuitem action="resource.action_resource_calendar_form" id="menu_view_resource_calendar_search_mrp" parent="menu_pm_resources_config" sequence="1"/>
|
||||
<menuitem action="resource.action_resource_calendar_leave_tree" id="menu_view_resource_calendar_leaves_search_mrp" parent="menu_pm_resources_config" sequence="1"/>
|
||||
|
||||
<!-- Planning -->
|
||||
|
||||
<menuitem id="menu_mrp_planning" name="Planning"
|
||||
parent="base.menu_mrp_root" sequence="2"
|
||||
groups="base.group_extended"/>
|
||||
<menuitem action="mrp.mrp_production_action_planning"
|
||||
id="menu_mrp_production_order_action"
|
||||
parent="menu_mrp_planning" sequence="1"
|
||||
groups="base.group_extended"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from mx import DateTime
|
||||
from datetime import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from osv import fields
|
||||
from osv import osv
|
||||
from tools.translate import _
|
||||
@@ -81,8 +82,8 @@ class procurement_order(osv.osv):
|
||||
for procurement in procurement_obj.browse(cr, uid, ids):
|
||||
res_id = procurement.move_id.id
|
||||
loc_id = procurement.location_id.id
|
||||
newdate = DateTime.strptime(procurement.date_planned, '%Y-%m-%d %H:%M:%S') - DateTime.RelativeDateTime(days=procurement.product_id.product_tmpl_id.produce_delay or 0.0)
|
||||
newdate = newdate - DateTime.RelativeDateTime(days=company.manufacturing_lead)
|
||||
newdate = datetime.strptime(procurement.date_planned, '%Y-%m-%d %H:%M:%S') - relativedelta(days=procurement.product_id.product_tmpl_id.produce_delay or 0.0)
|
||||
newdate = newdate - relativedelta(days=company.manufacturing_lead)
|
||||
produce_id = production_obj.create(cr, uid, {
|
||||
'origin': procurement.origin,
|
||||
'product_id': procurement.product_id.id,
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
<field name="act_window_id" ref="action_report_mrp_production_order"/>
|
||||
</record>
|
||||
|
||||
<menuitem name="Production" action="action_report_mrp_production_order" id="menu_report_mrp_production_orders_tree" parent="next_id_77"/>
|
||||
<menuitem name="Production Analysis" action="action_report_mrp_production_order" id="menu_report_mrp_production_orders_tree" parent="next_id_77"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -51,9 +51,6 @@
|
||||
</record>
|
||||
<menuitem id="next_id_77" name="Reporting"
|
||||
parent="base.menu_mrp_root" sequence="49"/>
|
||||
<menuitem action="action_report_workcenter_load_tree"
|
||||
id="menu_report_workcenter_load" parent="next_id_77"
|
||||
groups="base.group_extended"/>
|
||||
|
||||
<!-- stock.move compared to internal location src/dest -->
|
||||
|
||||
@@ -101,10 +98,6 @@
|
||||
<field name="view_mode">graph,tree</field>
|
||||
<field name="help">Weekly Stock Value Variation enables you to track the stock value evolution linked to manufacturing activities, receptions of products and delivery orders.</field>
|
||||
</record>
|
||||
<menuitem action="action_report_in_out_picking_tree" id="menu_report_in_out_picking"
|
||||
parent="next_id_77" groups="mrp.group_mrp_manager"/>
|
||||
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -10,28 +10,28 @@
|
||||
</record>
|
||||
|
||||
|
||||
<!-- restrict access to menu -->
|
||||
<record model='ir.ui.menu' id="mrp_Sched_all">
|
||||
<field eval="[(6,0,[ref('group_mrp_manager')])]" name="groups_id"/>
|
||||
</record>
|
||||
<!-- restrict access to menu -->
|
||||
<record model='ir.ui.menu' id="mrp_Sched_all">
|
||||
<field eval="[(6,0,[ref('group_mrp_manager')])]" name="groups_id"/>
|
||||
</record>
|
||||
|
||||
<!-- Multi -->
|
||||
<record model="ir.rule" id="mrp_production_rule">
|
||||
<field name="name">mrp_production multi-company</field>
|
||||
<field name="name">mrp_production multi-company</field>
|
||||
<field name="model_id" search="[('model','=','mrp.production')]" model="ir.model"/>
|
||||
<field name="global" eval="True"/>
|
||||
<field name="domain_force">['|',('company_id','child_of',[user.company_id.id]),('company_id','=',False)]</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.rule" id="mrp_workcenter_rule">
|
||||
<field name="name">mrp_workcenter multi-company</field>
|
||||
<field name="name">mrp_workcenter multi-company</field>
|
||||
<field name="model_id" search="[('model','=','mrp.workcenter')]" model="ir.model"/>
|
||||
<field name="global" eval="True"/>
|
||||
<field name="domain_force">['|',('company_id','child_of',[user.company_id.id]),('company_id','=',False)]</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.rule" id="mrp_bom_rule">
|
||||
<field name="name">mrp_bom multi-company</field>
|
||||
<field name="name">mrp_bom multi-company</field>
|
||||
<field name="model_id" search="[('model','=','mrp.bom')]" model="ir.model"/>
|
||||
<field name="global" eval="True"/>
|
||||
<field name="domain_force">['|',('company_id','child_of',[user.company_id.id]),('company_id','=',False)]</field>
|
||||
|
||||
+1
-4
@@ -19,13 +19,9 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from mx import DateTime
|
||||
from osv import fields
|
||||
from osv import osv
|
||||
from tools.translate import _
|
||||
import ir
|
||||
import netsvc
|
||||
import time
|
||||
|
||||
|
||||
class StockMove(osv.osv):
|
||||
@@ -132,6 +128,7 @@ class StockMove(osv.osv):
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for move in self.browse(cr, uid, ids):
|
||||
new_moves = super(StockMove, self).action_scrap(cr, uid, [move.id], product_qty, location_id, context=context)
|
||||
self.write(cr, uid, [move.id], {'prodlot_id': False, 'tracking_id': False})
|
||||
production_ids = production_obj.search(cr, uid, [('move_lines', 'in', [move.id])])
|
||||
for prod_id in production_ids:
|
||||
wf_service.trg_validate(uid, 'mrp.production', prod_id, 'button_produce', cr)
|
||||
|
||||
@@ -19,11 +19,7 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
import ir
|
||||
from osv.osv import except_osv
|
||||
from osv import fields, osv
|
||||
import netsvc
|
||||
from tools.translate import _
|
||||
|
||||
class change_production_qty(osv.osv_memory):
|
||||
@@ -63,7 +59,6 @@ class change_production_qty(osv.osv_memory):
|
||||
record_id = context and context.get('active_id',False)
|
||||
assert record_id, _('Active Id is not found')
|
||||
prod_obj = self.pool.get('mrp.production')
|
||||
product_lines_obj = self.pool.get('mrp.production.product.line')
|
||||
bom_obj = self.pool.get('mrp.bom')
|
||||
for wiz_qty in self.browse(cr, uid, ids):
|
||||
prod = prod_obj.browse(cr, uid,record_id)
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
'mrp_operations_workflow.xml',
|
||||
'mrp_operations_view.xml',
|
||||
'mrp_operations_report.xml',
|
||||
'report/mrp_workorder_analysis_view.xml',
|
||||
'process/mrp_operation_process.xml'
|
||||
],
|
||||
'demo_xml': ['mrp_operation_data.xml'],
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<menuitem id="menu_mrp_planning" name="Planning"
|
||||
parent="base.menu_mrp_root" sequence="2"
|
||||
groups="base.group_extended"/>
|
||||
|
||||
<record id="mrp_production_form_inherit_view" model="ir.ui.view">
|
||||
<field name="name">mrp.production.form.inherit</field>
|
||||
@@ -13,6 +10,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="/form/notebook/page/field[@name='workcenter_lines']/form/field[@name='hour']" position="after">
|
||||
<group colspan="8" col="8">
|
||||
<separator colspan="8"/>
|
||||
<field name="state"/>
|
||||
<button name="button_cancel" string="Cancel" states="draft,startworking" icon="gtk-stop" help="Cancel Order"/>
|
||||
<button name="button_draft" string="Set Draft" states="cancel" icon="gtk-convert" help="Set to Draft"/>
|
||||
@@ -49,14 +47,14 @@
|
||||
<field name="type">tree</field>
|
||||
<field name="inherit_id" eval="False"/>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Work Orders" colors="gray:state in ('done','cancel');black:state in ('draft','startworking') and date_planned>=current_date;red:date_planned<current_date and state not in ('done','cancel')">
|
||||
<tree string="Work Orders" colors="gray:state in ('done','cancel');black:state in ('draft','startworking') and date_planned>=current_date;red:date_planned<current_date and state in ('draft', 'confirmed', 'ready')">
|
||||
<field name="production_id"/>
|
||||
<field name="date_planned"/>
|
||||
<field name="product"/>
|
||||
<field name="qty"/>
|
||||
<field name="uom"/>
|
||||
<field name="name"/>
|
||||
<field name="workcenter_id"/>
|
||||
<field name="workcenter_id" widget="selection"/>
|
||||
<field name="cycle"/>
|
||||
<field name="hour"/>
|
||||
<field name="state" />
|
||||
@@ -79,7 +77,7 @@
|
||||
<form string="Work Orders">
|
||||
<group col="6" colspan="4">
|
||||
<field colspan="4" name="name" select="1"/>
|
||||
<field name="workcenter_id" select="1"/>
|
||||
<field name="workcenter_id" select="1" widget="selection"/>
|
||||
<field name="production_id"/>
|
||||
<field name="production_state"/>
|
||||
<field name="sequence"/>
|
||||
@@ -108,7 +106,7 @@
|
||||
<separator string="Product to Produce" colspan="2"/>
|
||||
<field name="product"/>
|
||||
<field name="qty"/>
|
||||
<field name="uom"/>
|
||||
<field name="uom" widget="selection"/>
|
||||
</group>
|
||||
|
||||
<separator string="" colspan="4"/>
|
||||
@@ -211,11 +209,35 @@
|
||||
<field name="res_model">mrp.production.workcenter.line</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[('production_state','in',('ready','confirmed','in_production'))]</field>
|
||||
<field name="view_mode">tree,form,graph,calendar</field>
|
||||
<field name="view_mode">gantt,tree,form,graph,calendar</field>
|
||||
<field name="help">To manufacture or assemble products, as well as using raw materials and finished product you must also handle manufacturing operations. Manufacturing operations are often called work orders. The different operations will have different impacts on the costs of manufacture and planning depending on the available workload.</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="workcenter_line_resource_gantt" model="ir.ui.view">
|
||||
<field name="name">mrp.production.workcenter.line.resource.gantt</field>
|
||||
<field name="model">mrp.production.workcenter.line</field>
|
||||
<field name="type">gantt</field>
|
||||
<field name="arch" type="xml">
|
||||
<gantt color="workcenter_id" date_delay="delay" date_start="date_planned" string="Resources">
|
||||
<level object="mrp.workcenter" link="workcenter_id" domain="[]">
|
||||
<field name="delay"/>
|
||||
<field name="workcenter_id"/>
|
||||
</level>
|
||||
</gantt>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="mrp_production_wc_resource_planning">
|
||||
<field name="name">Resources</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">mrp.production.workcenter.line</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[('production_state','in',('ready','confirmed','in_production'))]</field>
|
||||
<field name="view_mode">gantt</field>
|
||||
<field name="view_id" ref="workcenter_line_resource_gantt"/>
|
||||
</record>
|
||||
|
||||
<!-- Action for Confirm Operations -->
|
||||
|
||||
<record model="ir.actions.act_window" id="mrp_production_wc_confirm_action">
|
||||
@@ -249,19 +271,19 @@
|
||||
|
||||
</record>
|
||||
|
||||
<menuitem action="mrp.mrp_production_action_planning"
|
||||
id="menu_mrp_production_order_action"
|
||||
parent="menu_mrp_planning" sequence="1"
|
||||
groups="base.group_extended"/>
|
||||
<menuitem name="Work Orders" parent="mrp.menu_mrp_manufacturing"
|
||||
id="menu_mrp_production_wc_order"
|
||||
action="mrp_production_wc_action_form"
|
||||
groups="base.group_extended" sequence="2"/>
|
||||
<menuitem name="Work Orders" parent="menu_mrp_planning"
|
||||
<menuitem name="Work Orders" parent="mrp.menu_mrp_planning"
|
||||
id="menu_mrp_production_wc_action_planning"
|
||||
action="mrp_production_wc_action_planning"
|
||||
sequence="2"
|
||||
groups="base.group_extended"/>
|
||||
<menuitem parent="mrp.menu_mrp_planning"
|
||||
id="menu_mrp_production_wc_resource_planning"
|
||||
action="mrp_production_wc_resource_planning"
|
||||
groups="base.group_extended"/>
|
||||
|
||||
<!-- Operation codes -->
|
||||
|
||||
|
||||
@@ -21,5 +21,6 @@
|
||||
|
||||
import mrp_wc_barcode
|
||||
import mrp_code_barcode
|
||||
import mrp_workorder_analysis
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
# -*- 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
|
||||
import tools
|
||||
|
||||
class mrp_workorder(osv.osv):
|
||||
_name = "mrp.workorder"
|
||||
_description = "Work Order Report"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'year': fields.char('Year', size=64, readonly=True),
|
||||
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'),
|
||||
('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')],'Month',readonly=True),
|
||||
'day': fields.char('Day', size=64, readonly=True),
|
||||
'nbr': fields.integer('# of Lines', readonly=True),
|
||||
'date': fields.date('Date', readonly=True),
|
||||
'product_id': fields.many2one('product.product', 'Product', readonly=True),
|
||||
'product_qty': fields.float('Product Qty', readonly=True),
|
||||
'state': fields.selection([('draft','Draft'),('startworking', 'In Progress'),('pause','Pause'),('cancel','Cancelled'),('done','Finished')],'State', readonly=True),
|
||||
'total_hours': fields.float('Total Hours', readonly=True),
|
||||
'total_cycles': fields.float('Total Cycles', readonly=True),
|
||||
'delay': fields.float('Delay', readonly=True),
|
||||
'production_id': fields.many2one('mrp.production', 'Production', readonly=True),
|
||||
'workcenter_id': fields.many2one('mrp.workcenter', 'Workcenter', readonly=True)
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'mrp_workorder')
|
||||
cr.execute("""
|
||||
create or replace view mrp_workorder as (
|
||||
select
|
||||
to_date(to_char(wl.date_planned, 'MM-dd-YYYY'),'MM-dd-YYYY') as date,
|
||||
to_char(wl.date_planned, 'YYYY') as year,
|
||||
to_char(wl.date_planned, 'MM') as month,
|
||||
to_char(wl.date_planned, 'YYYY-MM-DD') as day,
|
||||
min(wl.id) as id,
|
||||
mp.product_id as product_id,
|
||||
sum(wl.hour) as total_hours,
|
||||
avg(wl.delay) as delay,
|
||||
(w.costs_hour*sum(wl.hour)) as total_cost,
|
||||
wl.production_id as production_id,
|
||||
wl.workcenter_id as workcenter_id,
|
||||
sum(wl.cycle) as total_cycles,
|
||||
count(*) as nbr,
|
||||
sum(mp.product_qty) as product_qty,
|
||||
wl.state as state
|
||||
from mrp_production_workcenter_line wl
|
||||
left join mrp_workcenter w on (w.id = wl.workcenter_id)
|
||||
left join mrp_production mp on (mp.id = wl.production_id)
|
||||
group by
|
||||
w.costs_hour, mp.product_id, mp.name, wl.state, wl.date_planned, wl.production_id, wl.workcenter_id
|
||||
)""")
|
||||
|
||||
mrp_workorder()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,115 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<!--
|
||||
Work Order Report
|
||||
-->
|
||||
|
||||
<record id="view_report_mrp_workorder_tree" model="ir.ui.view">
|
||||
<field name="name">mrp.workorder.tree</field>
|
||||
<field name="model">mrp.workorder</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Work Orders">
|
||||
<field name="date" invisible="1"/>
|
||||
<field name="product_id" invisible="1"/>
|
||||
<field name="product_qty" sum="Product Qty"/>
|
||||
<field name="nbr" string="#Line Orders" sum="#Line Orders"/>
|
||||
<field name="total_hours" sum="Total Hours"/>
|
||||
<field name="total_cycles" sum="Total Cycles"/>
|
||||
<field name="delay" invisible="1"/>
|
||||
<field name="production_id" invisible="1"/>
|
||||
<field name="workcenter_id" invisible="1"/>
|
||||
<field name="state" invisible="1"/>
|
||||
<field name="day" invisible="1" />
|
||||
<field name="month" invisible="1" />
|
||||
<field name="year" invisible="1" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_report_mrp_workorder_graph" model="ir.ui.view">
|
||||
<field name="name">mrp.workorder.graph</field>
|
||||
<field name="model">mrp.workorder</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph orientation="horizontal" string="Work Orders" type="bar">
|
||||
<field name="state"/>
|
||||
<field name="nbr" operator="+"/>
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_report_mrp_workorder_filter" model="ir.ui.view">
|
||||
<field name="name">mrp.workorder.select</field>
|
||||
<field name="model">mrp.workorder</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search">
|
||||
<group col="16" colspan="6">
|
||||
<filter icon="terp-go-year" string="Year"
|
||||
domain="[('year','=',time.strftime('%%Y'))]"
|
||||
help="Work orders made during current year"/>
|
||||
<filter icon="terp-go-month" string="Month"
|
||||
name="month"
|
||||
domain="[('month','=',time.strftime('%%m'))]"
|
||||
help="Work orders made during current month"/>
|
||||
<filter icon="terp-go-week"
|
||||
string="Month -1"
|
||||
separator="1"
|
||||
domain="[('month','=',(datetime.date.today() - datetime.timedelta(365/12)).strftime('%%m'))]"
|
||||
help="Work orders during last month"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Current" icon="terp-check" domain="[('state','not in',('draft','cancel','done'))]"/>
|
||||
<filter icon="terp-check" string="Started" domain="[('state','=','startworking')]"/>
|
||||
<filter icon="terp-dialog-close" string="Done" domain="[('state','=','done')]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="product_id" />
|
||||
<field name="workcenter_id"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="1" string="Group By...">
|
||||
<filter string="Product" name="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id'}" />
|
||||
<filter string="Workcenter" name="Workcenter" icon="terp-go-home" context="{'group_by':'workcenter_id'}" />
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Production" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'production_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Day" icon="terp-go-today" context="{'group_by':'day'}" help="Planned Day"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Month" name="terp-go-month" icon="terp-go-month" context="{'group_by':'month'}" help="Planned Month"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Year" icon="terp-go-year" context="{'group_by':'year'}" help="Planned Year"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
<record id="action_report_mrp_workorder" model="ir.actions.act_window">
|
||||
<field name="name">Work Order</field>
|
||||
<field name="res_model">mrp.workorder</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">graph,tree</field>
|
||||
<field name="view_id" ref="view_report_mrp_workorder_tree"/>
|
||||
<field name="search_view_id" ref="view_report_mrp_workorder_filter"/>
|
||||
<field name="context">{'search_default_Workcenter': 1,'search_default_month':1,'group_by_no_leaf':1,'group_by':[]}</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_report_mrp_workorder_tree">
|
||||
<field name="sequence" eval="1"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="view_report_mrp_workorder_tree"/>
|
||||
<field name="act_window_id" ref="action_report_mrp_workorder"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_report_mrp_workorder_graph">
|
||||
<field name="sequence" eval="2"/>
|
||||
<field name="view_mode">graph</field>
|
||||
<field name="view_id" ref="view_report_mrp_workorder_graph"/>
|
||||
<field name="act_window_id" ref="action_report_mrp_workorder"/>
|
||||
</record>
|
||||
|
||||
<menuitem name="Work Order Analysis" action="action_report_mrp_workorder" id="menu_report_mrp_workorders_tree" parent="mrp.next_id_77"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -7,3 +7,4 @@
|
||||
"access_mrp_production_manager","mrp_production_manager","model_mrp_production","mrp.group_mrp_manager",1,0,0,0
|
||||
"access_mrp_production_workcenter_line","mrp.production.workcenter.line","mrp.model_mrp_production_workcenter_line","mrp.group_mrp_user",1,1,1,1
|
||||
"access_mrp_production_workcenter_line_manager","mrp.production.workcenter.line.manager","mrp.model_mrp_production_workcenter_line","mrp.group_mrp_manager",1,0,0,0
|
||||
"access_mrp_workorder_manager","mrp.workorder.manager","model_mrp_workorder","mrp.group_mrp_manager",1,1,1,1
|
||||
|
||||
|
@@ -222,7 +222,7 @@ class mrp_repair(osv.osv):
|
||||
if move_id:
|
||||
move = self.pool.get('stock.move').browse(cr, uid, move_id)
|
||||
product = self.pool.get('product.product').browse(cr, uid, prod_id)
|
||||
limit = datetime.strptime(move.date_planned, '%Y-%m-%d %H:%M:%S') + relativedelta(months=product.warranty)
|
||||
limit = datetime.strptime(move.date_expected, '%Y-%m-%d %H:%M:%S') + relativedelta(months=product.warranty)
|
||||
data['value']['guarantee_limit'] = limit.strftime('%Y-%m-%d')
|
||||
data['value']['location_id'] = move.location_dest_id.id
|
||||
data['value']['location_dest_id'] = move.location_dest_id.id
|
||||
|
||||
@@ -95,7 +95,7 @@ class mrp_production(osv.osv):
|
||||
'state': 'waiting',
|
||||
'production_id': production.id
|
||||
}
|
||||
sub_prod_ids = self.pool.get('stock.move').create(cr, uid, data)
|
||||
self.pool.get('stock.move').create(cr, uid, data)
|
||||
return picking_id
|
||||
|
||||
mrp_production()
|
||||
|
||||
@@ -63,6 +63,30 @@ class account_cash_statement(osv.osv):
|
||||
|
||||
return res
|
||||
|
||||
def _get_cash_open_box_lines(self, cr, uid, context={}):
|
||||
res = super(account_cash_statement,self)._get_cash_open_box_lines(cr, uid, context)
|
||||
curr = [0.01, 0.02, 0.05, 0.10, 0.20, 0.50]
|
||||
for rs in curr:
|
||||
dct = {
|
||||
'pieces':rs,
|
||||
'number':0
|
||||
}
|
||||
res.append(dct)
|
||||
res.sort()
|
||||
return res
|
||||
|
||||
def _get_default_cash_close_box_lines(self, cr, uid, context={}):
|
||||
res = super(account_cash_statement,self)._get_default_cash_close_box_lines(cr, uid, context)
|
||||
curr = [0.01, 0.02, 0.05, 0.10, 0.20, 0.50]
|
||||
for rs in curr:
|
||||
dct = {
|
||||
'pieces':rs,
|
||||
'number':0
|
||||
}
|
||||
res.append(dct)
|
||||
res.sort()
|
||||
return res
|
||||
|
||||
account_cash_statement()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
import time
|
||||
import netsvc
|
||||
from osv import fields, osv
|
||||
from mx import DateTime
|
||||
from datetime import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from tools.translate import _
|
||||
from decimal import Decimal
|
||||
import decimal_precision as dp
|
||||
@@ -337,7 +338,7 @@ class pos_order(osv.osv):
|
||||
'price_type': lambda *a: 'tax_excluded',
|
||||
'name': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'pos.order'),
|
||||
'date_order': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'date_validity': lambda *a: (DateTime.now() + DateTime.RelativeDateTime(months=+6)).strftime('%Y-%m-%d'),
|
||||
'date_validity': lambda *a: (datetime.today() + relativedelta(months=+6)).strftime('%Y-%m-%d'),
|
||||
'nb_print': lambda *a: 0,
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
|
||||
'sale_journal': _sale_journal_get,
|
||||
@@ -1268,8 +1269,8 @@ class product_product(osv.osv):
|
||||
_columns = {
|
||||
'income_pdt': fields.boolean('Product for Input'),
|
||||
'expense_pdt': fields.boolean('Product for expenses'),
|
||||
'am_out': fields.boolean('Controle for Output Operations'),
|
||||
'disc_controle': fields.boolean('Discount Controle '),
|
||||
'am_out': fields.boolean('Control for Output Operations'),
|
||||
'disc_controle': fields.boolean('Discount Control'),
|
||||
}
|
||||
_defaults = {
|
||||
'disc_controle': lambda *a: True,
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
from datetime import datetime
|
||||
from report import report_sxw
|
||||
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ from report import report_sxw
|
||||
import pooler
|
||||
|
||||
def titlize(journal_name):
|
||||
res = []
|
||||
words = journal_name.split()
|
||||
while words.pop() != 'journal':
|
||||
continue
|
||||
|
||||
@@ -8,13 +8,6 @@
|
||||
<record id="group_pos_user" model="res.groups">
|
||||
<field name="name">Point of Sale / User</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.rule" id="pos_cash_statement_rule">
|
||||
<field name="name">Registers</field>
|
||||
<field name="model_id" search="[('model','=','account.bank.statement')]" model="ir.model"/>
|
||||
<field name="global" eval="True"/>
|
||||
<field name="domain_force">[('user_id','!=',['base.user_root'])]</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
import netsvc
|
||||
from osv import osv,fields
|
||||
from tools.translate import _
|
||||
from mx import DateTime
|
||||
import time
|
||||
|
||||
class all_closed_cashbox_of_the_day(osv.osv_memory):
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
from osv import osv, fields
|
||||
import time
|
||||
from tools.translate import _
|
||||
from mx import DateTime
|
||||
from datetime import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
import pos_box_entries
|
||||
|
||||
|
||||
@@ -78,8 +79,8 @@ class pos_box_out(osv.osv_memory):
|
||||
for data in self.read(cr, uid, ids):
|
||||
curr_company = res_obj.browse(cr, uid, uid).company_id.id
|
||||
statement_id = statement_obj.search(cr, uid, [('journal_id', '=', data['journal_id']), ('company_id', '=', curr_company), ('user_id', '=', uid), ('state', '=', 'open')])
|
||||
monday = (DateTime.now() + DateTime.RelativeDateTime(weekday=(DateTime.Monday, 0))).strftime('%Y-%m-%d')
|
||||
sunday = (DateTime.now() + DateTime.RelativeDateTime(weekday=(DateTime.Sunday, 0))).strftime('%Y-%m-%d')
|
||||
monday = (datetime.today() + relativedelta(weekday=0)).strftime('%Y-%m-%d')
|
||||
sunday = (datetime.today() + relativedelta(weekday=6)).strftime('%Y-%m-%d')
|
||||
done_statmt = statement_obj.search(cr, uid, [('date', '>=', monday+' 00:00:00'), ('date', '<=', sunday+' 23:59:59'), ('journal_id', '=', data['journal_id']), ('company_id', '=', curr_company), ('user_id', '=', uid)])
|
||||
stat_done = statement_obj.browse(cr, uid, done_statmt)
|
||||
address_u = res_obj.browse(cr, uid, uid).address_id
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
from mx import DateTime
|
||||
|
||||
from datetime import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from osv import osv
|
||||
from tools.translate import _
|
||||
import tools
|
||||
@@ -59,7 +59,7 @@ class procurement_order(osv.osv):
|
||||
if use_new_cursor:
|
||||
cr.commit()
|
||||
company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id
|
||||
maxdate = (DateTime.now() + DateTime.RelativeDateTime(days=company.schedule_range)).strftime(tools.DEFAULT_SERVER_DATE_FORMAT)
|
||||
maxdate = (datetime.today() + relativedelta(days=company.schedule_range)).strftime(tools.DEFAULT_SERVER_DATE_FORMAT)
|
||||
start_date = time.strftime('%Y-%m-%d, %Hh %Mm %Ss')
|
||||
offset = 0
|
||||
report = []
|
||||
@@ -166,7 +166,7 @@ class procurement_order(osv.osv):
|
||||
if product.virtual_available >= 0.0:
|
||||
continue
|
||||
|
||||
newdate = DateTime.now()
|
||||
newdate = datetime.today()
|
||||
if product.supply_method == 'buy':
|
||||
location_id = warehouse.lot_input_id.id
|
||||
elif product.supply_method == 'produce':
|
||||
@@ -228,14 +228,8 @@ class procurement_order(osv.osv):
|
||||
reste = qty % op.qty_multiple
|
||||
if reste > 0:
|
||||
qty += op.qty_multiple - reste
|
||||
newdate = DateTime.now() + DateTime.RelativeDateTime(
|
||||
newdate = datetime.today() + relativedelta(
|
||||
days = int(op.product_id.seller_delay))
|
||||
if op.product_id.supply_method == 'buy':
|
||||
location_id = op.warehouse_id.lot_input_id
|
||||
elif op.product_id.supply_method == 'produce':
|
||||
location_id = op.warehouse_id.lot_stock_id
|
||||
else:
|
||||
continue
|
||||
if qty <= 0:
|
||||
continue
|
||||
if op.product_id.type not in ('consu'):
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data noupdate="0">
|
||||
|
||||
<record model="ir.rule" id="procurement_rule">
|
||||
<field name="name">procurement multi-company</field>
|
||||
<field name="model_id" search="[('model','=','procurement.order')]" model="ir.model"/>
|
||||
<field name="global" eval="True"/>
|
||||
<field name="domain_force">['|',('company_id','child_of',[user.company_id.id]),('company_id','=',False)]</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.rule" id="stock_warehouse_orderpoint_rule">
|
||||
<field name="name">stock_warehouse.orderpoint multi-company</field>
|
||||
<field name="model_id" search="[('model','=','stock.warehouse.orderpoint')]" model="ir.model"/>
|
||||
<field name="global" eval="True"/>
|
||||
<field name="domain_force">['|',('company_id','child_of',[user.company_id.id]),('company_id','=',False)]</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
<data noupdate="0">
|
||||
|
||||
<record model="ir.rule" id="procurement_rule">
|
||||
<field name="name">procurement multi-company</field>
|
||||
<field name="model_id" search="[('model','=','procurement.order')]" model="ir.model"/>
|
||||
<field name="global" eval="True"/>
|
||||
<field name="domain_force">['|',('company_id','child_of',[user.company_id.id]),('company_id','=',False)]</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.rule" id="stock_warehouse_orderpoint_rule">
|
||||
<field name="name">stock_warehouse.orderpoint multi-company</field>
|
||||
<field name="model_id" search="[('model','=','stock.warehouse.orderpoint')]" model="ir.model"/>
|
||||
<field name="global" eval="True"/>
|
||||
<field name="domain_force">['|',('company_id','child_of',[user.company_id.id]),('company_id','=',False)]</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -126,161 +126,6 @@ class product_pricelist(osv.osv):
|
||||
"currency_id": _get_currency
|
||||
}
|
||||
|
||||
def price_get_multi_old(self, cr, uid, product_map, context=None):
|
||||
"""multi products 'price_get'
|
||||
@param context: {
|
||||
'date': Date of the pricelist (%Y-%m-%d),
|
||||
@return: a dict with product_id as key and the product price as value
|
||||
}
|
||||
"""
|
||||
|
||||
def _create_parent_category_list(id, lst):
|
||||
if not id:
|
||||
return []
|
||||
parent = product_category_tree.get(id)
|
||||
if parent:
|
||||
lst.append(parent)
|
||||
return _create_parent_category_list(parent, lst)
|
||||
else:
|
||||
return lst
|
||||
# _create_parent_category_list
|
||||
|
||||
context = context or {}
|
||||
|
||||
# XXX
|
||||
date = time.strftime('%Y-%m-%d')
|
||||
if 'date' in context:
|
||||
date = context['date']
|
||||
|
||||
currency_obj = self.pool.get('res.currency')
|
||||
product_obj = self.pool.get('product.product')
|
||||
product_category_obj = self.pool.get('product.category')
|
||||
product_uom_obj = self.pool.get('product.uom')
|
||||
supplierinfo_obj = self.pool.get('product.supplierinfo')
|
||||
price_type_obj = self.pool.get('product.price.type')
|
||||
product_pricelist_version_obj = self.pool.get('product.pricelist.version')
|
||||
|
||||
# product.pricelist.version:
|
||||
pricelist_version_ids = list(set([k[1] for k in product_map.keys()]))
|
||||
plversions_search_args = [
|
||||
('pricelist_id', 'in', pricelist_version_ids),
|
||||
'|',
|
||||
('date_start', '=', False),
|
||||
('date_start', '<=', date),
|
||||
'|',
|
||||
('date_end', '=', False),
|
||||
('date_end', '>=', date),
|
||||
]
|
||||
|
||||
plversion_ids = product_pricelist_version_obj.search(cr, uid, plversions_search_args)
|
||||
if len(pricelist_version_ids) != len(plversion_ids):
|
||||
msg = "At least one pricelist has no active version !\nPlease create or activate one."
|
||||
raise osv.except_osv(_('Warning !'), _(msg))
|
||||
|
||||
# product.product:
|
||||
product_ids = list(set([k[0] for k in product_map.keys()]))
|
||||
products = dict([(item['id'], item) for item in product_obj.read(cr, uid, product_ids, ['categ_id', 'product_tmpl_id', 'uos_id', 'uom_id'])])
|
||||
|
||||
# product.category:
|
||||
product_category_ids = product_category_obj.search(cr, uid, [])
|
||||
product_categories = product_category_obj.read(cr, uid, product_category_ids, ['parent_id'])
|
||||
product_category_tree = dict([(item['id'], item['parent_id'][0]) for item in product_categories if item['parent_id']])
|
||||
|
||||
results = {}
|
||||
for (product_id, pricelist_id), line in product_map.items():
|
||||
price = False
|
||||
|
||||
partner = line['partner_id']
|
||||
qty = line['qty']
|
||||
tmpl_id = products[product_id]['product_tmpl_id'] and products[product_id]['product_tmpl_id'][0] or False
|
||||
|
||||
categ_id = products[product_id]['categ_id'] and products[product_id]['categ_id'][0] or False
|
||||
categ_ids = _create_parent_category_list(categ_id, [categ_id])
|
||||
if categ_ids:
|
||||
categ_where = '(categ_id IN (' + ','.join(map(str, categ_ids)) + '))'
|
||||
else:
|
||||
categ_where = '(categ_id IS NULL)'
|
||||
|
||||
cr.execute(
|
||||
'SELECT i.*, pl.currency_id '
|
||||
'FROM product_pricelist_item AS i, '
|
||||
'product_pricelist_version AS v, product_pricelist AS pl '
|
||||
'WHERE (product_tmpl_id IS NULL OR product_tmpl_id = %s) '
|
||||
'AND (product_id IS NULL OR product_id = %s) '
|
||||
'AND (' + categ_where + ' OR (categ_id IS NULL)) '
|
||||
'AND price_version_id = %s '
|
||||
'AND (min_quantity IS NULL OR min_quantity <= %s) '
|
||||
'AND i.price_version_id = v.id AND v.pricelist_id = pl.id '
|
||||
'ORDER BY sequence',
|
||||
(tmpl_id, product_id, pricelist_id, qty))
|
||||
res1 = cr.dictfetchall()
|
||||
|
||||
for res in res1:
|
||||
if res:
|
||||
if res['base'] == -1:
|
||||
if not res['base_pricelist_id']:
|
||||
price = 0.0
|
||||
else:
|
||||
price_tmp = self.price_get(cr, uid,
|
||||
[res['base_pricelist_id']], product_id,
|
||||
qty)[res['base_pricelist_id']]
|
||||
ptype_src = self.browse(cr, uid, res['base_pricelist_id']).currency_id.id
|
||||
price = currency_obj.compute(cr, uid, ptype_src, res['currency_id'], price_tmp, round=False)
|
||||
break
|
||||
elif res['base'] == -2:
|
||||
# this section could be improved by moving the queries outside the loop:
|
||||
where = []
|
||||
if partner:
|
||||
where = [('name', '=', partner) ]
|
||||
sinfo = supplierinfo_obj.search(cr, uid,
|
||||
[('product_id', '=', tmpl_id)] + where)
|
||||
price = 0.0
|
||||
if sinfo:
|
||||
cr.execute('SELECT * ' \
|
||||
'FROM pricelist_partnerinfo ' \
|
||||
'WHERE suppinfo_id IN %s' \
|
||||
'AND min_quantity <= %s ' \
|
||||
'ORDER BY min_quantity DESC LIMIT 1', (tuple(sinfo),qty,))
|
||||
res2 = cr.dictfetchone()
|
||||
if res2:
|
||||
price = res2['price']
|
||||
break
|
||||
else:
|
||||
price_type = price_type_obj.browse(cr, uid, int(res['base']))
|
||||
price = currency_obj.compute(cr, uid,
|
||||
price_type.currency_id.id, res['currency_id'],
|
||||
product_obj.price_get(cr, uid, [product_id],
|
||||
price_type.field)[product_id], round=False, context=context)
|
||||
|
||||
if price:
|
||||
price_limit = price
|
||||
|
||||
price = price * (1.0+(res['price_discount'] or 0.0))
|
||||
price = rounding(price, res['price_round'])
|
||||
price += (res['price_surcharge'] or 0.0)
|
||||
if res['price_min_margin']:
|
||||
price = max(price, price_limit+res['price_min_margin'])
|
||||
if res['price_max_margin']:
|
||||
price = min(price, price_limit+res['price_max_margin'])
|
||||
break
|
||||
|
||||
else:
|
||||
# False means no valid line found ! But we may not raise an
|
||||
# exception here because it breaks the search
|
||||
price = False
|
||||
|
||||
if price:
|
||||
p_uom_id = products[product_id]['uos_id'] and products[product_id]['uos_id'][0] or products[product_id]['uom_id'] and products[product_id]['uom_id'][0] or False
|
||||
if p_uom_id:
|
||||
price = product_uom_obj._compute_price(cr, uid, p_uom_id, price, context.get('uom', False))
|
||||
|
||||
if results.get(product_id):
|
||||
results[product_id][pricelist_id] = price
|
||||
else:
|
||||
results[product_id] = {pricelist_id: price}
|
||||
|
||||
return results
|
||||
|
||||
#def price_get_multi(self, cr, uid, product_ids, context=None):
|
||||
def price_get_multi(self, cr, uid, pricelist_ids, products_by_qty_by_partner, context=None):
|
||||
"""multi products 'price_get'.
|
||||
@@ -392,7 +237,6 @@ class product_pricelist(osv.osv):
|
||||
qty)[res['base_pricelist_id']]
|
||||
ptype_src = self.browse(cr, uid, res['base_pricelist_id']).currency_id.id
|
||||
price = currency_obj.compute(cr, uid, ptype_src, res['currency_id'], price_tmp, round=False)
|
||||
break
|
||||
elif res['base'] == -2:
|
||||
# this section could be improved by moving the queries outside the loop:
|
||||
where = []
|
||||
@@ -410,7 +254,6 @@ class product_pricelist(osv.osv):
|
||||
res2 = cr.dictfetchone()
|
||||
if res2:
|
||||
price = res2['price']
|
||||
break
|
||||
else:
|
||||
price_type = price_type_obj.browse(cr, uid, int(res['base']))
|
||||
price = currency_obj.compute(cr, uid,
|
||||
|
||||
@@ -254,7 +254,7 @@
|
||||
<field name="domain">[('parent_id','=',False)]</field>
|
||||
<field name="view_type">tree</field>
|
||||
<field name="view_id" ref="product_category_tree_view"/>
|
||||
<field name="help">Create and manage product categories you want to be maintained in the system. This allows you to classify your products according to your needs.</field>
|
||||
<field name="help">Here is a list of all your products classified by category. You can click on a category to get the list of all products linked to this category or to a child of this category.</field>
|
||||
</record>
|
||||
<menuitem
|
||||
action="product_category_action"
|
||||
|
||||
@@ -37,13 +37,7 @@
|
||||
<field name="model_id" ref="model_project_task"/>
|
||||
<field name="global" eval="True"/>
|
||||
<field name="domain_force">['|','|','|',('user_id','=',False),('user_id','=',user.id),('project_id.members','in', [user.id]),('project_id.user_id','=',user.id)]</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.rule" id="project_details_comp_rule">
|
||||
<field name="name" >Projects According to User</field>
|
||||
<field name="model_id" ref="model_project_project"/>
|
||||
<field name="groups" eval="[(6, 0, [ref('group_project_manager')])]"/>
|
||||
<field name="domain_force">[('user_id','=',user.id)]</field>
|
||||
<field name="groups" eval="[(4,ref('project.group_project_user'))]"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
|
||||
@@ -19,16 +19,13 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from mx import DateTime
|
||||
import time
|
||||
from datetime import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
from osv import osv, fields
|
||||
import netsvc
|
||||
import ir
|
||||
import pooler
|
||||
from tools import config
|
||||
from tools.translate import _
|
||||
import decimal_precision as dp
|
||||
from osv.orm import browse_record, browse_null
|
||||
@@ -391,8 +388,6 @@ class purchase_order(osv.osv):
|
||||
return False
|
||||
|
||||
def action_cancel(self, cr, uid, ids, context={}):
|
||||
ok = True
|
||||
purchase_order_line_obj = self.pool.get('purchase.order.line')
|
||||
for purchase in self.browse(cr, uid, ids):
|
||||
for pick in purchase.picking_ids:
|
||||
if pick.state not in ('draft','cancel'):
|
||||
@@ -691,7 +686,6 @@ class purchase_order_line(osv.osv):
|
||||
'product_uom': uom}}
|
||||
domain = {}
|
||||
|
||||
partner = self.pool.get('res.partner').browse(cr, uid, partner_id)
|
||||
taxes = self.pool.get('account.tax').browse(cr, uid,map(lambda x: x.id, prod.supplier_taxes_id))
|
||||
fpos = fiscal_position and self.pool.get('account.fiscal.position').browse(cr, uid, fiscal_position) or False
|
||||
res['value']['taxes_id'] = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, taxes)
|
||||
@@ -764,9 +758,8 @@ class procurement_order(osv.osv):
|
||||
|
||||
price = pricelist_obj.price_get(cr, uid, [pricelist_id], procurement.product_id.id, qty, False, {'uom': uom_id})[pricelist_id]
|
||||
|
||||
newdate = DateTime.strptime(procurement.date_planned, '%Y-%m-%d %H:%M:%S')
|
||||
newdate = newdate - DateTime.RelativeDateTime(days=company.po_lead)
|
||||
newdate = newdate - seller_delay
|
||||
newdate = datetime.strptime(procurement.date_planned, '%Y-%m-%d %H:%M:%S')
|
||||
newdate = (newdate - relativedelta(days=company.po_lead)) - relativedelta(days=seller_delay)
|
||||
|
||||
#Passing partner_id to context for purchase order line integrity of Line name
|
||||
context.update({'lang': partner.lang, 'partner_id': partner_id})
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</record>
|
||||
|
||||
<record model="ir.rule" id="purchase_requisition_comp_rule">
|
||||
<field name="name">Purchase Requisition multi-company</field>
|
||||
<field name="name">Purchase Requisition multi-company</field>
|
||||
<field name="model_id" ref="model_purchase_requisition"/>
|
||||
<field name="global" eval="True"/>
|
||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
from mx import DateTime
|
||||
|
||||
from datetime import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from osv import fields, osv
|
||||
from osv.orm import browse_record, browse_null
|
||||
|
||||
@@ -84,10 +84,10 @@ class purchase_requisition_partner(osv.osv_memory):
|
||||
partner_list = sorted([(partner.sequence, partner) for partner in line.product_id.seller_ids if partner])
|
||||
partner_rec = partner_list and partner_list[0] and partner_list[0][1] or False
|
||||
uom_id = line.product_id.uom_po_id and line.product_id.uom_po_id.id or False
|
||||
newdate = DateTime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S')
|
||||
newdate = newdate - DateTime.RelativeDateTime(days=company.po_lead)
|
||||
newdate = datetime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S')
|
||||
newdate = newdate - relativedelta(days=company.po_lead)
|
||||
delay = partner_rec and partner_rec.delay or False
|
||||
newdate = newdate -(delay or DateTime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S') )
|
||||
newdate = newdate -(delay or datetime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S') )
|
||||
partner = partner_rec and partner_rec.name or supplier_data
|
||||
pricelist_id = partner.property_product_pricelist_purchase and partner.property_product_pricelist_purchase.id or False
|
||||
price = pricelist_obj.price_get(cr, uid, [pricelist_id], line.product_id.id, line.product_qty, False, {'uom': uom_id})[pricelist_id]
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
##############################################################################
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
from mx import DateTime
|
||||
import math
|
||||
from faces import *
|
||||
from new import classobj
|
||||
@@ -113,7 +112,7 @@ class resource_calendar(osv.osv):
|
||||
results = {}
|
||||
|
||||
for d, hours, id in date_and_hours_by_cal:
|
||||
dt_from = DateTime.strptime(d, '%Y-%m-%d %H:%M:%S')
|
||||
dt_from = datetime.strptime(d, '%Y-%m-%d %H:%M:%S')
|
||||
if not id:
|
||||
td = int(hours)*3
|
||||
results[(d, hours, id)] = [(dt_from, dt_from + timedelta(hours=td))]
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Resource">
|
||||
<group col='15' colspan='4'>
|
||||
<filter string="Inactive" icon="terp-gdu-smart-failing" domain="[('active','=',False)]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="name"/>
|
||||
<field name="user_id" string="User"/>
|
||||
<field name="resource_type"/>
|
||||
@@ -168,13 +170,19 @@
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Resource">
|
||||
<field name="name" />
|
||||
<field name="user_id" attrs="{'required':[('resource_type','=','user')]}"/>
|
||||
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
|
||||
<field name="resource_type" />
|
||||
<field name="calendar_id" widget="selection"/>
|
||||
<field name="time_efficiency" groups="base.group_extended"/>
|
||||
<group colspan="4" col="6">
|
||||
<field name="name" colspan="4"/>
|
||||
<field name="active"/>
|
||||
<field name="resource_type" />
|
||||
<field name="user_id" attrs="{'required':[('resource_type','=','user')], 'readonly':[('resource_type','=','material')]}"/>
|
||||
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="General Information">
|
||||
<field name="calendar_id" widget="selection"/>
|
||||
<field name="time_efficiency" groups="base.group_extended"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -41,8 +41,7 @@
|
||||
sale_order_obj = self.pool.get('sale.order')
|
||||
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
|
||||
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
|
||||
if picking_id:
|
||||
assert picking_id,"There is a picking attached to this sale order"
|
||||
assert not picking_id,"As the order policy is prepaid, the sale order shouldn't have already a picking."
|
||||
-
|
||||
I open the Invoice for the SO.
|
||||
-
|
||||
|
||||
@@ -29,7 +29,7 @@ class stock_report_prodlots(osv.osv):
|
||||
_description = "Stock report by production lots"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'name': fields.float('Quantity', readonly=True),
|
||||
'qty': fields.float('Quantity', readonly=True),
|
||||
'location_id': fields.many2one('stock.location', 'Location', readonly=True, select=True),
|
||||
'product_id': fields.many2one('product.product', 'Product', readonly=True, select=True),
|
||||
'prodlot_id': fields.many2one('stock.production.lot', 'Production lot', readonly=True, select=True),
|
||||
@@ -43,7 +43,7 @@ class stock_report_prodlots(osv.osv):
|
||||
location_id,
|
||||
product_id,
|
||||
prodlot_id,
|
||||
sum(qty) as name
|
||||
sum(qty) as qty
|
||||
from (
|
||||
select -max(sm.id) as id,
|
||||
sm.location_id,
|
||||
|
||||
@@ -842,7 +842,6 @@ class stock_picking(osv.osv):
|
||||
""" Gets payment term from partner.
|
||||
@return: Payment term
|
||||
"""
|
||||
partner_obj = self.pool.get('res.partner')
|
||||
partner = picking.address_id.partner_id
|
||||
return partner.property_payment_term and partner.property_payment_term.id or False
|
||||
|
||||
@@ -1308,7 +1307,7 @@ class stock_production_lot(osv.osv):
|
||||
if locations:
|
||||
cr.execute('''select
|
||||
prodlot_id,
|
||||
sum(name)
|
||||
sum(qty)
|
||||
from
|
||||
stock_report_prodlots
|
||||
where
|
||||
@@ -1324,12 +1323,12 @@ class stock_production_lot(osv.osv):
|
||||
locations = self.pool.get('stock.location').search(cr, uid, [('usage', '=', 'internal')])
|
||||
cr.execute('''select
|
||||
prodlot_id,
|
||||
sum(name)
|
||||
sum(qty)
|
||||
from
|
||||
stock_report_prodlots
|
||||
where
|
||||
location_id IN %s group by prodlot_id
|
||||
having sum(name) '''+ str(args[0][1]) + str(args[0][2]),(tuple(locations),))
|
||||
having sum(qty) '''+ str(args[0][1]) + str(args[0][2]),(tuple(locations),))
|
||||
res = cr.fetchall()
|
||||
ids = [('id', 'in', map(lambda x: x[0], res))]
|
||||
return ids
|
||||
@@ -1809,7 +1808,6 @@ class stock_move(osv.osv):
|
||||
|
||||
def setlast_tracking(self, cr, uid, ids, context=None):
|
||||
tracking_obj = self.pool.get('stock.tracking')
|
||||
tracking = context.get('tracking', False)
|
||||
picking = self.browse(cr, uid, ids)[0].picking_id
|
||||
if picking:
|
||||
last_track = [line.tracking_id.id for line in picking.move_lines if line.tracking_id]
|
||||
@@ -2092,8 +2090,8 @@ class stock_move(osv.osv):
|
||||
'state': move.state,
|
||||
'scrapped' : True,
|
||||
'location_dest_id': location_id,
|
||||
'tracking_id':False,
|
||||
'prodlot_id':False
|
||||
'tracking_id': move.tracking_id.id,
|
||||
'prodlot_id': move.prodlot_id.id,
|
||||
}
|
||||
new_move = self.copy(cr, uid, move.id, default_val)
|
||||
|
||||
@@ -2395,7 +2393,6 @@ class stock_inventory(osv.osv):
|
||||
location_obj = self.pool.get('stock.location')
|
||||
for inv in self.browse(cr, uid, ids):
|
||||
move_ids = []
|
||||
move_line = []
|
||||
for line in inv.inventory_line_id:
|
||||
pid = line.product_id.id
|
||||
product_context.update(uom=line.product_uom.id)
|
||||
|
||||
@@ -71,24 +71,26 @@
|
||||
</field>
|
||||
<field name="path_ids" editable="bottom" colspan="4" nolabel="1">
|
||||
<field name="name"/>
|
||||
<tree string="Pushed flows" editable="bottom">
|
||||
<tree string="Pushed flows">
|
||||
<field name="location_from_id"/>
|
||||
<field name="location_dest_id"/>
|
||||
<field name="auto"/>
|
||||
<field name="delay"/>
|
||||
<field name="name"/>
|
||||
<field name="invoice_state"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
</tree>
|
||||
<form string="Pushed flows">
|
||||
<field name="location_from_id"/>
|
||||
<field name="location_dest_id"/>
|
||||
<field name="auto"/>
|
||||
<field name="delay"/>
|
||||
<field name="name"/>
|
||||
<group colspan="4" col="6">
|
||||
<field name="name"/>
|
||||
<field name="location_from_id"/>
|
||||
<field name="location_dest_id"/>
|
||||
<field name="auto"/>
|
||||
<field name="delay"/>
|
||||
<field name="journal_id" groups="base.group_extended"/>
|
||||
</group>
|
||||
<field name="picking_type"/>
|
||||
<field name="invoice_state"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
<field name="journal_id" groups="base.group_extended"/>
|
||||
</form>
|
||||
</field>
|
||||
</page>
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
# TODO:
|
||||
# Error treatment: exception, request, ... -> send request to user_id
|
||||
|
||||
from mx import DateTime
|
||||
import time
|
||||
from osv import fields,osv
|
||||
from tools.translate import _
|
||||
|
||||
Reference in New Issue
Block a user