Improved invoice filtering, justification fields, and bulk payment approval
This commit is contained in:
parent
241127b848
commit
1a1020b213
|
|
@ -144,12 +144,6 @@
|
|||
<field name="model" attrs="{'invisible': ['|',('state', '=', 'model'),('asset_type', '!=', 'purchase')]}"/>
|
||||
<field name="receive_date" attrs="{'invisible': ['|',('state', '=', 'model'),('asset_type', '!=', 'purchase')]}"/>
|
||||
<field name="note" attrs="{'invisible': ['|',('state', '=', 'model'),('asset_type', '!=', 'purchase')]}"/>
|
||||
<field name="model"
|
||||
attrs="{'invisible': ['|',('state', '=', 'model'),('asset_type', '!=', 'purchase')]}"/>
|
||||
<field name="receive_date"
|
||||
attrs="{'invisible': ['|',('state', '=', 'model'),('asset_type', '!=', 'purchase')]}"/>
|
||||
<field name="note"
|
||||
attrs="{'invisible': ['|',('state', '=', 'model'),('asset_type', '!=', 'purchase')]}"/>
|
||||
<field name="status" invisible="1"/>
|
||||
</group>
|
||||
</group>
|
||||
|
|
|
|||
|
|
@ -99,19 +99,10 @@ class EmployeeCustodyLine(models.Model):
|
|||
return res
|
||||
|
||||
def unlink(self):
|
||||
asset_ids = self.mapped('asset_id').ids
|
||||
assets = self.mapped('asset_id')
|
||||
result = super(EmployeeCustodyLine, self).unlink()
|
||||
if result and asset_ids:
|
||||
Asset = self.env['account.asset']
|
||||
CustodyLine = self.env['asset.custody.line']
|
||||
|
||||
for asset_id in asset_ids:
|
||||
existing_custody = CustodyLine.search([('asset_id', '=', asset_id)], limit=1)
|
||||
if not existing_custody:
|
||||
asset = Asset.browse(asset_id)
|
||||
if asset.exists() and asset.status == 'reserved':
|
||||
asset.write({'status': 'available'})
|
||||
|
||||
if result and assets:
|
||||
assets.write({'status': 'available'})
|
||||
return result
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,24 @@ msgstr ""
|
|||
msgid "# Payments"
|
||||
msgstr ""
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: code:addons/exp_budget_check/wizard/payment_register.py:0
|
||||
#, python-format
|
||||
msgid "Transfer from %s"
|
||||
msgstr "نقل من %s"
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: code:addons/exp_budget_check/wizard/payment_register.py:0
|
||||
#, python-format
|
||||
msgid "Transfer to %s"
|
||||
msgstr "نقل إلى %s"
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: code:addons/exp_budget_check/wizard/payment_register.py:0
|
||||
#, python-format
|
||||
msgid "Internal Transfer"
|
||||
msgstr "التحويل الداخلي"
|
||||
|
||||
#. module: exp_budget_check
|
||||
#: model:ir.model,name:exp_budget_check.model_account_analytic_account
|
||||
msgid "Analytic Account"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.tools.misc import formatLang, format_date, get_lang
|
||||
|
||||
|
||||
class AccountPayment(models.Model):
|
||||
|
|
@ -9,7 +10,6 @@ class AccountPayment(models.Model):
|
|||
invoice_rec_id = fields.Many2one(comodel_name='account.move', string='Invoice', copy=False)
|
||||
invoice_rec_ids = fields.Many2many(comodel_name='account.move', copy=False)
|
||||
|
||||
|
||||
@api.model
|
||||
def migrate_invoice_rec_id_to_invoice_rec_ids(self):
|
||||
# Get all records where invoice_rec_id is set
|
||||
|
|
@ -38,7 +38,8 @@ class AccountPaymentRegister(models.TransientModel):
|
|||
# invoice_payment = self.env['account.payment'].search(
|
||||
# [('invoice_rec_id', '=', active_id),
|
||||
# ('state', '=', 'draft')])
|
||||
invoice_payment = self.env['account.payment'].search([('state', '=', 'draft')]).filtered(lambda r: set(active_ids) & set(r.invoice_rec_ids.ids))
|
||||
invoice_payment = self.env['account.payment'].search([('state', '=', 'draft')]).filtered(
|
||||
lambda r: set(active_ids) & set(r.invoice_rec_ids.ids))
|
||||
if invoice_payment:
|
||||
raise UserError(
|
||||
_('You can not create payment for this invoice because there is a draft payment for it'))
|
||||
|
|
@ -82,4 +83,37 @@ class AccountPaymentRegister(models.TransientModel):
|
|||
payment.invoice_rec_ids = [(4, active_id) for active_id in active_ids]
|
||||
payment.action_cancel()
|
||||
payment.action_draft()
|
||||
for line in payment.move_id.line_ids:
|
||||
if payment.is_internal_transfer:
|
||||
if payment.payment_type == 'outbound':
|
||||
liquidity_line_name = _('Transfer from %s', payment.journal_id.name)
|
||||
else:
|
||||
liquidity_line_name = _('Transfer to %s', payment.journal_id.name)
|
||||
else:
|
||||
liquidity_line_name = payment.payment_reference
|
||||
payment_display_name = payment._prepare_payment_display_name()
|
||||
default_line_name = self._get_payment_line_name(
|
||||
_("Internal Transfer") if payment.is_internal_transfer else payment_display_name[
|
||||
'%s-%s' % (payment.payment_type, payment.partner_type)],
|
||||
payment.amount,
|
||||
payment.currency_id,
|
||||
payment.date,
|
||||
partner_or_name=payment.invoice_purpose or payment.partner_id,
|
||||
)
|
||||
if line.account_id.id in [payment.outstanding_account_id.id, payment.destination_account_id.id]:
|
||||
line.name = liquidity_line_name or default_line_name
|
||||
return payments
|
||||
|
||||
def _get_payment_line_name(self, document, amount, currency, date, partner_or_name=None):
|
||||
'''Custom function to create name for payment lines'''
|
||||
# Start with standard format similar to _get_default_line_name
|
||||
values = ['%s %s' % (document, formatLang(self.env, amount, currency_obj=currency))]
|
||||
|
||||
if partner_or_name:
|
||||
if hasattr(partner_or_name, 'display_name'):
|
||||
values.append(partner_or_name.display_name)
|
||||
else:
|
||||
values.append(str(partner_or_name))
|
||||
|
||||
values.append(format_date(self.env, fields.Date.to_string(date)))
|
||||
return ' - '.join(values)
|
||||
|
|
|
|||
|
|
@ -10,11 +10,13 @@
|
|||
'website': "http://www.exp-sa.com",
|
||||
'category': 'Odex25 Accounting/Accounting',
|
||||
# any module necessary for this one to work correctly
|
||||
'depends': ['account_budget_custom','purchase_requisition_custom','exp_budget_check'],
|
||||
'depends': ['account_budget_custom', 'purchase_requisition_custom', 'exp_budget_check'],
|
||||
# always loaded
|
||||
'data': [
|
||||
'views/account_budget_views.xml',
|
||||
'views/purchase_request_view.xml',
|
||||
'views/res_config_view.xml',
|
||||
'views/account_payment_view.xml',
|
||||
'views/account_move_view.xml',
|
||||
],
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,26 @@ msgid ""
|
|||
" ) يكون صفر عند قابل الاشارة"
|
||||
msgstr ""
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_account_bank_statement_line__payment_purpose
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_account_move__payment_purpose
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_account_payment__invoice_purpose
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_account_payment__payment_purpose
|
||||
msgid "Purpose"
|
||||
msgstr "مبررات طلب الشراء (الغرض)"
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_account_payment__has_in_invoice
|
||||
msgid "Has In Invoice"
|
||||
msgstr ""
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_account_bank_statement_line__has_in_payment
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_account_move__has_in_payment
|
||||
#: model:ir.model.fields,field_description:initial_engagement_budget.field_account_payment__has_in_payment
|
||||
msgid "Has In Payment"
|
||||
msgstr ""
|
||||
|
||||
#. module: initial_engagement_budget
|
||||
#: model:ir.model.fields,help:initial_engagement_budget.field_crossovered_budget_lines__above_remain
|
||||
msgid ""
|
||||
|
|
|
|||
|
|
@ -3,3 +3,5 @@
|
|||
from . import account_budget
|
||||
from . import purchase_request
|
||||
from . import res_config
|
||||
from . import account_payment
|
||||
from . import account_move
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class AccountMove(models.Model):
|
||||
_inherit = "account.move"
|
||||
|
||||
payment_purpose = fields.Char(string='Purpose', compute='_compute_payment_purpose', store=True)
|
||||
has_in_payment = fields.Boolean(compute='_compute_has_in_payment', store=True)
|
||||
|
||||
@api.depends('payment_id.invoice_rec_ids')
|
||||
def _compute_has_in_payment(self):
|
||||
for rec in self:
|
||||
rec.has_in_payment = rec.payment_id and any(
|
||||
inv.move_type == 'in_invoice' for inv in rec.payment_id.invoice_rec_ids)
|
||||
|
||||
@api.depends('payment_id', 'payment_id.invoice_purpose')
|
||||
def _compute_payment_purpose(self):
|
||||
for rec in self:
|
||||
if rec.payment_id:
|
||||
rec.payment_purpose = rec.payment_id.invoice_purpose
|
||||
else:
|
||||
rec.payment_purpose = False
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class AccountPayment(models.Model):
|
||||
_inherit = "account.payment"
|
||||
|
||||
invoice_purpose = fields.Char(string='Purpose', compute='_compute_invoice_purpose', store=True)
|
||||
has_in_invoice = fields.Boolean(compute='_compute_has_in_invoice',store=True)
|
||||
|
||||
@api.depends('invoice_rec_ids.move_type')
|
||||
def _compute_has_in_invoice(self):
|
||||
for rec in self:
|
||||
rec.has_in_invoice = any(inv.move_type == 'in_invoice' for inv in rec.invoice_rec_ids)
|
||||
|
||||
@api.depends('invoice_rec_ids.purpose')
|
||||
def _compute_invoice_purpose(self):
|
||||
for rec in self:
|
||||
purposes = rec.invoice_rec_ids.mapped('purpose')
|
||||
if len(purposes) > 1:
|
||||
rec.invoice_purpose = '/'.join(filter(None, purposes))
|
||||
elif len(purposes) == 1:
|
||||
rec.invoice_purpose = purposes[0]
|
||||
else:
|
||||
rec.invoice_purpose = ''
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<odoo>
|
||||
<record id="account_move_inherit_form_view" model="ir.ui.view">
|
||||
<field name="name">view.move.form.inherit</field>
|
||||
<field name="model">account.move</field>
|
||||
<field name="inherit_id" ref="account.view_move_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@name='journal_div']" position="after">
|
||||
<label for="payment_purpose" attrs="{'invisible': [('has_in_payment', '=', False)]}"/>
|
||||
<div name="payment_purpose_div" class="d-flex" attrs="{'invisible': [('has_in_payment', '=', False)]}">
|
||||
<field name="payment_purpose"/>
|
||||
</div>
|
||||
<field name="has_in_payment" invisible="1"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="account_invoice_inherit_tree_view" model="ir.ui.view">
|
||||
<field name="name">account.move.tree.inherit</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_partner_display_name'][1]" position="after">
|
||||
<field name="purpose"
|
||||
invisible="context.get('default_move_type', '') != 'in_invoice'"
|
||||
optional="show"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="account_move_inherit_tree_view" model="ir.ui.view">
|
||||
<field name="name">account.move.inherit.tree</field>
|
||||
<field name="model">account.move</field>
|
||||
<field name="inherit_id" ref="account.view_move_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="partner_id" position="after">
|
||||
<field name="payment_purpose" optional="show"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<odoo>
|
||||
<record id="view_account_payment_inherit_form" model="ir.ui.view">
|
||||
<field name="name">account.payment.form.custom</field>
|
||||
<field name="model">account.payment</field>
|
||||
<field name="inherit_id" ref="account.view_account_payment_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='move_id']" position="after">
|
||||
<field name="has_in_invoice" invisible="1"/>
|
||||
<field name="invoice_purpose" attrs="{'invisible': [('has_in_invoice', '=', False)]}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
@ -146,6 +146,8 @@ class AccountAsset(models.Model):
|
|||
first_depreciation_date_import = fields.Date(
|
||||
help="In case of an import from another software, provide the first depreciation date in it.")
|
||||
|
||||
product_id = fields.Many2one(comodel_name='product.product', readonly=True, tracking=True)
|
||||
|
||||
@api.depends('depreciation_move_ids.date', 'state')
|
||||
def _compute_disposal_date(self):
|
||||
for asset in self:
|
||||
|
|
@ -694,7 +696,8 @@ class AccountAsset(models.Model):
|
|||
if changes:
|
||||
asset.message_post(body=_('Asset sold or disposed. Accounting entry awaiting for validation.'),
|
||||
tracking_value_ids=tracking_value_ids)
|
||||
move_ids += self.env['account.move'].sudo().search([('asset_id', '=', asset.id), ('state', '=', 'draft')]).ids
|
||||
move_ids += self.env['account.move'].sudo().search(
|
||||
[('asset_id', '=', asset.id), ('state', '=', 'draft')]).ids
|
||||
|
||||
return move_ids
|
||||
|
||||
|
|
|
|||
|
|
@ -146,6 +146,7 @@ class AccountMove(models.Model):
|
|||
vals = {
|
||||
'name': move_line.name,
|
||||
'company_id': move_line.company_id.id,
|
||||
'product_id': move_line.product_id.id,
|
||||
'currency_id': move_line.company_currency_id.id,
|
||||
'account_analytic_id': move_line.analytic_account_id.id,
|
||||
'analytic_tag_ids': [(6, False, move_line.analytic_tag_ids.ids)],
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
'security/security.xml',
|
||||
'data/data.xml',
|
||||
'views/account_payment_views.xml',
|
||||
],
|
||||
'installable': True,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,88 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
<!-- Server Action for Department Manager -->
|
||||
<record id="action_account_multi_depart_manager" model="ir.actions.server">
|
||||
<field name="name">Set to Department Manager (Multi)</field>
|
||||
<field name="type">ir.actions.server</field>
|
||||
<field name="state">code</field>
|
||||
<field name="groups_id" eval="[(4, ref('odex25_account_payment_fix.group_depart_manager'))]"/>
|
||||
<field name="model_id" ref="account.model_account_payment"/>
|
||||
<field name="binding_model_id" ref="account.model_account_payment"/>
|
||||
<field name="binding_view_types">list</field>
|
||||
<field name="code">
|
||||
# Filter records that meet the criteria
|
||||
valid_records = records.filtered(
|
||||
lambda r: r.payment_type == 'outbound' and r.state == 'draft'
|
||||
)
|
||||
|
||||
# Perform the action only on valid records
|
||||
for record in valid_records:
|
||||
record.action_depart_manager()
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Server Action for Accounting Manager -->
|
||||
<record id="action_account_multi_accounting_manager" model="ir.actions.server">
|
||||
<field name="name">Set to Accounting Manager (Multi)</field>
|
||||
<field name="type">ir.actions.server</field>
|
||||
<field name="state">code</field>
|
||||
<field name="groups_id" eval="[(4, ref('odex25_account_payment_fix.group_accounting_manager'))]"/>
|
||||
<field name="model_id" ref="account.model_account_payment"/>
|
||||
<field name="binding_model_id" ref="account.model_account_payment"/>
|
||||
<field name="binding_view_types">list</field>
|
||||
<field name="code">
|
||||
# Filter records that meet the criteria
|
||||
valid_records = records.filtered(
|
||||
lambda r: r.payment_type == 'outbound' and r.state == 'depart_manager'
|
||||
)
|
||||
|
||||
# Perform the action only on valid records
|
||||
for record in valid_records:
|
||||
record.action_accounting_manager()
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Server Action for General Manager -->
|
||||
<record id="action_account_multi_general_manager" model="ir.actions.server">
|
||||
<field name="name">Set to General Manager (Multi)</field>
|
||||
<field name="type">ir.actions.server</field>
|
||||
<field name="state">code</field>
|
||||
<field name="groups_id" eval="[(4, ref('odex25_account_payment_fix.group_general_manager'))]"/>
|
||||
<field name="model_id" ref="account.model_account_payment"/>
|
||||
<field name="binding_model_id" ref="account.model_account_payment"/>
|
||||
<field name="binding_view_types">list</field>
|
||||
<field name="code">
|
||||
# Filter records that meet the criteria
|
||||
valid_records = records.filtered(
|
||||
lambda r: r.payment_type == 'outbound' and r.state == 'accounting_manager'
|
||||
)
|
||||
|
||||
# Perform the action only on valid records
|
||||
for record in valid_records:
|
||||
record.action_general_manager()
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Server Action for Post Payments -->
|
||||
<record id="action_account_multi_post_payments" model="ir.actions.server">
|
||||
<field name="name">Post Payments (Multi)</field>
|
||||
<field name="type">ir.actions.server</field>
|
||||
<field name="state">code</field>
|
||||
<field name="groups_id" eval="[(4, ref('odex25_account_payment_fix.group_posted'))]"/>
|
||||
<field name="model_id" ref="account.model_account_payment"/>
|
||||
<field name="binding_model_id" ref="account.model_account_payment"/>
|
||||
<field name="binding_view_types">list</field>
|
||||
<field name="code">
|
||||
# Filter records that meet the criteria
|
||||
valid_records = records.filtered(
|
||||
lambda r: r.payment_type == 'outbound' and r.state == 'general_manager'
|
||||
)
|
||||
|
||||
# Perform the action only on valid records
|
||||
for record in valid_records:
|
||||
record.action_post()
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
|
|
@ -19,6 +19,7 @@ msgstr ""
|
|||
#: model:ir.model.fields.selection,name:odex25_account_payment_fix.selection__account_payment__state__accounting_manager
|
||||
#: model:res.groups,name:odex25_account_payment_fix.group_accounting_manager
|
||||
#: model_terms:ir.ui.view,arch_db:odex25_account_payment_fix.view_account_payment_form_inherit_odex25_account_accountant
|
||||
#: model_terms:ir.ui.view,arch_db:odex25_account_payment_fix.view_account_payment_inherit_search_view
|
||||
msgid "Accounting Manager"
|
||||
msgstr "المدير المالي"
|
||||
|
||||
|
|
@ -51,6 +52,7 @@ msgstr "ملغي"
|
|||
#: model:ir.model.fields.selection,name:odex25_account_payment_fix.selection__account_payment__state__depart_manager
|
||||
#: model:res.groups,name:odex25_account_payment_fix.group_depart_manager
|
||||
#: model_terms:ir.ui.view,arch_db:odex25_account_payment_fix.view_account_payment_form_inherit_odex25_account_accountant
|
||||
#: model_terms:ir.ui.view,arch_db:odex25_account_payment_fix.view_account_payment_inherit_search_view
|
||||
msgid "Department Manager"
|
||||
msgstr "رئيس القسم"
|
||||
|
||||
|
|
@ -63,6 +65,7 @@ msgstr "مسودة"
|
|||
#: model:ir.model.fields.selection,name:odex25_account_payment_fix.selection__account_payment__state__general_manager
|
||||
#: model:res.groups,name:odex25_account_payment_fix.group_general_manager
|
||||
#: model_terms:ir.ui.view,arch_db:odex25_account_payment_fix.view_account_payment_form_inherit_odex25_account_accountant
|
||||
#: model_terms:ir.ui.view,arch_db:odex25_account_payment_fix.view_account_payment_inherit_search_view
|
||||
msgid "General Manager"
|
||||
msgstr "المدير العام"
|
||||
|
||||
|
|
@ -81,6 +84,21 @@ msgstr "الدفعات"
|
|||
msgid "Post Payment"
|
||||
msgstr "تأكيد"
|
||||
|
||||
#. module: odex25_account_payment_fix
|
||||
#: model:ir.actions.server,name:odex25_account_payment_fix.action_account_multi_accounting_manager
|
||||
msgid "Set to Accounting Manager (Multi)"
|
||||
msgstr "المدير المالي"
|
||||
|
||||
#. module: odex25_account_payment_fix
|
||||
#: model:ir.actions.server,name:odex25_account_payment_fix.action_account_multi_depart_manager
|
||||
msgid "Set to Department Manager (Multi)"
|
||||
msgstr "رئيس القسم"
|
||||
|
||||
#. module: odex25_account_payment_fix
|
||||
#: model:ir.actions.server,name:odex25_account_payment_fix.action_account_multi_post_payments
|
||||
msgid "Post Payments (Multi)"
|
||||
msgstr "نشر الدفعات"
|
||||
|
||||
#. module: odex25_account_payment_fix
|
||||
#: model:ir.model.fields.selection,name:odex25_account_payment_fix.selection__account_payment__state__posted
|
||||
#: model_terms:ir.ui.view,arch_db:odex25_account_payment_fix.view_account_payment_form_inherit_odex25_account_accountant
|
||||
|
|
@ -92,6 +110,11 @@ msgstr "مؤكد"
|
|||
msgid "Set to Draft"
|
||||
msgstr "تحويل إلى مسودة"
|
||||
|
||||
#. module: odex25_account_payment_fix
|
||||
#: model:ir.actions.server,name:odex25_account_payment_fix.action_account_multi_general_manager
|
||||
msgid "Set to General Manager (Multi)"
|
||||
msgstr "المدير العام"
|
||||
|
||||
#. module: odex25_account_payment_fix
|
||||
#: model:ir.model.fields,field_description:odex25_account_payment_fix.field_account_payment__state_history
|
||||
msgid "State History"
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ class AccountPayment(models.Model):
|
|||
('posted', 'Posted'),
|
||||
('cancel', 'Cancelled'),
|
||||
], default='draft', string='Status', required=True, readonly=True, copy=False, tracking=True)
|
||||
state_a = fields.Selection(related='state', tracking=False)
|
||||
state_b = fields.Selection(related='state', tracking=False)
|
||||
|
||||
state_history = fields.Char(string='State History', default='draft')
|
||||
analytic_account_id = fields.Many2one(comodel_name='account.analytic.account', string='Analytic Account', copy=True)
|
||||
|
|
|
|||
|
|
@ -18,38 +18,76 @@
|
|||
<field name="priority" eval="120"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//header" position="replace">
|
||||
<header attrs="{'invisible':[('payment_type','!=','outbound')]}">
|
||||
<button name="action_draft" type="object" string="Set to Draft" states="cancel"
|
||||
<header>
|
||||
<!-- Outbound payment buttons -->
|
||||
<button name="action_draft" type="object" string="Set to Draft"
|
||||
attrs="{'invisible': ['|', ('payment_type', '!=', 'outbound'), ('state', 'not in', ['cancel'])]}"
|
||||
class="oe_highlight"/>
|
||||
<button name="action_depart_manager" type="object" string="Department Manager" states="draft"
|
||||
<button name="action_depart_manager" type="object" string="Department Manager"
|
||||
attrs="{'invisible': ['|', ('payment_type', '!=', 'outbound'), ('state', 'not in', ['draft'])]}"
|
||||
groups="odex25_account_payment_fix.group_depart_manager" class="oe_highlight"/>
|
||||
<button name="action_accounting_manager" type="object" string="Accounting Manager"
|
||||
states="depart_manager" groups="odex25_account_payment_fix.group_accounting_manager"
|
||||
class="oe_highlight"/>
|
||||
attrs="{'invisible': ['|',
|
||||
('payment_type', '!=', 'outbound'),
|
||||
('state', 'not in', ['depart_manager'])]}"
|
||||
groups="odex25_account_payment_fix.group_accounting_manager" class="oe_highlight"/>
|
||||
<button name="action_general_manager" type="object" string="General Manager"
|
||||
states="accounting_manager" groups="odex25_account_payment_fix.group_general_manager"
|
||||
class="oe_highlight"/>
|
||||
<button name="action_post" type="object" string="Posted" states="general_manager"
|
||||
attrs="{'invisible': ['|',
|
||||
('payment_type', '!=', 'outbound'),
|
||||
('state', 'not in', ['accounting_manager'])]}"
|
||||
groups="odex25_account_payment_fix.group_general_manager" class="oe_highlight"/>
|
||||
<button name="action_post" type="object" string="Posted"
|
||||
attrs="{'invisible': ['|',
|
||||
('payment_type', '!=', 'outbound'),
|
||||
('state', 'not in', ['general_manager'])]}"
|
||||
groups="odex25_account_payment_fix.group_posted" class="oe_highlight"/>
|
||||
<button name="action_cancel" type="object" string="Cancel"
|
||||
attrs="{'invisible': ['|',
|
||||
('payment_type', '!=', 'outbound'),
|
||||
('state', 'not in', ['draft', 'depart_manager', 'accounting_manager', 'general_manager', 'posted'])]}"
|
||||
groups="odex25_account_payment_fix.group_cancel"
|
||||
states="draft,depart_manager,accounting_manager,general_manager,posted"
|
||||
class="oe_highlight"/>
|
||||
<field name="state" widget="statusbar"
|
||||
statusbar_visible="draft,depart_manager,accounting_manager,general_manager,posted"/>
|
||||
</header>
|
||||
<header attrs="{'invisible':[('payment_type','=','outbound')]}">
|
||||
<button name="action_draft" type="object" string="Set to Draft" states="cancel"
|
||||
class="oe_highlight"/>
|
||||
<button name="action_post" type="object" string="Posted" states="draft" class="oe_highlight"/>
|
||||
<button name="action_cancel" type="object" string="Cancel"
|
||||
states="draft,posted"
|
||||
class="oe_highlight"/>
|
||||
<field name="state" widget="statusbar"
|
||||
statusbar_visible="draft,posted"/>
|
||||
</header>
|
||||
|
||||
<!-- Inbound or other payment types -->
|
||||
<button name="action_draft" type="object" string="Set to Draft"
|
||||
attrs="{'invisible': ['|',
|
||||
('payment_type', '=', 'outbound'),
|
||||
('state', 'not in', ['cancel'])]}" class="oe_highlight"/>
|
||||
<button name="action_post" type="object" string="Posted"
|
||||
attrs="{'invisible': ['|',
|
||||
('payment_type', '=', 'outbound'),
|
||||
('state', 'not in', ['draft'])]}" class="oe_highlight"/>
|
||||
|
||||
<button name="action_cancel" type="object" string="Cancel" attrs="{'invisible': ['|',
|
||||
('payment_type', '=', 'outbound'),
|
||||
('state', 'not in', ['draft', 'posted'])]}" class="oe_highlight"/>
|
||||
|
||||
<!-- Statusbar: show different states conditionally -->
|
||||
<field name="state" widget="statusbar" invisible="1"/>
|
||||
<field name="state_a" widget="statusbar"
|
||||
statusbar_visible="draft,depart_manager,accounting_manager,general_manager,posted"
|
||||
attrs="{'invisible': [('payment_type', '!=', 'outbound')]}"/>
|
||||
<field name="state_b" widget="statusbar"
|
||||
statusbar_visible="draft,posted" attrs="{'invisible': [('payment_type', '=', 'outbound')]}"/>
|
||||
</header>
|
||||
</xpath>
|
||||
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_account_payment_inherit_search_view" model="ir.ui.view">
|
||||
<field name="name">account.payment.search</field>
|
||||
<field name="model">account.payment</field>
|
||||
<field name="inherit_id" ref="account.view_account_payment_search"/>
|
||||
<field name="arch" type="xml">
|
||||
<filter name="state_draft" position="after">
|
||||
<filter string="Department Manager" name="state_depart_manager"
|
||||
domain="[('state', '=', 'depart_manager')]"/>
|
||||
<filter string="Accounting Manager" name="state_accounting_manager"
|
||||
domain="[('state', '=', 'accounting_manager')]"/>
|
||||
<filter string="General Manager" name="state_general_manager"
|
||||
domain="[('state', '=', 'general_manager')]"/>
|
||||
</filter>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,11 @@ msgstr "تم الإنشاء بواسطة"
|
|||
msgid "Journal Entry"
|
||||
msgstr "قيد اليومية"
|
||||
|
||||
#. module: petty_invoice
|
||||
#: model_terms:ir.ui.view,arch_db:petty_invoice.view_account_invoice_filter
|
||||
msgid "Not Paid by Petty Cash"
|
||||
msgstr "غير منصرف من العهد"
|
||||
|
||||
#. module: petty_invoice
|
||||
#: model:ir.model.fields,field_description:petty_invoice.field_account_bank_statement_line__is_petty_paid
|
||||
#: model:ir.model.fields,field_description:petty_invoice.field_account_move__is_petty_paid
|
||||
|
|
|
|||
|
|
@ -10,11 +10,14 @@
|
|||
<field name="is_petty_paid"/>
|
||||
<filter name="is_petty_paid" string="Paid by Petty Cash"
|
||||
domain="[('is_petty_paid', '=',True)]"/>
|
||||
<filter name="not_petty_paid" string="Not Paid by Petty Cash"
|
||||
domain="[('is_petty_paid', '=', False)]"/>
|
||||
|
||||
</xpath>
|
||||
<xpath expr="//group" position="inside">
|
||||
<filter name="group_by_created_by" string="Created By" context="{'group_by':'create_uid'}"/>
|
||||
<filter name="group_by_petty_employee_id" string="Petty Cashier" context="{'group_by':'petty_employee_id'}"/>
|
||||
<filter name="group_by_petty_employee_id" string="Petty Cashier"
|
||||
context="{'group_by':'petty_employee_id'}"/>
|
||||
</xpath>
|
||||
|
||||
</field>
|
||||
|
|
|
|||
Loading…
Reference in New Issue