[MERGE] merged the team 1 branch

bzr revid: qdp-launchpad@tinyerp.com-20101018122342-9rbds2y7qprzp7dr
This commit is contained in:
qdp-launchpad@tinyerp.com 2010-10-18 14:23:42 +02:00
commit 8144076ced
38 changed files with 435 additions and 196 deletions

View File

@ -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"/>

View File

@ -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:

View File

@ -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:

View File

@ -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 _

View File

@ -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)

View File

@ -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')

View File

@ -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:

View File

@ -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

View File

@ -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,

View File

@ -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"/>

View File

@ -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="['&amp;', ('date_planned::date','&lt;', 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>

View File

@ -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,

View File

@ -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>

View File

@ -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>

View File

@ -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})
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)

View File

@ -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)

View File

@ -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'],

View File

@ -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&gt;=current_date;red:date_planned&lt;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&gt;=current_date;red:date_planned&lt;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 -->

View File

@ -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:

View File

@ -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:

View File

@ -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>

View File

@ -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

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
7 access_mrp_production_manager mrp_production_manager model_mrp_production mrp.group_mrp_manager 1 0 0 0
8 access_mrp_production_workcenter_line mrp.production.workcenter.line mrp.model_mrp_production_workcenter_line mrp.group_mrp_user 1 1 1 1
9 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
10 access_mrp_workorder_manager mrp.workorder.manager model_mrp_workorder mrp.group_mrp_manager 1 1 1 1

View File

@ -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

View File

@ -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()

View File

@ -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:

View File

@ -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,

View File

@ -20,7 +20,6 @@
##############################################################################
import time
from datetime import datetime
from report import report_sxw

View File

@ -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

View File

@ -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):

View File

@ -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

View File

@ -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'):

View File

@ -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})

View File

@ -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]

View File

@ -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))]

View File

@ -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>

View File

@ -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,

View File

@ -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]
@ -2093,7 +2091,7 @@ class stock_move(osv.osv):
'scrapped' : True,
'location_dest_id': location_id,
'tracking_id':False,
'prodlot_id':False
'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)

View File

@ -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 _