Merge pull request #1275 from expsa/dev_odex25_ensan

Dev odex25 ensan
This commit is contained in:
Mostafa 2024-09-24 16:38:01 -07:00 committed by GitHub
commit 4fb1bb9aa7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 222 additions and 66 deletions

View File

@ -8,7 +8,7 @@
'license': 'GPL-3',
'author': 'Expert Ltd',
'depends': ['base', 'takaful_core', 'website', 'account', 'report_xlsx', 'sale', 'product', 'stock', 'hr',
'purchase', 'branch'],
'purchase'],
'data': [
'security/security_view.xml',
'security/ir.model.access.csv',

View File

@ -6,7 +6,7 @@ from . import housing_config
from . import generate_reports
from . import Services
from . import sms
from . import branch_inherit
# from . import branch_inherit
from . import visit
from . import main_service
from . import member_location

View File

@ -5,6 +5,7 @@ class AccountMoveLine(models.Model):
_inherit = 'account.move.line'
benefit_family_id = fields.Many2one(comodel_name='grant.benefit', string='Benefit Family')
family_confirm_id = fields.Many2one(comodel_name='confirm.benefit.expense', string='Benefit Family')
family_code = fields.Char(string='Family Code', related='benefit_family_id.code',readonly=True)
class AccountMove(models.Model):
_inherit = 'account.move'

View File

@ -42,7 +42,8 @@ class GrantBenefitProfile(models.Model):
if self.env.user and self.env.user.id and self.env.user.has_group("odex_benefit.group_benefit_researcher") and not self.env.user.has_group("odex_benefit.group_benefit_manager"):
args += [('researcher_id.employee_id', '=', self.env.user.employee_id.id)]
if self.env.user and self.env.user.id and (self.env.user.has_group("odex_benefit.group_benefit_woman_commitee") or self.env.user.has_group("odex_benefit.group_benefit_branch_manager")) and not self.env.user.has_group("odex_benefit.group_benefit_manager"):
args += [('branch_id', '=', self.env.user.employee_id.department_id.id)]
if self.branch_custom_id:
args += [('branch_custom_id.branch_id', '=', self.env.user.employee_id.department_id.id)]
if self.env.user and self.env.user.id and self.env.user.has_group("odex_benefit.group_benefit_manager"):
args += []
return super(GrantBenefitProfile, self).search(args, offset, limit, order, count)
@ -356,8 +357,8 @@ class GrantBenefitProfile(models.Model):
('not_leaving', 'Not Leaving'),
('black_list', 'Black List'),
], string='state', default="draft", tracking=True)
branch_id = fields.Many2one('hr.department', string="Branch", domain=[('is_branch', '=', True)])
district_id = fields.Many2one('res.districts', string="District", domain="[('branch_id','=',branch_id)]")
branch_custom_id = fields.Many2one('branch.settings', string="Branch")
district_id = fields.Many2one('res.districts', string="District", domain="[('branch_custom_id','=',branch_custom_id)]")
meal_card = fields.Boolean(string="Meal Card",related="district_id.meal_card", store=True,related_sudo=True)
attachment_ids = fields.One2many('ir.attachment', 'benefit_id')
family_debits_ids = fields.One2many('family.debits', 'benefit_id')
@ -871,7 +872,7 @@ class GrantBenefitProfile(models.Model):
if self.old_stage == 'draft':
entity.state = 'draft'
else:
entity.state = 'approve'
entity.state = 'second_approve'
entity.black_list_message = False
user = self.env['res.users'].search([('partner_id', '=', entity.partner_id.id)], limit=1)
user.toggle_active()
@ -939,7 +940,7 @@ class GrantBenefitProfile(models.Model):
for rec in self:
rec.expenses_ids = False
for expenses in rec.benefit_category_id:
if expenses.state == 'approve':
if expenses.state == 'second_pprove':
for i in expenses.expenses_ids:
expenses = {}
expenses['expenses_type'] = i.expenses_type
@ -1246,7 +1247,7 @@ class GrantBenefitProfile(models.Model):
[('mini_income_amount', '<=', rec.member_income), ('max_income_amount', '>=', rec.member_income)])
rec.benefit_category_id = result.id
else:
rec.benefit_category_id = 1
rec.benefit_category_id = None
def open_followers(self):
context = {}
@ -1510,7 +1511,7 @@ class GrantBenefitProfile(models.Model):
# print("continue")
def create_scheduled_visit(self):
records = self.env["grant.benefit"].search([('state', '=', 'approve')])
records = self.env["grant.benefit"].search([('state', '=', 'second_approve')])
for rec in records:
self.env['visit.location'].create({
'benefit_id': rec.id,

View File

@ -531,7 +531,7 @@ class Committees(models.Model):
('both', 'combined'),
],
required=False, )
branch_id = fields.Many2one("hr.department", string="Branch")
branch_custom_id = fields.Many2one("branch.settings", string="Branch")
def get_benefit_ids(self):
obj = self.env["grant.benefit"].search([])
@ -545,7 +545,7 @@ class ResDistricts(models.Model):
_name = 'res.districts'
name = fields.Char(string="Name")
branch_id = fields.Many2one("hr.department", string="Branch",domain=[('is_branch','=',True)])
branch_custom_id = fields.Many2one("branch.settings", string="Branch")
meal_card = fields.Boolean(string='Meal Card')
class VisitsSettings(models.Model):
@ -562,4 +562,16 @@ class SuspendReason(models.Model):
_name = 'suspend.reason'
_description = "Suspend - Reason"
name = fields.Char(string="Name")
name = fields.Char(string="Name")
class BranchSettings(models.Model):
_name = 'branch.settings'
_description = "Branch Settings"
name = fields.Char(related='branch.name')
branch = fields.Many2one('hr.department',string='Branch',domain =[('is_branch', '=', True)])
branch_type = fields.Selection(
selection=[
('branches', 'Branches'),
('governorates', 'Governorates')],
string='Branch Type')

