~vauxoo/addons-vauxoo/7.0-purchase_requisition_contract_analyst-dev-1482-kty

« back to all changes in this revision

Viewing changes to purchase_supplier/purchase.py

  • Committer: Jose Morales
  • Date: 2013-05-16 15:44:16 UTC
  • mfrom: (544.1.9 addons-vauxoo)
  • Revision ID: jose@vauxoo.com-20130516154416-eago8zbxslb2scq8
 
[MERGE] Added new features in the user_story module to make easy the user story management, these improvements are:
         [IMP] Added a priority field in the user story to define the priority level for each user story for ease of handling and delivery
         [IMP] Added filter to show user story for priority level
         [IMP] Added automatically project in the task when you create a new task from user story view, this project is the seted in the user story
         [IMP] Added filter to show user story for state, to ease the user story management
         [IMP] Added sum in the planned hours field to control, the hours used for each user story, for we can see the progress in any project easily
         [IMP] Added translations in the user_story module
         [IMP] Added branch to clone field in the project task module
         
       [MERGE] Merge from trunk to apply pep8 and V7 migrate in all modules
       

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
from openerp.tools.translate import _
34
34
 
35
35
 
36
 
 
37
36
class purchase_order(osv.Model):
38
37
    _inherit = "purchase.order"
39
38
 
42
41
        company_id = self.pool.get(
43
42
            'res.users').browse(cr, uid, uid).company_id.id
44
43
        product_obj = self.pool.get('product.template')
45
 
        if super(purchase_order, self).wkf_confirm_order(cr, uid, ids, context=context):
 
44
        if super(purchase_order, self).wkf_confirm_order(cr, uid, ids,
 
45
                                                         context=context):
46
46
            for po in self.browse(cr, uid, ids, context=context):
47
47
                partner_id = po.partner_id.id
48
48
                for line in po.order_line:
49
49
                    product_id = line.product_id.product_tmpl_id.id
50
 
                    if not product_supp_obj.search(cr, uid, [('product_id', '=', product_id), ('name', '=', partner_id)]):
51
 
                        product_obj.write(
52
 
                            cr, uid, [
53
 
                                product_id], {
54
 
                                    'seller_ids': [(0, 0, {'name': partner_id, 'min_qty': 1.0, 'delay': 1,
55
 
                                                           'sequence': 10, 'product_id': product_id, 'company_id': company_id, 'product_uom': line and line.product_id and line.product_id.uom_id and line.product_id.uom_id.id})]})
 
50
                    if not product_supp_obj.search(cr, uid,
 
51
                                                   [('product_id', '=',
 
52
                                                                   product_id),
 
53
                                                   ('name', '=', partner_id)]):
 
54
                        product_obj.write(cr, uid, [product_id],
 
55
                                          {
 
56
                                          'seller_ids': [(0, 0,
 
57
                                                          {'name': partner_id,
 
58
                                                           'min_qty': 1.0,
 
59
                                                           'delay': 1,
 
60
                                                           'sequence': 10,
 
61
                                                           'product_id':
 
62
                                                           product_id,
 
63
                                                           'company_id':
 
64
                                                           company_id,
 
65
                                                           'product_uom':
 
66
                                                           line and
 
67
                                                         line.product_id and
 
68
                                                         line.product_id.
 
69
                                                           uom_id and
 
70
                                                         line.product_id.
 
71
                                                           uom_id.id})]})
56
72
            return True
57
73
        else:
58
74
            return False
59