diff --git a/addons/l10n_ca/account_chart_template_en.xml b/addons/l10n_ca/account_chart_template_en.xml
index 635fa7b8bb1..24505dac8e6 100644
--- a/addons/l10n_ca/account_chart_template_en.xml
+++ b/addons/l10n_ca/account_chart_template_en.xml
@@ -16,11 +16,13 @@
+
+
diff --git a/addons/l10n_ca/account_chart_template_fr.xml b/addons/l10n_ca/account_chart_template_fr.xml
index 7d1cc0a9ae2..169f6c45f1e 100644
--- a/addons/l10n_ca/account_chart_template_fr.xml
+++ b/addons/l10n_ca/account_chart_template_fr.xml
@@ -15,11 +15,13 @@
+
-
+
+
diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py
index 62e64dbbd59..15d034e0010 100644
--- a/addons/mrp/mrp.py
+++ b/addons/mrp/mrp.py
@@ -452,6 +452,25 @@ class mrp_production(osv.osv):
result[mrp_production.id] = done / mrp_production.product_qty * 100
return result
+ def _moves_assigned(self, cr, uid, ids, name, arg, context=None):
+ """ Test whether all the consume lines are assigned """
+ res = True
+ for production in self.browse(cr, uid, ids, context=context):
+ states = [x.state != 'assigned' for x in production.move_lines if x]
+ if any(states) or len(states) == 0:
+ return False
+ return res
+
+
+ def _mrp_from_move(self, cr, uid, ids, context=None):
+ """ Return mrp"""
+ res = []
+ for move in self.browse(cr, uid, ids, context=context):
+ res += self.pool.get("mrp.production").search(cr, uid, [('move_lines', 'in', move.id)], context=context)
+ return res
+
+
+
_columns = {
'name': fields.char('Reference', size=64, required=True, readonly=True, states={'draft': [('readonly', False)]}),
'origin': fields.char('Source Document', size=64, readonly=True, states={'draft': [('readonly', False)]},
@@ -510,6 +529,8 @@ class mrp_production(osv.osv):
'cycle_total': fields.function(_production_calc, type='float', string='Total Cycles', multi='workorder', store=True),
'user_id':fields.many2one('res.users', 'Responsible'),
'company_id': fields.many2one('res.company','Company',required=True),
+ 'ready_production': fields.function(_moves_assigned, type='boolean', store={'stock.move': (_mrp_from_move, ['state'], 10)}),
+
}
_defaults = {
'priority': lambda *a: '1',
@@ -554,7 +575,6 @@ class mrp_production(osv.osv):
'move_created_ids2' : [],
'product_lines' : [],
'move_prod_id' : False,
- 'picking_id' : False
})
return super(mrp_production, self).copy(cr, uid, id, default, context)
diff --git a/addons/mrp/mrp_workflow.xml b/addons/mrp/mrp_workflow.xml
index 23119bf9490..388dd9039b3 100644
--- a/addons/mrp/mrp_workflow.xml
+++ b/addons/mrp/mrp_workflow.xml
@@ -43,7 +43,7 @@
Truefunction
- action_production_end()
+ action_production_end()done
@@ -70,7 +70,7 @@
- picking_id and picking_id.state=='done'
+ ready_production
diff --git a/addons/mrp/procurement.py b/addons/mrp/procurement.py
index b667f2e075f..9dad9aa5899 100644
--- a/addons/mrp/procurement.py
+++ b/addons/mrp/procurement.py
@@ -92,10 +92,9 @@ class procurement_order(osv.osv):
def get_phantom_bom_id(self, cr, uid, ids, context=None):
for procurement in self.browse(cr, uid, ids, context=context):
- if procurement.move_id and procurement.move_id.product_id.supply_method=='produce' \
- and procurement.move_id.product_id.procure_method=='make_to_order':
+ if procurement.move_dest_id and procurement.move_dest_id.product_id.supply_method=='produce':
phantom_bom_id = self.pool.get('mrp.bom').search(cr, uid, [
- ('product_id', '=', procurement.move_id.product_id.id),
+ ('product_id', '=', procurement.move_dest_id.product_id.id),
('bom_id', '=', False),
('type', '=', 'phantom')])
return phantom_bom_id
@@ -120,7 +119,7 @@ class procurement_order(osv.osv):
move_obj = self.pool.get('stock.move')
procurement_obj = self.pool.get('procurement.order')
for procurement in procurement_obj.browse(cr, uid, ids, context=context):
- res_id = procurement.move_id.id
+ res_id = procurement.move_dest_id and procurement.move_dest_id.id or False
newdate = datetime.strptime(procurement.date_planned, '%Y-%m-%d %H:%M:%S') - relativedelta(days=procurement.product_id.produce_delay or 0.0)
newdate = newdate - relativedelta(days=company.manufacturing_lead)
produce_id = production_obj.create(cr, uid, {
diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py
index 62823369add..69e2b1cbf23 100644
--- a/addons/procurement/procurement.py
+++ b/addons/procurement/procurement.py
@@ -125,7 +125,7 @@ class procurement_order(osv.osv):
('running', 'Running'),
('done', 'Done')
], 'Status', required=True, track_visibility='onchange'),
- 'message': fields.text('Latest error', help="Exception occurred while computing procurement orders."),
+ 'message': fields.text('Latest error', help="Exception occurred while computing procurement orders.", track_visibility='onchange'),
}
_defaults = {
diff --git a/addons/project_mrp/project_mrp.py b/addons/project_mrp/project_mrp.py
index 08227a8dae0..e00883ed764 100644
--- a/addons/project_mrp/project_mrp.py
+++ b/addons/project_mrp/project_mrp.py
@@ -32,7 +32,7 @@ class procurement_order(osv.osv):
}
def _is_procurement_task(self, cr, uid, procurement, context=None):
- return procurement.product_id.type == 'service' and procurement.product_it.auto_create_task or False
+ return procurement.product_id.type == 'service' and procurement.product_id.auto_create_task or False
def _assign(self, cr, uid, procurement, context=None):
res = super(procurement_order, self)._assign(cr, uid, procurement, context=context)
@@ -123,9 +123,9 @@ class product_product(osv.osv):
class sale_order(osv.osv):
_inherit = 'sale.order'
- def _prepare_order_line_procurement(self, cr, uid, order, line, move_id, date_planned, context=None):
+ def _prepare_order_line_procurement(self, cr, uid, order, line, group_id=False, context=None):
proc_data = super(sale_order, self)._prepare_order_line_procurement(cr,
- uid, order, line, move_id, date_planned, context=context)
+ uid, order, line, group_id = group_id, context=context)
proc_data['sale_line_id'] = line.id
return proc_data
diff --git a/addons/project_mrp/project_mrp_view.xml b/addons/project_mrp/project_mrp_view.xml
index 6539f52155a..302225a24ec 100644
--- a/addons/project_mrp/project_mrp_view.xml
+++ b/addons/project_mrp/project_mrp_view.xml
@@ -49,13 +49,6 @@
False
-
-
- When you sell this service to a customer, a task will be
- created to follow up the job to do. This task will appear
- in the project related to the contract of the sales order.
-
-
diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index 31522c26dd9..a80b84bddbc 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -1218,63 +1218,65 @@ class procurement_order(osv.osv):
acc_pos_obj = self.pool.get('account.fiscal.position')
seq_obj = self.pool.get('ir.sequence')
warehouse_obj = self.pool.get('stock.warehouse')
+ pass_ids = []
for procurement in self.browse(cr, uid, ids, context=context):
- res_id = procurement.move_id.id
+ res_id = procurement.move_dest_id and procurement.move_dest_id.id or False
partner = procurement.product_id.seller_id # Taken Main Supplier of Product of Procurement.
- assert partner, ('There is no supplier associated to product %s', (procurements.product_id.name))
- seller_qty = procurement.product_id.seller_qty
- partner_id = partner.id
- address_id = partner_obj.address_get(cr, uid, [partner_id], ['delivery'])['delivery']
- pricelist_id = partner.property_product_pricelist_purchase.id
- warehouse_id = warehouse_obj.search(cr, uid, [('company_id', '=', procurement.company_id.id or company.id)], context=context)
- uom_id = procurement.product_id.uom_po_id.id
+ if not partner:
+ procurement.write({'message': _('There is no supplier associated to product %s') % (procurement.product_id.name)})
+ else:
+ seller_qty = procurement.product_id.seller_qty
+ partner_id = partner.id
+ address_id = partner_obj.address_get(cr, uid, [partner_id], ['delivery'])['delivery']
+ pricelist_id = partner.property_product_pricelist_purchase.id
+ warehouse_id = warehouse_obj.search(cr, uid, [('company_id', '=', procurement.company_id.id or company.id)], context=context)
+ uom_id = procurement.product_id.uom_po_id.id
+ qty = uom_obj._compute_qty(cr, uid, procurement.product_uom.id, procurement.product_qty, uom_id)
+ if seller_qty:
+ qty = max(qty,seller_qty)
- qty = uom_obj._compute_qty(cr, uid, procurement.product_uom.id, procurement.product_qty, uom_id)
- if seller_qty:
- qty = max(qty,seller_qty)
+ price = pricelist_obj.price_get(cr, uid, [pricelist_id], procurement.product_id.id, qty, partner_id, {'uom': uom_id})[pricelist_id]
- price = pricelist_obj.price_get(cr, uid, [pricelist_id], procurement.product_id.id, qty, partner_id, {'uom': uom_id})[pricelist_id]
+ schedule_date = self._get_purchase_schedule_date(cr, uid, procurement, company, context=context)
+ purchase_date = self._get_purchase_order_date(cr, uid, procurement, company, schedule_date, context=context)
- schedule_date = self._get_purchase_schedule_date(cr, uid, procurement, company, context=context)
- purchase_date = self._get_purchase_order_date(cr, uid, procurement, company, schedule_date, context=context)
-
- #Passing partner_id to context for purchase order line integrity of Line name
- new_context = context.copy()
- new_context.update({'lang': partner.lang, 'partner_id': partner_id})
-
- product = prod_obj.browse(cr, uid, procurement.product_id.id, context=new_context)
- taxes_ids = procurement.product_id.supplier_taxes_id
- taxes = acc_pos_obj.map_tax(cr, uid, partner.property_account_position, taxes_ids)
-
- name = product.partner_ref
- if product.description_purchase:
- name += '\n'+ product.description_purchase
- line_vals = {
- 'name': name,
- 'product_qty': qty,
- 'product_id': procurement.product_id.id,
- 'product_uom': uom_id,
- 'price_unit': price or 0.0,
- 'date_planned': schedule_date.strftime(DEFAULT_SERVER_DATETIME_FORMAT),
- 'move_dest_id': res_id,
- 'taxes_id': [(6,0,taxes)],
- }
- name = seq_obj.get(cr, uid, 'purchase.order') or _('PO: %s') % procurement.name
- po_vals = {
- 'name': name,
- 'origin': procurement.origin,
- 'partner_id': partner_id,
- 'location_id': procurement.location_id.id,
- 'warehouse_id': warehouse_id and warehouse_id[0] or False,
- 'pricelist_id': pricelist_id,
- 'date_order': purchase_date.strftime(DEFAULT_SERVER_DATETIME_FORMAT),
- 'company_id': procurement.company_id.id,
- 'fiscal_position': partner.property_account_position and partner.property_account_position.id or False,
- 'payment_term_id': partner.property_supplier_payment_term.id or False,
- }
- res[procurement.id] = self.create_procurement_purchase_order(cr, uid, procurement, po_vals, line_vals, context=new_context)
- self.write(cr, uid, [procurement.id], {'state': 'running', 'purchase_id': res[procurement.id]})
- self.message_post(cr, uid, ids, body=_("Draft Purchase Order created"), context=context)
+ #Passing partner_id to context for purchase order line integrity of Line name
+ new_context = context.copy()
+ new_context.update({'lang': partner.lang, 'partner_id': partner_id})
+ product = prod_obj.browse(cr, uid, procurement.product_id.id, context=new_context)
+ taxes_ids = procurement.product_id.supplier_taxes_id
+ taxes = acc_pos_obj.map_tax(cr, uid, partner.property_account_position, taxes_ids)
+ name = product.partner_ref
+ if product.description_purchase:
+ name += '\n'+ product.description_purchase
+ line_vals = {
+ 'name': name,
+ 'product_qty': qty,
+ 'product_id': procurement.product_id.id,
+ 'product_uom': uom_id,
+ 'price_unit': price or 0.0,
+ 'date_planned': schedule_date.strftime(DEFAULT_SERVER_DATETIME_FORMAT),
+ 'move_dest_id': res_id,
+ 'taxes_id': [(6,0,taxes)],
+ }
+ name = seq_obj.get(cr, uid, 'purchase.order') or _('PO: %s') % procurement.name
+ po_vals = {
+ 'name': name,
+ 'origin': procurement.origin,
+ 'partner_id': partner_id,
+ 'location_id': procurement.location_id.id,
+ 'warehouse_id': warehouse_id and warehouse_id[0] or False,
+ 'pricelist_id': pricelist_id,
+ 'date_order': purchase_date.strftime(DEFAULT_SERVER_DATETIME_FORMAT),
+ 'company_id': procurement.company_id.id,
+ 'fiscal_position': partner.property_account_position and partner.property_account_position.id or False,
+ 'payment_term_id': partner.property_supplier_payment_term.id or False,
+ }
+ res[procurement.id] = self.create_procurement_purchase_order(cr, uid, procurement, po_vals, line_vals, context=new_context)
+ self.write(cr, uid, [procurement.id], {'state': 'running', 'purchase_id': res[procurement.id]})
+ pass_ids += [procurement.id]
+ if pass_ids:
+ self.message_post(cr, uid, pass_ids, body=_("Draft Purchase Order created"), context=context)
return res
def _product_virtual_get(self, cr, uid, order_point):
diff --git a/addons/purchase_requisition/purchase_requisition.py b/addons/purchase_requisition/purchase_requisition.py
index 7f23e1b548e..85fda69a65e 100644
--- a/addons/purchase_requisition/purchase_requisition.py
+++ b/addons/purchase_requisition/purchase_requisition.py
@@ -391,7 +391,7 @@ class procurement_order(osv.osv):
'date_end': procurement.date_planned,
'warehouse_id': warehouse_id and warehouse_id[0] or False,
'company_id': procurement.company_id.id,
- 'move_dest_id': procurement.move_id.id,
+ 'move_dest_id': procurement.move_dest_id and procurement.move_dest_id.id or False,
'line_ids': [(0, 0, {
'product_id': procurement.product_id.id,
'product_uom_id': procurement.product_uom.id,
diff --git a/addons/sale/sale.py b/addons/sale/sale.py
index 57c3cbf1224..b55fccc8984 100644
--- a/addons/sale/sale.py
+++ b/addons/sale/sale.py
@@ -633,7 +633,6 @@ class sale_order(osv.osv):
'product_uos_qty': (line.product_uos and line.product_uos_qty) or line.product_uom_qty,
'product_uos': (line.product_uos and line.product_uos.id) or line.product_uom.id,
'company_id': order.company_id.id,
- 'note': line.name,
'group_id': group_id,
'invoice_state': (order.order_policy=='picking') and '2binvoiced' or 'none',
'sale_line_id': line.id
diff --git a/addons/sale_stock/test/sale_order_onchange.yml b/addons/sale_stock/test/sale_order_onchange.yml
index 1026e5627c3..1c3a4a5b4c3 100644
--- a/addons/sale_stock/test/sale_order_onchange.yml
+++ b/addons/sale_stock/test/sale_order_onchange.yml
@@ -4,7 +4,6 @@
!record {model: product.product, id: product_onchange1}:
name: 'Devil Worship Book'
list_price: 66.6
- procure_method: 'make_to_order'
-
Now i create a sale order that uses my new product
-
@@ -19,4 +18,3 @@
!assert {model: sale.order, id: sale_order_onchange1, string: The onchange function of product was not correctly triggered}:
- order_line[0].name == u'Devil Worship Book'
- order_line[0].price_unit == 66.6
- - order_line[0].type == 'make_to_order'
diff --git a/addons/stock/procurement.py b/addons/stock/procurement.py
index 71864afab13..7f36871b9d1 100644
--- a/addons/stock/procurement.py
+++ b/addons/stock/procurement.py
@@ -107,7 +107,6 @@ class procurement_order(osv.osv):
return False
else:
return True
- return procurement.move_id.state == 'done'
return super(procurement_order, self)._check(cr, uid, procurement, context)
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index b79cb0c6ca6..9788a0c33d8 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -140,7 +140,8 @@ class stock_quant(osv.osv):
"""
res = {}
for q in self.browse(cr, uid, ids, context=context):
- res[q.id] = q.product_id.code
+
+ res[q.id] = q.product_id.code or ''
if q.lot_id:
res[q.id] = q.lot_id.name
res[q.id] += ': '+ str(q.qty) + q.product_id.uom_id.name
@@ -1509,16 +1510,6 @@ class stock_move(osv.osv):
}, context=context)
return new_move
- def get_type_from_usage(self, cr, uid, location, location_dest, context=None):
- '''
- Returns the type to be chosen based on the usages of the locations
- '''
- if location.usage == 'internal' and location_dest.usage in ['supplier', 'customer']:
- return 'out'
- if location.usage in ['supplier', 'customer'] and location_dest.usage == 'internal' :
- return 'in'
- return 'internal'
-
class stock_inventory(osv.osv):
_name = "stock.inventory"
_description = "Inventory"
diff --git a/addons/stock/test/procrule.yml b/addons/stock/test/procrule.yml
index a8baad650e8..d1762ae4806 100644
--- a/addons/stock/test/procrule.yml
+++ b/addons/stock/test/procrule.yml
@@ -1,5 +1,11 @@
-
- Create new delivery order from output -> customers
+ Create new global procurement rule from Stock -> Output
+-
+ !record {model: procurement.rule, ref:}
+ location_id: stock
+ location_dest_id: output
+-
+ Create Delivery Order from Output -> Customer
-
!record {model: stock.picking, ref:}
-
diff --git a/addons/stock_invoice_directly/wizard/stock_invoice.py b/addons/stock_invoice_directly/wizard/stock_invoice.py
index ba41de626da..5c126f33374 100644
--- a/addons/stock_invoice_directly/wizard/stock_invoice.py
+++ b/addons/stock_invoice_directly/wizard/stock_invoice.py
@@ -21,29 +21,29 @@
from openerp.osv import fields, osv
-class invoice_directly(osv.osv_memory):
- _inherit = 'stock.partial.picking'
-
- def do_partial(self, cr, uid, ids, context=None):
- """Launch Create invoice wizard if invoice state is To be Invoiced,
- after processing the partial picking.
- """
- if context is None: context = {}
- result = super(invoice_directly, self).do_partial(cr, uid, ids, context)
- partial = self.browse(cr, uid, ids[0], context)
- context.update(active_model='stock.picking',
- active_ids=[partial.picking_id.id])
- if partial.picking_id.invoice_state == '2binvoiced':
- return {
- 'name': 'Create Invoice',
- 'view_type': 'form',
- 'view_mode': 'form',
- 'res_model': 'stock.invoice.onshipping',
- 'type': 'ir.actions.act_window',
- 'target': 'new',
- 'context': context
- }
- return {'type': 'ir.actions.act_window_close'}
+# class invoice_directly(osv.osv_memory):
+# _inherit = 'stock.partial.picking'
+#
+# def do_partial(self, cr, uid, ids, context=None):
+# """Launch Create invoice wizard if invoice state is To be Invoiced,
+# after processing the partial picking.
+# """
+# if context is None: context = {}
+# result = super(invoice_directly, self).do_partial(cr, uid, ids, context)
+# partial = self.browse(cr, uid, ids[0], context)
+# context.update(active_model='stock.picking',
+# active_ids=[partial.picking_id.id])
+# if partial.picking_id.invoice_state == '2binvoiced':
+# return {
+# 'name': 'Create Invoice',
+# 'view_type': 'form',
+# 'view_mode': 'form',
+# 'res_model': 'stock.invoice.onshipping',
+# 'type': 'ir.actions.act_window',
+# 'target': 'new',
+# 'context': context
+# }
+# return {'type': 'ir.actions.act_window_close'}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/stock_location/stock_location.py b/addons/stock_location/stock_location.py
index 26992746edb..668b80ae72a 100644
--- a/addons/stock_location/stock_location.py
+++ b/addons/stock_location/stock_location.py
@@ -102,7 +102,6 @@ class stock_location_path(osv.osv):
'date_expected': newdate,
'picking_id': False,
'picking_type_id': rule.picking_type_id and rule.picking_type_id.id or False,
- 'type': move_obj.get_type_from_usage(cr, uid, move.location_id, move.location_dest_id, context=context),
'rule_id': rule.id,
'propagate': rule.propagate,
})