View File

@ -15,10 +15,10 @@ class ChangesRequests(models.Model):
('transfer_research_from_branch_to_another_branch', 'Transfer Research From Branch To Another Branch')],default="transfer_family_from_research_to_another_research")
benefit_id = fields.Many2one("grant.benefit", string='Family')
researcher_id = fields.Many2one("committees.line",compute="get_researcher_id",string='Researcher Team',store=True)
branch_id = fields.Many2one("hr.department",compute="get_branch_id",string='Branch',store=True)
new_branch_id = fields.Many2one("hr.department",string='New Branch')
new_researcher_id = fields.Many2one("committees.line", domain ="['&',('branch_id','=',branch_id),('id','!=',researcher_id)]",string='New Researcher Team')
new_branch_researcher = fields.Many2one("committees.line", domain ="[('branch_id','=',new_branch_id)]",string='New Researcher Team')
branch_custom_id = fields.Many2one("branch.settings",compute="get_branch_id",string='Branch',store=True)
new_branch_id = fields.Many2one("branch.settings",string='New Branch')
new_researcher_id = fields.Many2one("committees.line", domain ="['&',('branch_custom_id','=',branch_custom_id),('id','!=',researcher_id)]",string='New Researcher Team')
new_branch_researcher = fields.Many2one("committees.line", domain ="[('branch_custom_id','=',new_branch_id)]",string='New Researcher Team')
execution_date = fields.Datetime(string="Transfer Execution Date")
state = fields.Selection(
string='State',
@ -35,9 +35,9 @@ class ChangesRequests(models.Model):
('both', 'Both')])
gender_researcher_id = fields.Many2one("committees.line",domain ="[('type','=',team_type)]",string='Researcher Team')
is_whole_team = fields.Boolean(string='Is Whole Team?')
researcher_branch_id = fields.Many2one("hr.department",compute = "get_researcher_branch_id", store = True,string='Branch')
new_gender_researcher_id = fields.Many2one("committees.line",domain ="['&',('branch_id','=',researcher_branch_id),('id','!=',gender_researcher_id)]",string='Alternative Researcher Team for family')
new_gender_researcher_one = fields.Many2one("committees.line",domain ="[('branch_id','=',new_branch_id)]",string='Alternative Researcher Team for researcher')
researcher_branch_id = fields.Many2one("branch.settings",compute = "get_researcher_branch_id", store = True,string='Branch')
new_gender_researcher_id = fields.Many2one("committees.line",domain ="['&',('branch_custom_id','=',researcher_branch_id),('id','!=',gender_researcher_id)]",string='Alternative Researcher Team for family')
new_gender_researcher_one = fields.Many2one("committees.line",domain ="[('branch_custom_id','=',new_branch_id)]",string='Alternative Researcher Team for researcher')
researcher_ids = fields.Many2many("hr.employee", string="Researcher",readonly=False)
@api.onchange('gender_researcher_id')
@ -50,11 +50,11 @@ class ChangesRequests(models.Model):
@api.depends("benefit_id")
def get_branch_id(self):
for rec in self:
rec.branch_id = rec.benefit_id.branch_id
rec.branch_custom_id = rec.benefit_id.branch_custom_id
@api.depends("gender_researcher_id")
def get_researcher_branch_id(self):
for rec in self:
rec.researcher_branch_id = rec.gender_researcher_id.branch_id
rec.researcher_branch_id = rec.gender_researcher_id.branch_custom_id
def approval_of_department_head_c1(self):
for rec in self:
@ -79,7 +79,7 @@ class ChangesRequests(models.Model):
def approval_of_branch_manager_c2(self):
for rec in self:
rec.state = 'approval_of_branch_manager'
rec.benefit_id.branch_id = rec.new_branch_id
rec.benefit_id.branch_custom_id = rec.new_branch_id
rec.benefit_id.researcher_id = rec.new_branch_researcher
message = "Your family has been transferred to another branch %s" % (self.new_branch_id.name)
mail = self.env['mail.mail'].create({
@ -96,7 +96,7 @@ class ChangesRequests(models.Model):
obj = self.env["grant.benefit"].search([])
for rec in self:
rec.state = 'approval_of_branch_manager'
rec.gender_researcher_id.branch_id = rec.new_branch_id
rec.gender_researcher_id.branch_custom_id = rec.new_branch_id
for item in obj.filtered(lambda r: r.researcher_id == rec.gender_researcher_id):
item.researcher_id = rec.new_gender_researcher_id
if rec.is_whole_team == False:

View File

@ -11,6 +11,9 @@ class ConfirmBenefitExpense(models.Model):
state = fields.Selection([
('draft', 'Draft'),
('depart_manager', 'Department Manager'),
('account_manager', 'Account Manager'),
('cancel', 'Cancelled'),
('confirm', 'Confirmed'),
], string='Status', default='draft', required=True, copy=False)
expense_type = fields.Selection([
@ -47,8 +50,32 @@ class ConfirmBenefitExpense(models.Model):
available_payment_method_line_ids = fields.Many2many('account.payment.method.line',
compute='_compute_payment_method_line_fields')
total_moves = fields.Integer(string="Total Move Lines", compute='_get_total_move_lines')
total_move_lines = fields.Integer(string="Total Move Lines", compute='_get_total_move_lines')
total_invoices = fields.Integer(string="Total Moves", compute='_get_total_move_lines')
family_monthly_income = fields.Float(string="Total Monthly Income", compute='_get_family_monthly_values')
family_monthly_meals = fields.Float(string="Total Monthly Meals", compute='_get_family_monthly_values')
family_monthly_clotting = fields.Float(string="Total Monthly Clotting", compute='_get_family_monthly_values')
@api.depends('family_ids')
def _get_family_monthly_values(self):
for rec in self:
rec.family_monthly_income = sum(rec.family_ids.mapped('family_monthly_income'))
rec.family_monthly_meals = sum(rec.family_ids.mapped('family_monthly_meals'))
rec.family_monthly_clotting = sum(rec.family_ids.mapped('family_monthly_clotting'))
def action_depart_manager(self):
self.state = 'depart_manager'
def action_accounting_manager(self):
self.state = 'account_manager'
def action_cancel(self):
self.state = 'cancel'
def action_reset_to_draft(self):
self.state = 'draft'
@api.constrains('expense_type', 'cash_expense', 'meal_expense', 'cloth_expense')
def _constraint_check_at_least_one_expense(self):
for rec in self:
@ -64,6 +91,9 @@ class ConfirmBenefitExpense(models.Model):
rec.total_invoices = self.env['account.move'].search_count([
('family_confirm_id', '=', rec.id), ('move_type', '=', 'in_invoice')
])
rec.total_move_lines = len(self.env['account.move'].search([
('family_confirm_id', '=', rec.id), ('move_type', '!=', 'in_invoice')
]).mapped('line_ids').ids)
def action_open_related_move_records(self):
""" Opens a tree view with related records filtered by a dynamic domain """
@ -79,6 +109,19 @@ class ConfirmBenefitExpense(models.Model):
'domain': [('id', 'in', moves)],
}
def action_open_related_move_line_records(self):
""" Opens a tree view with related records filtered by a dynamic domain """
move_lines = self.env['account.move'].search([
('family_confirm_id', '=', self.id), ('move_type', '!=', 'in_invoice')
]).mapped('line_ids').ids
return {
'name': _('Moves'),
'type': 'ir.actions.act_window',
'res_model': 'account.move.line',
'view_mode': 'tree,form',
'domain': [('id', 'in', move_lines)],
}
def action_open_related_invoice_records(self):
""" Opens a tree view with related records filtered by a dynamic domain """
invoices = self.env['account.move'].search([
@ -200,8 +243,9 @@ class ConfirmBenefitExpense(models.Model):
'name': f'{family.name}/{family.code}', # Family name as the description
'account_id': account_id.id, # The same account for all lines
'quantity': 1, # Qty is 1
# The same analytic account
'price_unit': family.benefit_member_count * validation_setting.meal_expense,
'analytic_account_id': family.branch_id.analytic_account_id.id,
'analytic_account_id': family.branch_custom_id.analytic_account_id.id
}))
# Create the invoice
@ -224,6 +268,7 @@ class ConfirmBenefitExpense(models.Model):
def _prepare_entry_lines(self, benefit, validation_setting, credit_account_id):
"""Prepare debit and credit lines for a benefit"""
entry_lines = []
total_credit_amount = 0 # To accumulate the total credit amount
expense_types = [
('meal', 'meal_expense', validation_setting.meal_expense_account_id.id),
@ -233,6 +278,8 @@ class ConfirmBenefitExpense(models.Model):
for expense_type, field, debit_account_id in expense_types:
amount = benefit.benefit_member_count * getattr(validation_setting, field, 0.0)
# Skip conditions based on expense type
if (benefit.district_id.meal_card and expense_type == 'meal') or (
not self.meal_expense and expense_type == 'meal'):
continue
@ -240,10 +287,18 @@ class ConfirmBenefitExpense(models.Model):
continue
if not self.cloth_expense and expense_type == 'clothing':
continue
# If there's an amount, create a debit line and accumulate the credit amount
if amount:
name = _("Family Expense - %s") % expense_type
entry_lines.append(self._create_debit_line(benefit, debit_account_id, amount, name))
entry_lines.append(self._create_credit_line(benefit, credit_account_id, amount, name))
total_credit_amount += amount
# Create a single credit line with the total amount after looping
if total_credit_amount:
credit_line_name = _("Total Credit for Family Expenses")
entry_lines.append(
self._create_credit_line(benefit, credit_account_id, total_credit_amount, credit_line_name))
return entry_lines
@ -254,7 +309,7 @@ class ConfirmBenefitExpense(models.Model):
'family_confirm_id': self.id,
'benefit_family_id': benefit.id,
'partner_id': benefit.partner_id.id,
'analytic_account_id': benefit.branch_id.analytic_account_id.id,
'analytic_account_id': benefit.branch_custom_id.analytic_account_id.id,
'account_id': account_id,
'debit': amount,
'credit': 0.0,
@ -267,7 +322,7 @@ class ConfirmBenefitExpense(models.Model):
'family_confirm_id': self.id,
'benefit_family_id': benefit.id,
'partner_id': benefit.partner_id.id,
'analytic_account_id': benefit.branch_id.analytic_account_id.id,
'analytic_account_id': benefit.branch_custom_id.analytic_account_id.id,
'account_id': account_id,
'debit': 0.0,
'credit': amount,
@ -283,5 +338,6 @@ class ConfirmBenefitExpense(models.Model):
'benefit_family_ids': [(6, 0, self.family_ids.ids)],
'line_ids': lines,
}
self.env['account.move'].create(move_vals)
move_id = self.env['account.move'].create(move_vals)
move_id.action_post()
return True

View File

@ -394,7 +394,7 @@ class FamilyMemberProfile(models.Model):
self.state_a = 'waiting_approve'
def action_accepted(self):
"""Accept registration"""
self.state_a = "approve"
self.state_a = "second_approve"
def action_first_refusal(self):
"""First refusal to entity registration"""
domain = []

View File

@ -4,15 +4,16 @@ class HrDepartment(models.Model):
_inherit = 'hr.department'
operation_manager_id = fields.Many2one('hr.employee', string='Operation Manager')
def name_get(self):
result = []
for department in self:
name = department.name
result.append((department.id, name))
return result
# def name_get(self):
# result = []
# for department in self:
# name = department.name
# result.append((department.id, name))
# return result
# def name_get(self):
# result = []
# print(self.env.context) # Log the context for debugging
# if self.env.context.get('special_display_name', True):
# for department in self:
# name = department.name

View File

@ -107,4 +107,5 @@ access_education_result,access_education_result,model_education_result,,1,1,1,1
access_study_material,access_study_material,model_study_material,,1,1,1,1
access_suspend_reason,access_suspend_reason,model_suspend_reason,,1,1,1,1
access_suspend_reason_wizard,access_suspend_reason_wizard,model_suspend_reason_wizard,,1,1,1,1
access_confirm_benefit_expense,access_confirm_benefit_expense,model_confirm_benefit_expense,base.group_user,1,1,1,1
access_confirm_benefit_expense,access_confirm_benefit_expense,model_confirm_benefit_expense,base.group_user,1,1,1,1
access_branch_settings,access_branch_settings,model_branch_settings,base.group_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
107 access_study_material access_study_material model_study_material 1 1 1 1
108 access_suspend_reason access_suspend_reason model_suspend_reason 1 1 1 1
109 access_suspend_reason_wizard access_suspend_reason_wizard model_suspend_reason_wizard 1 1 1 1
110 access_confirm_benefit_expense access_confirm_benefit_expense model_confirm_benefit_expense base.group_user 1 1 1 1
111 access_branch_settings access_branch_settings model_branch_settings base.group_user 1 1 1 1

View File

@ -184,16 +184,16 @@
</p>
</field>
</record>
<!-- <record model="ir.actions.act_window" id="res_branch_action">-->
<!-- <field name="name">Branch Settings</field>-->
<!-- <field name="res_model">res.branch</field>-->
<!--&lt;!&ndash; <field name="view_type">form</field>&ndash;&gt;-->
<!-- <field name="view_mode">tree,form</field>-->
<!-- <field name="help" type="html">-->
<!-- <p class="oe_view_nocontent_create">Create the First Branch-->
<!-- </p>-->
<!-- </field>-->
<!-- </record>-->
<record model="ir.actions.act_window" id="res_branch_action">
<field name="name">Branch Settings</field>
<field name="res_model">branch.settings</field>
<!-- <field name="view_type">form</field>-->
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">Create the First Branch
</p>
</field>
</record>
<record model="ir.actions.act_window" id="districts_action">
<field name="name">Districts</field>
@ -732,8 +732,8 @@
parent="menu_benefits_config_addresses" action="action_country_state_benefit"/>
<menuitem id="res_city_menu" name="Cities" sequence="2"
parent="menu_benefits_config_addresses" action="res_city_list_action"/>
<!-- <menuitem id="res_branch_menu" name="Branch Settings" sequence="3"-->
<!-- parent="menu_benefits_config_addresses" action="branch.branch_action_res_branch"/>-->
<menuitem id="res_branch_menu" name="Branch Settings" sequence="3"
parent="menu_benefits_config_addresses" action="res_branch_action"/>
<menuitem id="res_district_menu" name="Districts" sequence="4"
parent="menu_benefits_config_addresses" action="districts_action"/>
<menuitem

View File

@ -271,7 +271,7 @@
<sheet>
<group>
<field name="name"/>
<field name="branch_id"/>
<field name="branch_custom_id"/>
<field name="meal_card"/>
</group>
</sheet>
@ -816,7 +816,7 @@
<field name="arch" type="xml">
<tree string="Districts">
<field name="name"/>
<field name="branch_id"/>
<field name="branch_custom_id"/>
<field name="meal_card"/>
</tree>
</field>
@ -932,5 +932,31 @@
</tree>
</field>
</record>
<record id="branch_settings_form" model="ir.ui.view">
<field name="name">Branch Settings</field>
<field name="model">branch.settings</field>
<field name="arch" type="xml">
<form>
<sheet>
<group>
<group>
<field name="branch"/>
<field name="branch_type"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<record id="branch_settings_tree" model="ir.ui.view">
<field name="name">Branch Settings</field>
<field name="model">branch.settings</field>
<field name="arch" type="xml">
<tree>
<field name="branch" context="{'hierarchical_naming': False}"/>
<field name="branch_type"/>
</tree>
</field>
</record>
</data>
</odoo>

View File

@ -539,7 +539,7 @@
readonly="1" string="Region"/>
<field name="city_id" attrs="{'required':[('state','!=','draft')],'readonly':[('state','not in',['draft','complete_info','edit_info'])]}"
string="City"/>
<field name="branch_id" required="1" attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])]}"/>
<field name="branch_custom_id" attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])]}"/>
<field name="district_id"
attrs="{'required':[('state','!=','draft')],'readonly':[('state','not in',['draft','complete_info','edit_info'])]}"/>
<field name="zip" attrs="{'required':[('state','!=','draft')],'readonly':[('state','not in',['draft','complete_info','edit_info'])]}"/>

