mirror of
https://gitlab.com/sonalarora/tra_backend.git
synced 2025-12-18 10:49:11 +02:00
add new field on invoice
This commit is contained in:
@@ -10,11 +10,12 @@
|
|||||||
'author': 'Masterkey',
|
'author': 'Masterkey',
|
||||||
'description': "",
|
'description': "",
|
||||||
'website': 'https://www.odoo.com/page/crm',
|
'website': 'https://www.odoo.com/page/crm',
|
||||||
'depends': ['product','base','sale_renting'
|
'depends': ['product','base','sale_renting','account'
|
||||||
],
|
],
|
||||||
'data': [
|
'data': [
|
||||||
'views/product_views.xml',
|
'views/product_views.xml',
|
||||||
'views/partner_view.xml',
|
'views/partner_view.xml',
|
||||||
|
'views/account_move_view.xml'
|
||||||
],
|
],
|
||||||
'demo': [
|
'demo': [
|
||||||
|
|
||||||
|
|||||||
@@ -4,3 +4,4 @@
|
|||||||
|
|
||||||
from . import product
|
from . import product
|
||||||
from . import partner
|
from . import partner
|
||||||
|
from . import account_move
|
||||||
|
|||||||
20
tra_backend_Product/models/account_move.py
Normal file
20
tra_backend_Product/models/account_move.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from odoo import api, fields, models, _
|
||||||
|
from odoo.exceptions import RedirectWarning, UserError, ValidationError, AccessError
|
||||||
|
from datetime import date
|
||||||
|
|
||||||
|
|
||||||
|
class AccountMove(models.Model):
|
||||||
|
_inherit = "account.move"
|
||||||
|
|
||||||
|
|
||||||
|
# ==== Business fields ====
|
||||||
|
overdue_by = fields.Float(string='Overdue By', index=True, compute='calculate_overdue_date')
|
||||||
|
|
||||||
|
|
||||||
|
def calculate_overdue_date(self):
|
||||||
|
current_date = date.today()
|
||||||
|
overdue_date = self.invoice_due_date - current_date
|
||||||
|
self.overdue_by = overdue_date.days
|
||||||
|
|
||||||
19
tra_backend_Product/views/account_move_view.xml
Normal file
19
tra_backend_Product/views/account_move_view.xml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<!-- view common to both template and product -->
|
||||||
|
|
||||||
|
<record id="view_invoice_tree_inherit" model="ir.ui.view">
|
||||||
|
<field name="name">account.invoice.tree</field>
|
||||||
|
<field name="model">account.move</field>
|
||||||
|
<field name="inherit_id" ref="account.view_invoice_tree"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//field[@name='invoice_date_due']" position="after">
|
||||||
|
<field name="overdue_by"/>
|
||||||
|
</xpath>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
Reference in New Issue
Block a user