GoodERP
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.3KB

  1. # Copyright 2016 上海开阖软件有限公司 (http://www.osbzr.com)
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  3. from odoo import api, fields, models, tools
  4. from odoo.exceptions import UserError
  5. from odoo.tools import misc
  6. import re
  7. import base64
  8. # 成本计算方法,这里选择后商品上可以不选,从这里取
  9. CORE_COST_METHOD = [('average', '全月一次加权平均法'),
  10. ('std', '定额成本'),
  11. ('fifo', '个别计划法'),
  12. ]
  13. class ResCompany(models.Model):
  14. _inherit = 'res.company'
  15. start_date = fields.Date(
  16. '启用日期',
  17. required=True,
  18. default=lambda self: fields.Date.context_today(self))
  19. cost_method = fields.Selection(
  20. CORE_COST_METHOD,
  21. '存货计价方法',
  22. help='''GoodERP仓库模块使用个别计价规则匹配
  23. 每次出库对应入库成本和数量,但不实时记账。
  24. 财务月结时使用此方法相应调整发出成本''',
  25. default='average', required=True)
  26. draft_invoice = fields.Boolean(
  27. '根据发票确认应收应付',
  28. help='勾选这里,所有新建的结算单不会自动记账')
  29. import_tax_rate = fields.Float(string="默认进项税税率")
  30. output_tax_rate = fields.Float(string="默认销项税税率")
  31. bank_account_id = fields.Many2one('bank.account', string='开户行')
  32. is_multi_currency = fields.Boolean('多币种')
  33. sign = fields.Binary('签章')
  34. def _get_logo(self):
  35. return self._get_logo_impl()
  36. def _get_logo_impl(self):
  37. ''' 默认取 core/static/description 下的 logo.png 作为 logo'''
  38. return base64.b64encode(
  39. open(misc.file_open(
  40. 'core/static/description/logo.png').name, 'rb'
  41. ).read())
  42. def _get_html_table(self, vl):
  43. # vl = {'col':[],'val':[[]]}
  44. res = "<table style='width:100%;text-align:right'><tr>"
  45. for th in vl['col']:
  46. res += "<th>%s</th>" % th
  47. res += "</tr>"
  48. for line in vl['val']:
  49. res += "<tr>"
  50. for v in line:
  51. res += "<td>%s</td>" % v
  52. res += "</tr>"
  53. res += "</table>"
  54. return res
  55. logo = fields.Binary(related='partner_id.image_1920',
  56. default=_get_logo, attachment=True)
上海开阖软件有限公司 沪ICP备12045867号-1