View File

@ -33,7 +33,7 @@
<field name="researcher_branch_id" attrs="{'invisible': [('change_type', '!=', 'transfer_research_from_branch_to_another_branch')]}"/>
</group>
<group>
<field name="branch_id" attrs="{'invisible': [('change_type', '=', 'transfer_research_from_branch_to_another_branch')]}"/>
<field name="branch_custom_id" attrs="{'invisible': [('change_type', '=', 'transfer_research_from_branch_to_another_branch')]}"/>
<field name="new_branch_id" attrs="{'invisible': [('change_type', '=', 'transfer_family_from_research_to_another_research')],'readonly':[('state','=','approval_of_branch_manager')]}"/>
<field name="new_researcher_id" attrs="{'invisible': [('change_type', '!=', 'transfer_family_from_research_to_another_research')],'readonly':[('state','=','approval_of_branch_manager')]}"/>
<field name="new_gender_researcher_id" attrs="{'invisible': ['|',('change_type', '!=', 'transfer_research_from_branch_to_another_branch'),('is_whole_team','=',False)],'readonly':[('state','=','approval_of_branch_manager')]}"/>
@ -58,7 +58,7 @@
<field name="change_type"/>
<field name="benefit_id"/>
<field name="researcher_id"/>
<field name="branch_id"/>
<field name="branch_custom_id"/>
<field name="new_branch_id" attrs="{'invisible': [('change_type', '!=', 'transfer_family_from_branch_to_another_branch')]}"/>
<field name="new_researcher_id" attrs="{'invisible': [('change_type', '!=', 'transfer_family_from_research_to_another_research')]}"/>
<field name="new_branch_researcher" attrs="{'invisible': [('change_type', '!=', 'transfer_family_from_branch_to_another_branch')]}"/>

