[MERGE] forward port of branch 7.0 up to a218a9e
This commit is contained in:
commit
5bd0249515
|
@ -47,19 +47,11 @@ class account_invoice_line(osv.osv):
|
||||||
if inv.type in ('out_invoice','out_refund'):
|
if inv.type in ('out_invoice','out_refund'):
|
||||||
for i_line in inv.invoice_line:
|
for i_line in inv.invoice_line:
|
||||||
if i_line.product_id and i_line.product_id.valuation == 'real_time':
|
if i_line.product_id and i_line.product_id.valuation == 'real_time':
|
||||||
if inv.type == 'out_invoice':
|
# debit account dacc will be the output account
|
||||||
# debit account dacc will be the output account
|
# first check the product, if empty check the category
|
||||||
# first check the product, if empty check the category
|
dacc = i_line.product_id.property_stock_account_output and i_line.product_id.property_stock_account_output.id
|
||||||
dacc = i_line.product_id.property_stock_account_output and i_line.product_id.property_stock_account_output.id
|
if not dacc:
|
||||||
if not dacc:
|
dacc = i_line.product_id.categ_id.property_stock_account_output_categ and i_line.product_id.categ_id.property_stock_account_output_categ.id
|
||||||
dacc = i_line.product_id.categ_id.property_stock_account_output_categ and i_line.product_id.categ_id.property_stock_account_output_categ.id
|
|
||||||
else:
|
|
||||||
# = out_refund
|
|
||||||
# debit account dacc will be the input account
|
|
||||||
# first check the product, if empty check the category
|
|
||||||
dacc = i_line.product_id.property_stock_account_input and i_line.product_id.property_stock_account_input.id
|
|
||||||
if not dacc:
|
|
||||||
dacc = i_line.product_id.categ_id.property_stock_account_input_categ and i_line.product_id.categ_id.property_stock_account_input_categ.id
|
|
||||||
# in both cases the credit account cacc will be the expense account
|
# in both cases the credit account cacc will be the expense account
|
||||||
# first check the product, if empty check the category
|
# first check the product, if empty check the category
|
||||||
cacc = i_line.product_id.property_account_expense and i_line.product_id.property_account_expense.id
|
cacc = i_line.product_id.property_account_expense and i_line.product_id.property_account_expense.id
|
||||||
|
@ -102,19 +94,12 @@ class account_invoice_line(osv.osv):
|
||||||
# if not found on the product get the price difference account at the category
|
# if not found on the product get the price difference account at the category
|
||||||
acc = i_line.product_id.categ_id.property_account_creditor_price_difference_categ and i_line.product_id.categ_id.property_account_creditor_price_difference_categ.id
|
acc = i_line.product_id.categ_id.property_account_creditor_price_difference_categ and i_line.product_id.categ_id.property_account_creditor_price_difference_categ.id
|
||||||
a = None
|
a = None
|
||||||
if inv.type == 'in_invoice':
|
|
||||||
# oa will be the stock input account
|
# oa will be the stock input account
|
||||||
# first check the product, if empty check the category
|
# first check the product, if empty check the category
|
||||||
oa = i_line.product_id.property_stock_account_input and i_line.product_id.property_stock_account_input.id
|
oa = i_line.product_id.property_stock_account_input and i_line.product_id.property_stock_account_input.id
|
||||||
if not oa:
|
if not oa:
|
||||||
oa = i_line.product_id.categ_id.property_stock_account_input_categ and i_line.product_id.categ_id.property_stock_account_input_categ.id
|
oa = i_line.product_id.categ_id.property_stock_account_input_categ and i_line.product_id.categ_id.property_stock_account_input_categ.id
|
||||||
else:
|
|
||||||
# = in_refund
|
|
||||||
# oa will be the stock output account
|
|
||||||
# first check the product, if empty check the category
|
|
||||||
oa = i_line.product_id.property_stock_account_output and i_line.product_id.property_stock_account_output.id
|
|
||||||
if not oa:
|
|
||||||
oa = i_line.product_id.categ_id.property_stock_account_output_categ and i_line.product_id.categ_id.property_stock_account_output_categ.id
|
|
||||||
if oa:
|
if oa:
|
||||||
# get the fiscal position
|
# get the fiscal position
|
||||||
fpos = i_line.invoice_id.fiscal_position or False
|
fpos = i_line.invoice_id.fiscal_position or False
|
||||||
|
|
|
@ -105,7 +105,10 @@ class hr_timesheet_sheet(osv.osv):
|
||||||
for att_tuple in attendance_tuples:
|
for att_tuple in attendance_tuples:
|
||||||
if att_tuple[0] in [0,1,4]:
|
if att_tuple[0] in [0,1,4]:
|
||||||
if att_tuple[0] in [0,1]:
|
if att_tuple[0] in [0,1]:
|
||||||
name = att_tuple[2]['name']
|
if att_tuple[2] and att_tuple[2].has_key('name'):
|
||||||
|
name = att_tuple[2]['name']
|
||||||
|
else:
|
||||||
|
name = self.pool['hr.attendance'].browse(cr, uid, att_tuple[1]).name
|
||||||
else:
|
else:
|
||||||
name = self.pool['hr.attendance'].browse(cr, uid, att_tuple[1]).name
|
name = self.pool['hr.attendance'].browse(cr, uid, att_tuple[1]).name
|
||||||
date_attendances.append((1, name, att_tuple))
|
date_attendances.append((1, name, att_tuple))
|
||||||
|
|
|
@ -645,6 +645,10 @@ class purchase_order(osv.osv):
|
||||||
|
|
||||||
def _prepare_order_line_move(self, cr, uid, order, order_line, picking_id, context=None):
|
def _prepare_order_line_move(self, cr, uid, order, order_line, picking_id, context=None):
|
||||||
''' prepare the stock move data from the PO line '''
|
''' prepare the stock move data from the PO line '''
|
||||||
|
price_unit = order_line.price_unit
|
||||||
|
if order.currency_id.id != order.company_id.currency_id.id:
|
||||||
|
#we don't round the price_unit, as we may want to store the standard price with more digits than allowed by the currency
|
||||||
|
price_unit = self.pool.get('res.currency').compute(cr, uid, order.currency_id.id, order.company_id.currency_id.id, price_unit, round=False, context=context)
|
||||||
return {
|
return {
|
||||||
'name': order_line.name or '',
|
'name': order_line.name or '',
|
||||||
'product_id': order_line.product_id.id,
|
'product_id': order_line.product_id.id,
|
||||||
|
@ -663,7 +667,7 @@ class purchase_order(osv.osv):
|
||||||
'type':'in',
|
'type':'in',
|
||||||
'purchase_line_id': order_line.id,
|
'purchase_line_id': order_line.id,
|
||||||
'company_id': order.company_id.id,
|
'company_id': order.company_id.id,
|
||||||
'price_unit': order_line.price_unit
|
'price_unit': price_unit
|
||||||
}
|
}
|
||||||
|
|
||||||
def _create_pickings(self, cr, uid, order, order_lines, picking_id=False, context=None):
|
def _create_pickings(self, cr, uid, order, order_lines, picking_id=False, context=None):
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
from openerp.osv import fields, osv
|
from openerp.osv import fields, osv
|
||||||
|
from openerp.tools.translate import _
|
||||||
|
|
||||||
class stock_move(osv.osv):
|
class stock_move(osv.osv):
|
||||||
_inherit = 'stock.move'
|
_inherit = 'stock.move'
|
||||||
|
@ -126,11 +127,30 @@ class stock_partial_picking(osv.osv_memory):
|
||||||
# Overridden to inject the purchase price as true 'cost price' when processing
|
# Overridden to inject the purchase price as true 'cost price' when processing
|
||||||
# incoming pickings.
|
# incoming pickings.
|
||||||
def _product_cost_for_average_update(self, cr, uid, move):
|
def _product_cost_for_average_update(self, cr, uid, move):
|
||||||
if move.picking_id.purchase_id and move.purchase_line_id:
|
if move.purchase_line_id and move.purchase_line_id and move.purchase_line_id.invoice_lines:
|
||||||
return {'cost': move.purchase_line_id.price_unit,
|
cost = move.price_unit
|
||||||
'currency': move.picking_id.purchase_id.currency_id.id}
|
for inv_line in move.purchase_line_id.invoice_lines:
|
||||||
|
if inv_line.invoice_id.state not in ('draft', 'cancel'):
|
||||||
|
inv_currency = inv_line.invoice_id.currency_id.id
|
||||||
|
company_currency = inv_line.invoice_id.company_id.currency_id.id
|
||||||
|
cost = self.pool.get('res.currency').compute(cr, uid, inv_currency, company_currency, inv_line.price_unit, round=False, context={'date': inv_line.invoice_id.date_invoice})
|
||||||
|
return {'cost': cost, 'currency': company_currency}
|
||||||
return super(stock_partial_picking, self)._product_cost_for_average_update(cr, uid, move)
|
return super(stock_partial_picking, self)._product_cost_for_average_update(cr, uid, move)
|
||||||
|
|
||||||
|
def __get_help_text(self, cursor, user, picking_id, context=None):
|
||||||
|
picking = self.pool.get('stock.picking').browse(cursor, user, picking_id, context=context)
|
||||||
|
if picking.purchase_id:
|
||||||
|
text = _("The proposed cost is made based on %s")
|
||||||
|
value = _("Purchase Order %s") % picking.purchase_id.name
|
||||||
|
if picking.purchase_id.pricelist_id.currency_id != picking.purchase_id.company_id.currency_id:
|
||||||
|
value += _(" (currency rate of purchase order taken)")
|
||||||
|
if any([x.state not in ('draft', 'cancel') for x in picking.purchase_id.invoice_ids]):
|
||||||
|
value = _("Invoices made on Purchase Order %s") % (picking.purchase_id.name)
|
||||||
|
if picking.purchase_id.pricelist_id.currency_id != picking.purchase_id.company_id.currency_id:
|
||||||
|
value += _(" (currency rate of invoices taken)")
|
||||||
|
return text % value
|
||||||
|
return super(stock_partial_picking, self).__get_help_text(cursor, user, picking_id, context=context)
|
||||||
|
|
||||||
# Redefinition of the new field in order to update the model stock.picking.in in the orm
|
# Redefinition of the new field in order to update the model stock.picking.in in the orm
|
||||||
# FIXME: this is a temporary workaround because of a framework bug (ref: lp996816). It should be removed as soon as
|
# FIXME: this is a temporary workaround because of a framework bug (ref: lp996816). It should be removed as soon as
|
||||||
# the bug is fixed
|
# the bug is fixed
|
||||||
|
|
|
@ -75,11 +75,23 @@ class stock_partial_picking(osv.osv_memory):
|
||||||
res[wizard.id] = any([not(x.tracking) for x in wizard.move_ids])
|
res[wizard.id] = any([not(x.tracking) for x in wizard.move_ids])
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
def __get_help_text(self, cursor, user, picking_id, context=None):
|
||||||
|
text = _("The proposed cost is made based on %s")
|
||||||
|
value = _("standard prices set on the products")
|
||||||
|
return text % value
|
||||||
|
|
||||||
|
def _get_help_text(self, cursor, user, ids, name, arg, context=None):
|
||||||
|
res = {}
|
||||||
|
for wiz in self.browse(cursor, user, ids, context=context):
|
||||||
|
res[wiz.id] = self.__get_help_text(cursor, user, wiz.picking_id.id, context=context)
|
||||||
|
return res
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'date': fields.datetime('Date', required=True),
|
'date': fields.datetime('Date', required=True),
|
||||||
'move_ids' : fields.one2many('stock.partial.picking.line', 'wizard_id', 'Product Moves'),
|
'move_ids' : fields.one2many('stock.partial.picking.line', 'wizard_id', 'Product Moves'),
|
||||||
'picking_id': fields.many2one('stock.picking', 'Picking', required=True, ondelete='CASCADE'),
|
'picking_id': fields.many2one('stock.picking', 'Picking', required=True, ondelete='CASCADE'),
|
||||||
'hide_tracking': fields.function(_hide_tracking, string='Tracking', type='boolean', help='This field is for internal purpose. It is used to decide if the column production lot has to be shown on the moves or not.'),
|
'hide_tracking': fields.function(_hide_tracking, string='Tracking', type='boolean', help='This field is for internal purpose. It is used to decide if the column production lot has to be shown on the moves or not.'),
|
||||||
|
'help_text': fields.function(_get_help_text, string='Note', type='char'),
|
||||||
}
|
}
|
||||||
|
|
||||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||||
|
@ -122,6 +134,7 @@ class stock_partial_picking(osv.osv_memory):
|
||||||
res.update(move_ids=moves)
|
res.update(move_ids=moves)
|
||||||
if 'date' in fields:
|
if 'date' in fields:
|
||||||
res.update(date=time.strftime(DEFAULT_SERVER_DATETIME_FORMAT))
|
res.update(date=time.strftime(DEFAULT_SERVER_DATETIME_FORMAT))
|
||||||
|
res['help_text'] = self.__get_help_text(cr, uid, picking_id, context=context)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def _product_cost_for_average_update(self, cr, uid, move):
|
def _product_cost_for_average_update(self, cr, uid, move):
|
||||||
|
@ -150,6 +163,7 @@ class stock_partial_picking(osv.osv_memory):
|
||||||
'move_id' : move.id,
|
'move_id' : move.id,
|
||||||
'location_id' : move.location_id.id,
|
'location_id' : move.location_id.id,
|
||||||
'location_dest_id' : move.location_dest_id.id,
|
'location_dest_id' : move.location_dest_id.id,
|
||||||
|
'currency': move.picking_id.company_id.currency_id.id,
|
||||||
}
|
}
|
||||||
if move.picking_id.type == 'in' and move.product_id.cost_method == 'average':
|
if move.picking_id.type == 'in' and move.product_id.cost_method == 'average':
|
||||||
partial_move.update(update_cost=True, **self._product_cost_for_average_update(cr, uid, move))
|
partial_move.update(update_cost=True, **self._product_cost_for_average_update(cr, uid, move))
|
||||||
|
|
|
@ -26,10 +26,11 @@
|
||||||
<field name="prodlot_id" domain="[('product_id', '=', product_id)]" invisible="context.get('hide_tracking',False)" attrs="{'required':[('tracking','=',True), ('quantity', '!=', 0)]}" groups="stock.group_production_lot" context="{'default_product_id':product_id}"/>
|
<field name="prodlot_id" domain="[('product_id', '=', product_id)]" invisible="context.get('hide_tracking',False)" attrs="{'required':[('tracking','=',True), ('quantity', '!=', 0)]}" groups="stock.group_production_lot" context="{'default_product_id':product_id}"/>
|
||||||
<!-- Removed as this feature is not logic: price must be updated upon reception of invoice -->
|
<!-- Removed as this feature is not logic: price must be updated upon reception of invoice -->
|
||||||
<field name="update_cost" invisible="1"/>
|
<field name="update_cost" invisible="1"/>
|
||||||
<field name="cost" invisible="1"/>
|
<field name="cost" groups="base.group_multi_currency"/>
|
||||||
<field name="currency" invisible="1"/>
|
<field name="currency" readonly="1" groups="base.group_multi_currency"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
|
<field name="help_text" groups="base.group_multi_currency" class="oe_grey"/>
|
||||||
<footer>
|
<footer>
|
||||||
<button name="do_partial" string="_Transfer" type="object" class="oe_highlight" context="{'group_field_invisible': True}"/>
|
<button name="do_partial" string="_Transfer" type="object" class="oe_highlight" context="{'group_field_invisible': True}"/>
|
||||||
or
|
or
|
||||||
|
|
|
@ -280,8 +280,10 @@ instance.web_kanban.KanbanView = instance.web.View.extend({
|
||||||
self.nb_records += records.length;
|
self.nb_records += records.length;
|
||||||
self.dataset.ids.push.apply(self.dataset.ids, dataset.ids);
|
self.dataset.ids.push.apply(self.dataset.ids, dataset.ids);
|
||||||
groups_array[index] = new instance.web_kanban.KanbanGroup(self, records, group, dataset);
|
groups_array[index] = new instance.web_kanban.KanbanGroup(self, records, group, dataset);
|
||||||
if (!remaining--) {
|
if (self.dataset.index >= records.length){
|
||||||
self.dataset.index = self.dataset.size() ? 0 : null;
|
self.dataset.index = self.dataset.size() ? 0 : null;
|
||||||
|
}
|
||||||
|
if (!remaining--) {
|
||||||
return self.do_add_groups(groups_array);
|
return self.do_add_groups(groups_array);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue