(self)
return result
Prepare the values used to create() an account.analytic.line upon validation of an account.move.line having
            an analytic account. This method is intended to be extended in other modules.
            :return list of values to create analytic.line
            :rtype list
Prepare the values used to create() an account.analytic.line upon validation of an account.move.line having
            an analytic account. This method is intended to be extended in other modules.
            :return list of values to create analytic.line
            :rtype list
Prepare the values used to create () an account . analytic . line upon validation of an account . move . line having an analytic account . This method is intended to be extended in other modules . : return list of values to create analytic . line : rtype list
def _prepare_analytic_line(self):
        """ Prepare the values used to create() an account.analytic.line upon validation of an account.move.line having
            an analytic account. This method is intended to be extended in other modules.
            :return list of values to create analytic.line
            :rtype list
        """
        result = []
        for move_line in self:
            amount = (move_line.credit or 0.0) - (move_line.debit or 0.0)
            default_name = move_line.name or (move_line.ref or '/' + ' -- ' + (move_line.partner_id and move_line.partner_id.name or '/'))
            category = 'other'
            if move_line.move_id.is_sale_document():
                category = 'invoice'
            elif move_line.move_id.is_purchase_document():
                category = 'vendor_bill'
            result.append({
                'name': default_name,
                'date': move_line.date,
                'account_id': move_line.analytic_account_id.id,
                'group_id': move_line.analytic_account_id.group_id.id,
                'tag_ids': [(6, 0, move_line._get_analytic_tag_ids())],
                'unit_amount': move_line.quantity,
                'product_id': move_line.product_id and move_line.product_id.id or False,
                'product_uom_id': move_line.product_uom_id and move_line.product_uom_id.id or False,
                'amount': amount,
                'general_account_id': move_line.account_id.id,
                'ref': move_line.ref,
                'move_id': move_line.id,
                'user_id': move_line.move_id.invoice_user_id.id or self._uid,
                'partner_id': move_line.partner_id.id,
                'company_id': move_line.analytic_account_id.company_id.id or move_line.move_id.company_id.id,
                'category': category,
            })
        return result
def _prepare_analytic_line ( self ) : result = [ ] for move_line in self : amount = ( move_line . credit or 0.0 ) - ( move_line . debit or 0.0 ) default_name = move_line . name or ( move_line . ref or '/' + ' -- ' + ( move_line . partner_id and move_line . partner_id . name or '/' ) ) category = 'other' if move_line . move_id . is_sale_document ( ) : category = 'invoice' elif move_line . move_id . is_purchase_document ( ) : category = 'vendor_bill' result . append ( { 'name' : default_name , 'date' : move_line . date , 'account_id' : move_line . analytic_account_id . id , 'group_id' : move_line . analytic_account_id . group_id . id , 'tag_ids' : [ ( 6 , 0 , move_line . _get_analytic_tag_ids ( ) ) ] , 'unit_amount' : move_line . quantity , 'product_id' : move_line . product_id and move_line . product_id . id or False , 'product_uom_id' : move_line . product_uom_id and move_line . product_uom_id . id or False , 'amount' : amount , 'general_account_id' : move_line . account_id . id , 'ref' : move_line . ref , 'move_id' : move_line . id , 'user_id' : move_line . move_id . invoice_user_id . id or self . _uid , 'partner_id' : move_line . partner_id . id , 'company_id' : move_line . analytic_account_id . company_id . id or move_line . move_id . company_id . id , 'category' : category , } ) return result