[MERGE] merge from trunk addons
bzr revid: mra@mra-laptop-20101021043001-s0f3f217o9vcp783
This commit is contained in:
commit
23065b08de
|
@ -824,7 +824,7 @@ class account_invoice(osv.osv):
|
|||
total_fixed += line.value_amount
|
||||
if line.value == 'procent':
|
||||
total_percent += line.value_amount
|
||||
total_fixed = (total_fixed * 100) / inv.amount_total
|
||||
total_fixed = (total_fixed * 100) / (inv.amount_total or 1.0)
|
||||
if (total_fixed + total_percent) > 100:
|
||||
raise osv.except_osv(_('Error !'), _("Cannot create the invoice !\nThe payment term defined gives a computed amount greater than the total invoiced amount."))
|
||||
|
||||
|
|
|
@ -79,9 +79,9 @@ class account_fiscalyear_close(osv.osv_memory):
|
|||
if not new_journal.default_credit_account_id or not new_journal.default_debit_account_id:
|
||||
raise osv.except_osv(_('UserError'),
|
||||
_('The journal must have default credit and debit account'))
|
||||
if not new_journal.centralisation:
|
||||
if (not new_journal.centralisation) or new_journal.entry_posted:
|
||||
raise osv.except_osv(_('UserError'),
|
||||
_('The journal must have centralised counterpart'))
|
||||
_('The journal must have centralised counterpart without the Skipping draft state option checked!'))
|
||||
|
||||
move_ids = obj_acc_move_line.search(cr, uid, [
|
||||
('journal_id', '=', new_journal.id), ('period_id.fiscalyear_id', '=', new_fyear.id)])
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<field name="arch" type="xml">
|
||||
<form string="Validate Account Entries">
|
||||
<separator string="Validate Journal Entries of a Journal" colspan="4"/>
|
||||
<label string="All draft account entries in this journal and period will be validated. It means you won't be able to modify their accouting fields." colspan="4"/>
|
||||
<label string="All draft account entries in this journal and period will be validated. It means you won't be able to modify their accounting fields." colspan="4"/>
|
||||
<field name="journal_id"/>
|
||||
<newline/>
|
||||
<field name="period_id"/>
|
||||
|
@ -49,7 +49,7 @@
|
|||
<form string="Validate Journal Entries">
|
||||
<separator string="Post Journal Entries" colspan="4"/>
|
||||
<image name="terp-referer"/>
|
||||
<label string="All selected journal entries will be validated and posted. It means you won't be able to modify their accouting fields." colspan="2"/>
|
||||
<label string="All selected journal entries will be validated and posted. It means you won't be able to modify their accounting fields." colspan="2"/>
|
||||
<separator colspan="4"/>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
|
|
|
@ -110,6 +110,7 @@ class crossovered_budget_lines(osv.osv):
|
|||
|
||||
def _prac_amt(self, cr, uid, ids, context={}):
|
||||
res = {}
|
||||
result = 0.0
|
||||
for line in self.browse(cr, uid, ids):
|
||||
acc_ids = [x.id for x in line.general_budget_id.account_ids]
|
||||
if not acc_ids:
|
||||
|
@ -120,10 +121,11 @@ class crossovered_budget_lines(osv.osv):
|
|||
date_from = context['wizard_date_from']
|
||||
if context.has_key('wizard_date_to'):
|
||||
date_to = context['wizard_date_to']
|
||||
cr.execute("SELECT SUM(amount) FROM account_analytic_line WHERE account_id=%s AND (date "
|
||||
if line.analytic_account_id.id:
|
||||
cr.execute("SELECT SUM(amount) FROM account_analytic_line WHERE account_id=%s AND (date "
|
||||
"between to_date(%s,'yyyy-mm-dd') AND to_date(%s,'yyyy-mm-dd')) AND "
|
||||
"general_account_id=ANY(%s)", (line.analytic_account_id.id, date_from, date_to,acc_ids,))
|
||||
result = cr.fetchone()[0]
|
||||
result = cr.fetchone()[0]
|
||||
if result is None:
|
||||
result = 0.00
|
||||
res[line.id] = result
|
||||
|
|
|
@ -131,6 +131,7 @@
|
|||
<field name="date_to"/>
|
||||
<field name="paid_date" select="1"/>
|
||||
<field name="planned_amount" select="1"/>
|
||||
<field name="analytic_account_id"/>
|
||||
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
|
||||
</form>
|
||||
</field>
|
||||
|
|
|
@ -124,7 +124,7 @@ 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=(parser.parse(datetime.date.today().strftime('%Y-%m-%d'))+ relativedelta(months=+evaluation_plan.month_first)).strftime('%Y-%m-%d')
|
||||
evaluation_date=(parser.parse(datetime.now().strftime('%Y-%m-%d'))+ relativedelta(months=+evaluation_plan.month_first)).strftime('%Y-%m-%d')
|
||||
flag = True
|
||||
else:
|
||||
if (parser.parse(evaluation_date) + relativedelta(months = int(evaluation_plan.month_next))).strftime('%Y-%m-%d') <= time.strftime("%Y-%m-%d"):
|
||||
|
|
|
@ -319,7 +319,7 @@ class hr_timesheet_sheet(osv.osv):
|
|||
if r=='month':
|
||||
return time.strftime('%Y-%m-01')
|
||||
elif r=='week':
|
||||
return (datetime.today() + relativedelta(weekday=0)).strftime('%Y-%m-%d')
|
||||
return (datetime.today() + relativedelta(weekday=0, weeks=-1)).strftime('%Y-%m-%d')
|
||||
elif r=='year':
|
||||
return time.strftime('%Y-01-01')
|
||||
return time.strftime('%Y-%m-%d')
|
||||
|
|
|
@ -10,11 +10,12 @@
|
|||
<field eval="time.strftime('%Y-%m-%d', time.localtime(time.mktime(time.localtime()[0:2] + (0,)*7)-1))" name="date_to"/>
|
||||
</record>
|
||||
|
||||
<!-- record id="sheet1" model="hr_timesheet_sheet.sheet">
|
||||
<record id="sheet1" model="hr_timesheet_sheet.sheet">
|
||||
<field name="name">Sheet 1</field>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="employee_id" ref="hr.employee1" />
|
||||
<field eval="time.strftime('%Y-%m-%d')" name="date_current"/>
|
||||
</record-->
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -350,48 +350,6 @@ def rounding(f, r):
|
|||
return f
|
||||
return round(f / r) * r
|
||||
|
||||
class many2many_domain(fields.many2many):
|
||||
def set(self, cr, obj, id, name, values, user=None, context=None):
|
||||
return super(many2many_domain, self).set(cr, obj, id, name, values, user=user,
|
||||
context=context)
|
||||
|
||||
def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None):
|
||||
if not context:
|
||||
context = {}
|
||||
|
||||
move_obj = obj.pool.get('stock.move')
|
||||
res = {}
|
||||
for i in ids:
|
||||
res[i] = []
|
||||
valid_move_ids = move_obj.search(cr, user, self._domain) # move ids relative to domain argument
|
||||
if valid_move_ids:
|
||||
cr.execute("SELECT production_id, move_id from mrp_production_move_ids where production_id in %s and move_id in %s",
|
||||
[tuple(ids), tuple(valid_move_ids)])
|
||||
related_move_map = cr.fetchall()
|
||||
related_move_dict = dict((k, list(set([v[1] for v in itr]))) for k, itr in groupby(related_move_map, itemgetter(0)))
|
||||
res.update(related_move_dict)
|
||||
|
||||
return res
|
||||
|
||||
class one2many_domain(fields.one2many):
|
||||
def set(self, cr, obj, id, field, values, user=None, context=None):
|
||||
return super(one2many_domain, self).set(cr, obj, id, field, values,
|
||||
user=user, context=context)
|
||||
|
||||
def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None):
|
||||
if not context:
|
||||
context = {}
|
||||
|
||||
move_obj = obj.pool.get('stock.move')
|
||||
res = {}
|
||||
for i in ids:
|
||||
res[i] = []
|
||||
move_ids = move_obj.search(cr, user, self._domain+[('production_id', 'in', tuple(ids))], context=context)
|
||||
related_move_dict = dict([(o.production_id.id, [o.id]) for o in move_obj.browse(cr, user, move_ids, context=context)])
|
||||
res.update(related_move_dict)
|
||||
|
||||
return res
|
||||
|
||||
class mrp_production(osv.osv):
|
||||
"""
|
||||
Production Orders / Manufacturing Orders
|
||||
|
@ -467,10 +425,10 @@ class mrp_production(osv.osv):
|
|||
'picking_id': fields.many2one('stock.picking', 'Picking list', readonly=True,
|
||||
help="This is the internal picking list that brings the finished product to the production plan"),
|
||||
'move_prod_id': fields.many2one('stock.move', 'Move product', readonly=True),
|
||||
'move_lines': many2many_domain('stock.move', 'mrp_production_move_ids', 'production_id', 'move_id', 'Products to Consume', domain=[('state','not in', ('done', 'cancel'))], states={'done':[('readonly',True)]}),
|
||||
'move_lines2': many2many_domain('stock.move', 'mrp_production_move_ids', 'production_id', 'move_id', 'Consumed Products', domain=[('state','in', ('done', 'cancel'))]),
|
||||
'move_created_ids': one2many_domain('stock.move', 'production_id', 'Moves Created', domain=[('state','not in', ('done', 'cancel'))], states={'done':[('readonly',True)]}),
|
||||
'move_created_ids2': one2many_domain('stock.move', 'production_id', 'Moves Created', domain=[('state','in', ('done', 'cancel'))]),
|
||||
'move_lines': fields.many2many('stock.move', 'mrp_production_move_ids', 'production_id', 'move_id', 'Products to Consume', domain=[('state','not in', ('done', 'cancel'))], states={'done':[('readonly',True)]}),
|
||||
'move_lines2': fields.many2many('stock.move', 'mrp_production_move_ids', 'production_id', 'move_id', 'Consumed Products', domain=[('state','in', ('done', 'cancel'))]),
|
||||
'move_created_ids': fields.one2many('stock.move', 'production_id', 'Moves Created', domain=[('state','not in', ('done', 'cancel'))], states={'done':[('readonly',True)]}),
|
||||
'move_created_ids2': fields.one2many('stock.move', 'production_id', 'Moves Created', domain=[('state','in', ('done', 'cancel'))]),
|
||||
'product_lines': fields.one2many('mrp.production.product.line', 'production_id', 'Scheduled goods'),
|
||||
'workcenter_lines': fields.one2many('mrp.production.workcenter.line', 'production_id', 'Work Centers Utilisation'),
|
||||
'state': fields.selection([('draft','Draft'),('picking_except', 'Picking Exception'),('confirmed','Waiting Goods'),('ready','Ready to Produce'),('in_production','In Production'),('cancel','Cancelled'),('done','Done')],'State', readonly=True,
|
||||
|
@ -745,7 +703,7 @@ class mrp_production(osv.osv):
|
|||
if rest_qty <= production_qty:
|
||||
production_qty = rest_qty
|
||||
if rest_qty > 0 :
|
||||
stock_mov_obj.action_consume(cr, uid, [produce_product.id], production_qty, production.location_dest_id.id, context=context)
|
||||
stock_mov_obj.action_consume(cr, uid, [produce_product.id], production_qty, context=context)
|
||||
|
||||
for raw_product in production.move_lines2:
|
||||
new_parent_ids = []
|
||||
|
|
|
@ -86,21 +86,26 @@ class purchase_requisition_partner(osv.osv_memory):
|
|||
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 - 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') )
|
||||
delay = partner_rec and partner_rec.delay or 0.0
|
||||
newdate = newdate -(delay and relativedelta(days=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]
|
||||
product = prod_obj.browse(cr, uid, line.product_id.id, context=context)
|
||||
location_id = self.pool.get('stock.warehouse').read(cr, uid, [tender.warehouse_id.id], ['lot_input_id'])[0]['lot_input_id'][0]
|
||||
|
||||
if not newdate:
|
||||
date_planned = datetime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S')
|
||||
else:
|
||||
date_planned = newdate.strftime('%Y-%m-%d %H:%M:%S')
|
||||
|
||||
purchase_order_line= {
|
||||
'name': product.partner_ref,
|
||||
'product_qty': line.product_qty,
|
||||
'product_id': line.product_id.id,
|
||||
'product_uom': uom_id,
|
||||
'price_unit': price,
|
||||
'date_planned': newdate.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'date_planned': date_planned,
|
||||
'notes': product.description_purchase,
|
||||
}
|
||||
taxes_ids = line.product_id.product_tmpl_id.supplier_taxes_id
|
||||
|
|
|
@ -2215,7 +2215,7 @@ class stock_move(osv.osv):
|
|||
'product_qty': quantity,
|
||||
'product_uos_qty': uos_qty,
|
||||
'state': move.state,
|
||||
'location_id': location_id
|
||||
'location_id': location_id or move.location_id.id,
|
||||
}
|
||||
if move.product_id.track_production and location_id:
|
||||
# IF product has checked track for production lot, move lines will be split by 1
|
||||
|
@ -2238,9 +2238,8 @@ class stock_move(osv.osv):
|
|||
update_val = {
|
||||
'product_qty' : quantity_rest,
|
||||
'product_uos_qty' : uos_qty_rest,
|
||||
'location_id': location_id
|
||||
'location_id': location_id or move.location_id.id
|
||||
}
|
||||
|
||||
self.write(cr, uid, [move.id], update_val)
|
||||
|
||||
product_obj = self.pool.get('product.product')
|
||||
|
|
Loading…
Reference in New Issue