View File

@ -23,7 +23,7 @@
<field name="name"/>
<field name="type" invisible="1"/>
<field name="employee_id"/>
<field name="branch_id"/>
<field name="branch_custom_id"/>
</group>
<group>
<field name="benefit_ids" string="Assign files"/>

View File

@ -21,9 +21,18 @@
<field name="arch" type="xml">
<form string="Confirm Benefit Expense">
<header>
<field name="state" widget="statusbar" statusbar_visible="draft,confirm"/>
<field name="state" widget="statusbar"
statusbar_visible="draft,depart_manager,account_manager,confirm"/>
<button string="Cancel" type="object" name="action_cancel" class="oe_highlight"
states="depart_manager,account_manager"/>
<button string="Reset" type="object" name="action_reset_to_draft" class="oe_highlight"
states="cancel"/>
<button string="Confirm" type="object" name="action_depart_manager" class="oe_highlight"
states="draft" groups="odex25_account_payment_fix.group_depart_manager"/>
<button string="Confirm" type="object" name="action_accounting_manager" class="oe_highlight"
states="depart_manager" groups="odex25_account_payment_fix.group_accounting_manager"/>
<button string="Confirm" type="object" name="action_confirm_selected" class="oe_highlight"
states="draft"/>
states="account_manager" groups="odex25_account_payment_fix.group_general_manager"/>
</header>
<sheet>
<div class="oe_button_box" name="button_box">
@ -31,6 +40,10 @@
attrs="{'invisible':[('expense_type','!=','family_expense')]}">
<field name="total_moves" string="Moves" widget="statinfo"/>
</button>
<button icon="fa-usd" name="action_open_related_move_line_records" type="object"
attrs="{'invisible':[('expense_type','!=','family_expense')]}">
<field name="total_move_lines" string="Move Lines" widget="statinfo"/>
</button>
<button icon="fa-usd" name="action_open_related_invoice_records" type="object"
attrs="{'invisible':[('expense_type','!=','family_invoice')]}">
<field name="total_invoices" string="Invoices" widget="statinfo"/>
@ -57,11 +70,32 @@
<field name="cloth_expense"
attrs="{'invisible': [('expense_type', '=', 'family_invoice')]}"/>
</group>
<group>
<field name="family_monthly_income"/>
<field name="family_monthly_meals"/>
<field name="family_monthly_clotting"/>
</group>
<!-- Notebook with Families page -->
<notebook>
<page string="Families">
<field name="family_ids"/>
<field name="family_ids">
<tree string="Family">
<field name="name"/>
<field name="code"/>
<field name="family_monthly_income"/>
<field name="family_monthly_meals"/>
<field name="family_monthly_clotting"/>
<field name="family_monthly_clotting"/>
<field name="total_family_expenses"/>
<field name="father_id_number"/>
<field name="sms_phone"/>
<field name="benefit_member_count"/>
<field name="non_member_count"/>
<field name="researcher_id"/>
<field name="last_visit_date"/>
<field name="state"/>
</tree>
</field>
</page>
</notebook>
</sheet>
@ -78,6 +112,30 @@
</record>
<!-- Menu Item -->
<menuitem id="menu_confirm_benefit_expense" name="Benefit Expense Flow" parent="odex_benefit.benefit_main_menu"
<menuitem id="menu_confirm_benefit_expense" name="Benefit Expense Flow" parent="account.menu_finance_payables"
action="action_confirm_benefit_expense" sequence="10"/>
<record id="view_move_line_tree_new_code" model="ir.ui.view">
<field name="name">account.move.line.form</field>
<field name="model">account.move.line</field>
<field name="inherit_id" ref="account.view_move_line_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='ref']" position="after">
<field name="family_code"/>
</xpath>
</field>
</record>
<record id="view_move_line_tree_grouped_inherit_more" model="ir.ui.view">
<field name="name">account.move.line.form</field>
<field name="model">account.move.line</field>
<field name="inherit_id" ref="account.view_move_line_tree_grouped"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='ref']" position="after">
<field name="family_code"/>
</xpath>
</field>
</record>
</odoo>

