def _onchange_amount(self): context = self._context or {} if hasattr(super(AccountPayment, self), '_onchange_amount'): super(AccountPayment, self)._onchange_amount() if context.get('lang') == 'ar_SY': self.check_amount_in_words = amount_to_text_ar.amount_to_text( self.amount, 'ar')
def return_amount_to_text(self, amount, currency): """ @param amount: Float field @param currency: currency_id of voucher This method is used to convert the amount into words ,used in voucher report @return: string """ return amount_to_text_ar.amount_to_text(amount, 'ar', currency.currency_unit_label, currency.currency_unit_label)
def _onchange_amount(self): context = self._context or {} if hasattr(super(AccountVoucher, self), '_onchange_amount'): super(AccountVoucher, self)._onchange_amount() if context.get('lang') == 'ar_SY': self.check_amount_in_words = amount_to_text_ar.amount_to_text( self.amount, 'ar') else: self.check_amount_in_words = self.currency_id.amount_to_text( self.amount)
def _compute_amount_in_words(self): if self._context.get('lang') == 'ar_SY': units_name = self.currency_id.currency_unit_label cents_name = self.currency_id.currency_subunit_label self.amount_in_words = amount_to_text_ar.amount_to_text( self.amount, 'ar', units_name, cents_name)
def render_html(self, docids, data): """ :param data: Passed value form wizard :return: generating report """ order_id = data['context']['order_id'] project = data['context']['project_id'] date = data['context']['date'] signed = data['context']['user_id'] first = data['context']['first_witnesse'] second = data['context']['second_witnesse'] benaficiary = data['context']['benaficiary_id'] date_v = datetime.strptime(date, '%Y-%m-%d') report = self.env['report'] a_r_s_v = report._get_report_from_name('microfinance.a_r_s_v_temp') ids = [] order = self.env['finance.order'].search([('id', '=', order_id)]) for a in order.approve_ids: for payment in a.payment_ids: if payment.type in ['check', 'cash']: for payed in payment: ids.append(payed.id) bena_id = data['context']['benaficiary'] copy = 0 fi = 0 approve_payment_print_befor = self.env[ 'finance.approval.payment'].search([('id', '=', bena_id)]) if approve_payment_print_befor.print_check_4 == True: copy = 1 elif approve_payment_print_befor.print_check_4 == False: approve_payment_print_befor.write({'print_check_4': True}) fi = 1 amount = 0 amount_in_word = "" check_no = 0 check = 0 account_payment = self.env['account.payment'].search([('id', '=', bena_id)]) for account in account_payment: if account.payment_method_id.code == 'check_printing': amount = account.amount amount_in_word = amount_to_text_ar.amount_to_text( account.amount, 'ar') check_no = account.check_number check += 1 elif account.payment_method_id.code == 'manual': amount = account.amount chart = "" for user in self.env['res.users'].search([('id', '=', data['context']['user'])]): for s in user.groups_id: if s.name == 'General Manager' or s.name == 'المدير العام'.decode( 'utf-8', 'ignore'): chart = s.name elif s.name == 'Operation Manager' or s.name == 'مدير العمليات'.decode( 'utf-8', 'ignore'): chart = s.name elif s.name == 'Branch Manager' or s.name == 'مدير الفرع'.decode( 'utf-8', 'ignore'): chart = s.name company_name = "" company = self.env.user.company_id.name for i in self.env['res.company'].search([]): if not i.parent_id: company_name = i.name if company == company_name: company = False docargs = { 'doc_ids': self.ids, 'day': date_v.day, 'copy': copy, 'fi': fi, 'year': date_v.year, 'month': date_v.month, 'project': project, 'amount': amount, 'amount_in_word': amount_in_word, 'order_num': order.name, 'benaficiary': benaficiary, 'check_no': check_no, 'customer_name': order.partner_id.name, 'company_name_parent': company_name, 'company': company, 'signed': signed, 'first': first, 'check': check, 'second': second, 'character': chart, 'doc_model': a_r_s_v.model, } return report.render('microfinance.a_r_s_v_temp', docargs)