Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
4298 Представления

I added field to 

account\.move\.line\ and\ i\\ need\\ to\\ show\\ it\\ in\\ General\\ Ledger\\ as\\ a\\ acolumn\\ after\\ Debit\\ for\\ example

I\\ create\\ this\\ code

class\\ AccountMove\\(models\\.Model\\):
\\ \\ \\ \\ _inherit\\ =\\ 'account\\.move\\.line'

\\ \\ \\ \\
hat_qty\\ =\\ fields\\.Float\\(string="QTY",\\ compute='_compute_hat_qty',\\ store=True\\)

\
\\ \\ \\ \\ \
\\ \\ \\ \\ \\ \\ \\ \\ \
\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \account.report.column">
/> hat_qty
line.hat_qty
Hat Qty
none




Аватар
Отменить
Лучший ответ

Hi,

First of all, you need to inherit the account.partner.ledger and after  need to customize the query and add the fields to that query Also you need to update the columns

class AccountPartnerLedger(models.AbstractModel):
    _inherit = 'account.partner.ledger'

    def _get_columns_name(self, options):
        res = super(AccountPartnerLedger, self)._get_columns_name(options)
        if options['unreconciled']:
            dict = [{'name': _('Unpaid'), 'class': 'number'}]
            for d in dict:
                res.append(d)
        res.append({'name': _('Last Payment Date'), 'class': 'number'})
        return res
       
    //You can super the _get_columns_name function based on the above code that will help to add the column at the end of the report, once you need to add in between any field then try overriding the given function.
   
   
    // override the _get_report_line_move_line function to add records based on the particular column otherwise you need to try this code
   
def _get_report_line_move_line(self, options, partner, aml, cumulated_init_balance, cumulated_balance):

   res = super(AccountPartnerLedger, self)._get_report_line_move_line(options, partner, aml,
                                                              cumulated_init_balance,
                                                              cumulated_balance)
   res['columns'].append({'name': self.format_report_date(aml['hat_qty']), 'class': 'number'})
   
   return res
   
   
    also try to override the given functions _get_lines_without_partner, _get_query_amls
   
    In the query add your field like account_move_line.hat_qty,


Hope it helps

Аватар
Отменить
Related Posts Ответы Просмотры Активность
4
февр. 24
4600
2
дек. 22
14799
1
нояб. 22
2159
1
нояб. 21
4927
0
янв. 21
2279