commit
14428a7c40
|
|
@ -67,6 +67,7 @@
|
||||||
'wizards/family_bank_report_wizard.xml',
|
'wizards/family_bank_report_wizard.xml',
|
||||||
'views/visit_survey.xml',
|
'views/visit_survey.xml',
|
||||||
'views/res_partner_view.xml',
|
'views/res_partner_view.xml',
|
||||||
|
'views/account_move_view.xml',
|
||||||
'views/actions_and_menus.xml',
|
'views/actions_and_menus.xml',
|
||||||
'reports/family_bank_report.xml',
|
'reports/family_bank_report.xml',
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -18436,4 +18436,26 @@ msgstr "موافقة مدير الفرع للاستثناء"
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid ""
|
msgid ""
|
||||||
"She has a physical or intellectual disability but is over %s years of age."
|
"She has a physical or intellectual disability but is over %s years of age."
|
||||||
msgstr "لديها إعاقة جسدية أو عقلية ولكنها تجاوزت %s سنة من العمر."
|
msgstr "لديها إعاقة جسدية أو عقلية ولكنها تجاوزت %s سنة من العمر."
|
||||||
|
|
||||||
|
#. module: odex_benefit
|
||||||
|
#: code:addons/odex_benefit/models/payment_order.py:0
|
||||||
|
#: model_terms:ir.ui.view,arch_db:odex_benefit.payment_orders_form
|
||||||
|
#, python-format
|
||||||
|
msgid "Moves"
|
||||||
|
msgstr "القيد المحاسبي"
|
||||||
|
|
||||||
|
#. module: odex_benefit
|
||||||
|
#: model:ir.model.fields,field_description:odex_benefit.field_account_move__required_attachment_line_count
|
||||||
|
#: model:ir.model.fields,field_description:odex_benefit.field_payment_orders__attachment_line_count
|
||||||
|
msgid "Required Attachments"
|
||||||
|
msgstr "عدد المرفقات المطلوبة"
|
||||||
|
|
||||||
|
#. module: odex_benefit
|
||||||
|
#: code:addons/odex_benefit/models/account_move_line.py:0
|
||||||
|
#: code:addons/odex_benefit/models/payment_order.py:0
|
||||||
|
#: model_terms:ir.ui.view,arch_db:odex_benefit.account_move_inherit_form_view
|
||||||
|
#: model_terms:ir.ui.view,arch_db:odex_benefit.payment_orders_form
|
||||||
|
#, python-format
|
||||||
|
msgid "Service Required Attachments"
|
||||||
|
msgstr "المرفقات المطلوبة للخدمات"
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from odoo import models,fields
|
from odoo import models,fields,_
|
||||||
|
|
||||||
|
|
||||||
class AccountMoveLine(models.Model):
|
class AccountMoveLine(models.Model):
|
||||||
|
|
@ -11,4 +11,42 @@ class AccountMove(models.Model):
|
||||||
_inherit = 'account.move'
|
_inherit = 'account.move'
|
||||||
family_confirm_id = fields.Many2one(comodel_name='confirm.benefit.expense', string='Benefit Family')
|
family_confirm_id = fields.Many2one(comodel_name='confirm.benefit.expense', string='Benefit Family')
|
||||||
benefit_family_ids = fields.Many2many(comodel_name='grant.benefit',relation='account_move_grant_family_rel',
|
benefit_family_ids = fields.Many2many(comodel_name='grant.benefit',relation='account_move_grant_family_rel',
|
||||||
column1='move_id',column2='family_id', string='Benefit Family')
|
column1='move_id',column2='family_id', string='Benefit Family')
|
||||||
|
required_attachment_line_count = fields.Integer(string="Required Attachments",compute='_compute_required_attachment_line_count',store=False,)
|
||||||
|
|
||||||
|
def _compute_required_attachment_line_count(self):
|
||||||
|
for move in self:
|
||||||
|
payment_order = self.env['payment.orders'].search([
|
||||||
|
('move_id', '=', move.id),
|
||||||
|
('type', '=', 'services')
|
||||||
|
], limit=1)
|
||||||
|
|
||||||
|
if not payment_order or not payment_order.service_requests_ids:
|
||||||
|
move.required_attachment_line_count = 0
|
||||||
|
continue
|
||||||
|
all_lines = payment_order.service_requests_ids.mapped('attachment_lines')
|
||||||
|
move.required_attachment_line_count = len(all_lines)
|
||||||
|
|
||||||
|
def action_view_service_attachments(self):
|
||||||
|
|
||||||
|
payment_order = self.env['payment.orders'].search([
|
||||||
|
('move_id', '=', self.id),
|
||||||
|
('type', '=', 'services')
|
||||||
|
], limit=1)
|
||||||
|
|
||||||
|
attachment_ids = payment_order.service_requests_ids.mapped('attachment_lines').ids
|
||||||
|
|
||||||
|
ctx = self.env.context.copy()
|
||||||
|
ctx.update({
|
||||||
|
'create': False, 'edit': False, 'delete': False,
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
'name': _('Service Required Attachments'),
|
||||||
|
'type': 'ir.actions.act_window',
|
||||||
|
'res_model': 'service.attachments.settings',
|
||||||
|
'view_mode': 'tree,form',
|
||||||
|
'domain': [('id', 'in', attachment_ids)],
|
||||||
|
'context': ctx,
|
||||||
|
'target': 'current',
|
||||||
|
}
|
||||||
|
|
@ -53,6 +53,31 @@ class PaymentOrders(models.Model):
|
||||||
currency_id = fields.Many2one('res.currency', string='Currency',
|
currency_id = fields.Many2one('res.currency', string='Currency',
|
||||||
related='company_id.currency_id')
|
related='company_id.currency_id')
|
||||||
can_user_act = fields.Boolean(compute='_compute_can_user_act', store=False)
|
can_user_act = fields.Boolean(compute='_compute_can_user_act', store=False)
|
||||||
|
attachment_line_count = fields.Integer(string="Required Attachments",compute='_compute_attachment_lines',store=False)
|
||||||
|
|
||||||
|
def _compute_attachment_lines(self):
|
||||||
|
for record in self:
|
||||||
|
if not record.service_requests_ids:
|
||||||
|
record.attachment_line_count = 0
|
||||||
|
continue
|
||||||
|
all_lines = record.service_requests_ids.mapped('attachment_lines')
|
||||||
|
record.attachment_line_count = len(all_lines)
|
||||||
|
|
||||||
|
def action_view_all_required_attachments(self):
|
||||||
|
self.ensure_one()
|
||||||
|
ctx = self.env.context.copy()
|
||||||
|
ctx.update({
|
||||||
|
'create': False, 'edit': False, 'delete': False,
|
||||||
|
})
|
||||||
|
return {
|
||||||
|
'name': _('Service Required Attachments'),
|
||||||
|
'type': 'ir.actions.act_window',
|
||||||
|
'res_model': 'service.attachments.settings',
|
||||||
|
'view_mode': 'tree,form',
|
||||||
|
'domain': [('id', 'in', self.service_requests_ids.mapped('attachment_lines').ids)],
|
||||||
|
'context': ctx,
|
||||||
|
'target': 'current',
|
||||||
|
}
|
||||||
|
|
||||||
@api.depends('state')
|
@api.depends('state')
|
||||||
@api.depends_context('uid')
|
@api.depends_context('uid')
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
<!-- Inherit Form View to Modify it -->
|
||||||
|
<odoo>
|
||||||
|
<record id="account_move_inherit_form_view" model="ir.ui.view">
|
||||||
|
<field name="name">account.move.inherit.form</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='button_box']" position="inside">
|
||||||
|
<button name="action_view_service_attachments"
|
||||||
|
type="object"
|
||||||
|
class="oe_stat_button"
|
||||||
|
icon="fa-paperclip"
|
||||||
|
attrs="{'invisible': [('required_attachment_line_count', '=', 0)]}">
|
||||||
|
<field name="required_attachment_line_count" string="Service Required Attachments"
|
||||||
|
widget="statinfo"/>
|
||||||
|
</button>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
||||||
|
|
@ -1572,5 +1572,41 @@
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
<record id="view_service_attachments_settings_tree" model="ir.ui.view">
|
||||||
|
<field name="name">service.attachments.settings.tree</field>
|
||||||
|
<field name="model">service.attachments.settings</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree>
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="service_request_id"/>
|
||||||
|
<field name="service_attach" widget="many2many_attachment_preview"/>
|
||||||
|
<field name="notes"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record id="view_service_attachments_settings_form" model="ir.ui.view">
|
||||||
|
<field name="name">service.attachments.settings.form</field>
|
||||||
|
<field name="model">service.attachments.settings</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form>
|
||||||
|
<sheet>
|
||||||
|
<div class="oe_title">
|
||||||
|
<h1>
|
||||||
|
<field name="name" class="oe_inline"/>
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
<group>
|
||||||
|
<group>
|
||||||
|
<field name="service_request_id"/>
|
||||||
|
<field name="service_attach" widget="many2many_attachment_preview"/>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<field name="notes"/>
|
||||||
|
</group>
|
||||||
|
</group>
|
||||||
|
</sheet>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
</data>
|
</data>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,13 @@
|
||||||
type="object" attrs="{'invisible': [('move_count','=',0)]}">
|
type="object" attrs="{'invisible': [('move_count','=',0)]}">
|
||||||
<field name="move_count" string="Moves" widget="statinfo"/>
|
<field name="move_count" string="Moves" widget="statinfo"/>
|
||||||
</button>
|
</button>
|
||||||
|
<button name="action_view_all_required_attachments"
|
||||||
|
type="object" class="oe_stat_button"
|
||||||
|
icon="fa-paperclip"
|
||||||
|
attrs="{'invisible': ['|',('attachment_line_count', '=', 0),('type','!=','services')]}">
|
||||||
|
<field name="attachment_line_count" string="Service Required Attachments"
|
||||||
|
widget="statinfo"/>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<group>
|
<group>
|
||||||
<div class="oe_title">
|
<div class="oe_title">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue