Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2758 Widoki

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
Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
sie 21
2989
4
kwi 25
7859
0
paź 24
1537
0
kwi 24
1319
1
sie 23
2184