跳至內容
選單
此問題已被標幟
2772 瀏覽次數

Dear All,

we've enhanced the chart of account to assign an analytic account (new field added)
The purpose is to determine an Analytic Account by default when performing stock moves, e.g. stock updates or consumption from manufacturing.
We've written this code, but it doesn't work out:
where am I wrong?
thanks in advance
claudio

class StockMove(models.Model):
    _inherit = 'stock.move'
    @api.multi
    def _AnalAccDet(self):
        for move in self:
            if not move.analytic_account_id:
               for account in move.account_move_line_ids:
                    for analytic in account.account_id:
                        analaccdef = analytic.x_analytic_account_id
            else:
                analaccdef = move.analytic_account_id
            if not analaccdef:
                  self.write({'analytic_account_id': analaccdef})           
            return True
頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
8月 21
3013
4
4月 25
7896
0
10月 24
1542
0
4月 24
1321
1
8月 23
2198