0
votes

I need to display accounting information on POS orders tree view. How can I display journal name, credit, and the debit amount in the post order tree view?Given code showing the blank result in the tree view. Here is tried a code, please help me as I am new in Odoo programming

statement_ids = fields.One2many
(
    'account.bank.statement.line', 
    'pos_statement_id', 
    string='Payments', 
    states={'draft': [('readonly', False)]}, 
    readonly=True
)
journal_id = fields.Char
(
    compute='_get_journals', 
            string="journal" ,
            states={'draft': [('readonly', False)]},
            store=True,readonly=True
)

@api.depends('statement_ids')
def _get_journals(self):
    acc_lines = self.env['account.bank.statement.line']
    acc_journals = self.env['account.journal']

    for record in self:
        acc_res = acc_lines.search(['statement_ids'])
        record.journal_id = acc_journals.search(['acc_res.journal_id.id'])
1
Can you explain bit more and share full code, actually under which model you are adding this code?Hardik Patadia
Adding under pos.order modelmajid

1 Answers

1
votes

In odoo generally only one accounting entry gets created for each session at the time of closing.

So if you want to show up the debit and credit amount of those orders of then you have to first change the code and create order wise accounting entries.

So either change the way how it works or should change the requirements to any alternate solution.