View File

@ -72,7 +72,7 @@ class ConfirmBenefitWizard(models.TransientModel):
'name': name,
'benefit_family_id': benefit.id,
'partner_id': benefit.partner_id.id,
'analytic_account_id': benefit.branch_id.analytic_account_id.id,
'analytic_account_id': benefit.branch_custom_id.analytic_account_id.id,
'account_id': account_id,
'debit': amount,
'credit': 0.0,
@ -84,7 +84,7 @@ class ConfirmBenefitWizard(models.TransientModel):
'name': name,
'benefit_family_id': benefit.id,
'partner_id': benefit.partner_id.id,
'analytic_account_id': benefit.branch_id.analytic_account_id.id,
'analytic_account_id': benefit.branch_custom_id.analytic_account_id.id,
'account_id': account_id,
'debit': 0.0,
'credit': amount,

View File

@ -42,9 +42,9 @@ class ReasearcherFamilyWizard(models.TransientModel):
# ('researcher_team', 'Researcher Team'),
# ], string='Selector' ,default="researcher")
# researcher_id = fields.Many2one("hr.employee", string="Researcher")
researcher_team = fields.Many2one("committees.line", string="Researcher Team",domain="[('branch_id', '=',branch_id)]")
researcher_team = fields.Many2one("committees.line", string="Researcher Team",domain="[('branch_custom_id', '=',branch_custom_id)]")
benefit_id = fields.Many2one("grant.benefit", string="Benefit",default=_default_benefit)
branch_id = fields.Many2one("hr.department", string="Department",related="benefit_id.branch_id")
branch_custom_id = fields.Many2one("branch.settings", string="Department",related="benefit_id.branch_custom_id")
def submit_family(self):
for rec in self:

View File

@ -31,7 +31,7 @@
<sheet>
<group>
<field name="benefit_id" invisible="1"/>
<field name="branch_id" invisible="1"/>
<field name="branch_custom_id" invisible="1"/>
<field name="researcher_team" required="1"/>
</group>
<footer>

View File

@ -6,7 +6,7 @@ class empowerment(models.Model):
_name = 'empowerment.requests'
name = fields.Char(string='Request Number')
branch_id = fields.Many2one('hr.department', string='Branch')
branch_custom_id = fields.Many2one('hr.department', string='Branch')
employee_id = fields.Many2one('hr.employee', string='Employee Name')
benefit_id = fields.Many2one('grant.benefit', string='Benefit Name')
request_date = fields.Datetime('Request Date')

View File

@ -15,7 +15,7 @@
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="branch_id"/>
<field name="branch_custom_id"/>
<field name="employee_id"/>
<field name="request_date"/>
<field name="service_type"/>