~unifield-team/unifield-wm/us-826

« back to all changes in this revision

Viewing changes to analytic_distribution_supply/sale.py

  • Committer: jf
  • Date: 2014-04-04 10:05:06 UTC
  • mfrom: (2044.2.13 UF_2171)
  • Revision ID: jfb@tempo-consulting.fr-20140404100506-6absn88474hf7zid
UF-2171 [FIX] Analytic distribution issues for invoices linked to POs
lp:~odossmann/unifield-wm/UF_2171

Show diffs side-by-side

added added

removed removed

Lines of Context:
83
83
                'context': context,
84
84
        }
85
85
 
 
86
    def button_reset_distribution(self, cr, uid, ids, context=None):
 
87
        """
 
88
        Reset analytic distribution on all sale order lines.
 
89
        To do this, just delete the analytic_distribution id link on each sale order line.
 
90
        """
 
91
        if context is None:
 
92
            context = {}
 
93
        if isinstance(ids, (int, long)):
 
94
            ids = [ids]
 
95
        # Prepare some values
 
96
        sale_obj = self.pool.get(self._name + '.line')
 
97
        # Search  lines
 
98
        to_reset = sale_obj.search(cr, uid, [('order_id', 'in', ids)])
 
99
        sale_obj.write(cr, uid, to_reset, {'analytic_distribution_id': False})
 
100
        return True
 
101
 
86
102
    def copy_data(self, cr, uid, s_id, default=None, context=None):
87
103
        """
88
104
        Copy global distribution and give it to new sale order.