Initial import from Docker volume

This commit is contained in:
root
2025-12-26 13:11:43 +00:00
commit 4998dc066a
13336 changed files with 1767801 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.pool import Pool
from . import purchase
def register():
Pool.register(
purchase.PurchaseLine,
purchase.AnalyticAccountEntry,
module='analytic_purchase', type_='model')

View File

@@ -0,0 +1,16 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr "Аналитични сметки"
#, fuzzy
msgctxt "field:purchase.line,analytic_accounts_size:"
msgid "Analytic Accounts Size"
msgstr "Аналитични сметки"
msgctxt "view:purchase.line:"
msgid "Analytic"
msgstr ""

View File

@@ -0,0 +1,15 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr "Comptes analítics"
msgctxt "field:purchase.line,analytic_accounts_size:"
msgid "Analytic Accounts Size"
msgstr "Mida dels comptes analítics"
msgctxt "view:purchase.line:"
msgid "Analytic"
msgstr "Analítica"

View File

@@ -0,0 +1,15 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr ""
msgctxt "field:purchase.line,analytic_accounts_size:"
msgid "Analytic Accounts Size"
msgstr ""
msgctxt "view:purchase.line:"
msgid "Analytic"
msgstr ""

View File

@@ -0,0 +1,15 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr "Kostenstellen"
msgctxt "field:purchase.line,analytic_accounts_size:"
msgid "Analytic Accounts Size"
msgstr "Kostenstellengröße"
msgctxt "view:purchase.line:"
msgid "Analytic"
msgstr "Kostenstelle"

View File

@@ -0,0 +1,15 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr "Cuentas analíticas"
msgctxt "field:purchase.line,analytic_accounts_size:"
msgid "Analytic Accounts Size"
msgstr "Tamaño de cuentas analíticas"
msgctxt "view:purchase.line:"
msgid "Analytic"
msgstr "Analítica"

View File

@@ -0,0 +1,15 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr ""
msgctxt "field:purchase.line,analytic_accounts_size:"
msgid "Analytic Accounts Size"
msgstr ""
msgctxt "view:purchase.line:"
msgid "Analytic"
msgstr ""

View File

@@ -0,0 +1,15 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr "Analüütilised kontod"
msgctxt "field:purchase.line,analytic_accounts_size:"
msgid "Analytic Accounts Size"
msgstr "Analüütilisete kontode suurus"
msgctxt "view:purchase.line:"
msgid "Analytic"
msgstr "Analüütiline"

View File

@@ -0,0 +1,15 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr "تجزیه و تحلیل حساب ها"
msgctxt "field:purchase.line,analytic_accounts_size:"
msgid "Analytic Accounts Size"
msgstr "اندازه تجزیه و تحلیل حساب ها"
msgctxt "view:purchase.line:"
msgid "Analytic"
msgstr "تحلیلی"

View File

@@ -0,0 +1,15 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr ""
msgctxt "field:purchase.line,analytic_accounts_size:"
msgid "Analytic Accounts Size"
msgstr ""
msgctxt "view:purchase.line:"
msgid "Analytic"
msgstr ""

View File

@@ -0,0 +1,15 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr "Comptes analytiques"
msgctxt "field:purchase.line,analytic_accounts_size:"
msgid "Analytic Accounts Size"
msgstr "Taille des comptes analytiques"
msgctxt "view:purchase.line:"
msgid "Analytic"
msgstr "Analytique"

View File

@@ -0,0 +1,15 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr ""
msgctxt "field:purchase.line,analytic_accounts_size:"
msgid "Analytic Accounts Size"
msgstr ""
msgctxt "view:purchase.line:"
msgid "Analytic"
msgstr ""

View File

@@ -0,0 +1,15 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr "Akun Analitik"
msgctxt "field:purchase.line,analytic_accounts_size:"
msgid "Analytic Accounts Size"
msgstr "Ukuran Akun Analitik"
msgctxt "view:purchase.line:"
msgid "Analytic"
msgstr "Analitik"

View File

@@ -0,0 +1,15 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr "conti analitici"
msgctxt "field:purchase.line,analytic_accounts_size:"
msgid "Analytic Accounts Size"
msgstr "dimensione conti analitici"
msgctxt "view:purchase.line:"
msgid "Analytic"
msgstr "Analitico"

View File

@@ -0,0 +1,15 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr "ບັນຊີວິເຄາະ"
msgctxt "field:purchase.line,analytic_accounts_size:"
msgid "Analytic Accounts Size"
msgstr "ຂະໜາດບັນຊີວິເຄາະ"
msgctxt "view:purchase.line:"
msgid "Analytic"
msgstr ""

View File

@@ -0,0 +1,15 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr ""
msgctxt "field:purchase.line,analytic_accounts_size:"
msgid "Analytic Accounts Size"
msgstr ""
msgctxt "view:purchase.line:"
msgid "Analytic"
msgstr ""

View File

@@ -0,0 +1,15 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr "Analytische rekeningen"
msgctxt "field:purchase.line,analytic_accounts_size:"
msgid "Analytic Accounts Size"
msgstr "Grootte analyserekeningen"
msgctxt "view:purchase.line:"
msgid "Analytic"
msgstr "analytisch"

View File

@@ -0,0 +1,15 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr ""
msgctxt "field:purchase.line,analytic_accounts_size:"
msgid "Analytic Accounts Size"
msgstr ""
msgctxt "view:purchase.line:"
msgid "Analytic"
msgstr ""

View File

@@ -0,0 +1,15 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr "Contas analíticas"
msgctxt "field:purchase.line,analytic_accounts_size:"
msgid "Analytic Accounts Size"
msgstr "Tamanho das contas analíticas"
msgctxt "view:purchase.line:"
msgid "Analytic"
msgstr ""

View File

@@ -0,0 +1,15 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr "Conturi Analitice"
msgctxt "field:purchase.line,analytic_accounts_size:"
msgid "Analytic Accounts Size"
msgstr "Mărimea Conturilor Analitice"
msgctxt "view:purchase.line:"
msgid "Analytic"
msgstr "Analitic"

View File

@@ -0,0 +1,16 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr "Счета аналитики"
#, fuzzy
msgctxt "field:purchase.line,analytic_accounts_size:"
msgid "Analytic Accounts Size"
msgstr "Счета аналитики"
msgctxt "view:purchase.line:"
msgid "Analytic"
msgstr ""

View File

@@ -0,0 +1,15 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr "Analitični konti"
msgctxt "field:purchase.line,analytic_accounts_size:"
msgid "Analytic Accounts Size"
msgstr "Število analitičnih kontov"
msgctxt "view:purchase.line:"
msgid "Analytic"
msgstr ""

View File

@@ -0,0 +1,15 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr ""
msgctxt "field:purchase.line,analytic_accounts_size:"
msgid "Analytic Accounts Size"
msgstr ""
msgctxt "view:purchase.line:"
msgid "Analytic"
msgstr ""

View File

@@ -0,0 +1,15 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr ""
msgctxt "field:purchase.line,analytic_accounts_size:"
msgid "Analytic Accounts Size"
msgstr ""
msgctxt "view:purchase.line:"
msgid "Analytic"
msgstr ""

View File

@@ -0,0 +1,15 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.line,analytic_accounts:"
msgid "Analytic Accounts"
msgstr ""
msgctxt "field:purchase.line,analytic_accounts_size:"
msgid "Analytic Accounts Size"
msgstr ""
msgctxt "view:purchase.line:"
msgid "Analytic"
msgstr ""

View File

@@ -0,0 +1,62 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.model import fields
from trytond.modules.analytic_account import AnalyticMixin
from trytond.pool import Pool, PoolMeta
from trytond.pyson import Eval
class PurchaseLine(AnalyticMixin, metaclass=PoolMeta):
__name__ = 'purchase.line'
@classmethod
def __setup__(cls):
super(PurchaseLine, cls).__setup__()
cls.analytic_accounts.domain = [
('company', '=', Eval('company', -1)),
]
cls.analytic_accounts.states = {
'invisible': Eval('type') != 'line',
'readonly': Eval('purchase_state') != 'draft',
}
def get_invoice_line(self, lots=None,action=None):
pool = Pool()
AnalyticAccountEntry = pool.get('analytic.account.entry')
invoice_lines = super(PurchaseLine, self).get_invoice_line(lots,action)
for invoice_line in invoice_lines:
new_entries = AnalyticAccountEntry.copy(self.analytic_accounts,
default={
'origin': None,
})
invoice_line.analytic_accounts = new_entries
return invoice_lines
class AnalyticAccountEntry(metaclass=PoolMeta):
__name__ = 'analytic.account.entry'
@classmethod
def _get_origin(cls):
origins = super(AnalyticAccountEntry, cls)._get_origin()
return origins + ['purchase.line']
@fields.depends('origin')
def on_change_with_company(self, name=None):
pool = Pool()
PurchaseLine = pool.get('purchase.line')
company = super().on_change_with_company(name)
if isinstance(self.origin, PurchaseLine) and self.origin.purchase:
company = self.origin.purchase.company
return company
@classmethod
def search_company(cls, name, clause):
domain = super(AnalyticAccountEntry, cls).search_company(name, clause)
if domain:
domain = ['OR', domain]
domain.append(
('origin.purchase.' + clause[0],
*clause[1:3], 'purchase.line', *clause[3:]))
return domain

View File

@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tryton>
<data>
<record model="ir.ui.view" id="purchase_line_view_form">
<field name="model">purchase.line</field>
<field name="inherit" ref="purchase.purchase_line_view_form"/>
<field name="name">purchase_line_form</field>
</record>
</data>
</tryton>

View File

@@ -0,0 +1,2 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.

View File

@@ -0,0 +1,146 @@
==========================
Analytic Purchase Scenario
==========================
Imports::
>>> from decimal import Decimal
>>> from proteus import Model
>>> from trytond.modules.account.tests.tools import (
... create_chart, create_fiscalyear, get_accounts)
>>> from trytond.modules.account_invoice.tests.tools import (
... create_payment_term, set_fiscalyear_invoice_sequences)
>>> from trytond.modules.company.tests.tools import create_company, get_company
>>> from trytond.tests.tools import activate_modules, assertEqual, set_user
Activate modules::
>>> config = activate_modules('analytic_purchase')
Create company::
>>> _ = create_company()
>>> company = get_company()
Create purchase user::
>>> User = Model.get('res.user')
>>> Group = Model.get('res.group')
>>> purchase_user = User()
>>> purchase_user.name = 'Purchase'
>>> purchase_user.login = 'purchase'
>>> purchase_group, = Group.find([('name', '=', 'Purchase')])
>>> purchase_user.groups.append(purchase_group)
>>> purchase_user.save()
Create fiscal year::
>>> fiscalyear = set_fiscalyear_invoice_sequences(
... create_fiscalyear(company))
>>> fiscalyear.click('create_period')
Create chart of accounts::
>>> _ = create_chart(company)
>>> accounts = get_accounts(company)
>>> revenue = accounts['revenue']
>>> expense = accounts['expense']
Create analytic accounts::
>>> AnalyticAccount = Model.get('analytic_account.account')
>>> root = AnalyticAccount(type='root', name='Root')
>>> root.save()
>>> analytic_account = AnalyticAccount(root=root, parent=root,
... name='Analytic')
>>> analytic_account.save()
Create parties::
>>> Party = Model.get('party.party')
>>> supplier = Party(name='Supplier')
>>> supplier.save()
Create account category::
>>> ProductCategory = Model.get('product.category')
>>> account_category = ProductCategory(name="Account Category")
>>> account_category.accounting = True
>>> account_category.account_expense = expense
>>> account_category.account_revenue = revenue
>>> account_category.save()
Create product::
>>> ProductUom = Model.get('product.uom')
>>> unit, = ProductUom.find([('name', '=', 'Unit')])
>>> ProductTemplate = Model.get('product.template')
>>> template = ProductTemplate()
>>> template.name = 'product'
>>> template.default_uom = unit
>>> template.type = 'goods'
>>> template.purchasable = True
>>> template.list_price = Decimal('10')
>>> template.account_category = account_category
>>> template.save()
>>> product, = template.products
Create payment term::
>>> payment_term = create_payment_term()
>>> payment_term.save()
Purchase with analytic accounts::
>>> set_user(purchase_user)
>>> Purchase = Model.get('purchase.purchase')
>>> purchase = Purchase()
>>> purchase.party = supplier
>>> purchase.payment_term = payment_term
>>> purchase.invoice_method = 'order'
>>> purchase_line = purchase.lines.new()
>>> entry, = purchase_line.analytic_accounts
>>> assertEqual(entry.root, root)
>>> entry.account = analytic_account
>>> purchase_line.product = product
>>> purchase_line.quantity = 5
>>> purchase_line.unit_price = Decimal('5.0000')
>>> purchase.click('quote')
>>> purchase.click('confirm')
>>> purchase.state
'processing'
Check invoice analytic accounts::
>>> Invoice = Model.get('account.invoice')
>>> invoice = Invoice(purchase.invoices[0].id)
>>> invoice_line, = invoice.lines
>>> entry, = invoice_line.analytic_accounts
>>> assertEqual(entry.account, analytic_account)
Purchase with an empty analytic account::
>>> set_user(purchase_user)
>>> Purchase = Model.get('purchase.purchase')
>>> purchase = Purchase()
>>> purchase.party = supplier
>>> purchase.payment_term = payment_term
>>> purchase.invoice_method = 'order'
>>> purchase_line = purchase.lines.new()
>>> entry, = purchase_line.analytic_accounts
>>> purchase_line.product = product
>>> purchase_line.quantity = 5
>>> purchase_line.unit_price = Decimal('5.0000')
>>> purchase.click('quote')
>>> purchase.click('confirm')
>>> purchase.state
'processing'
Check invoice analytic accounts::
>>> Invoice = Model.get('account.invoice')
>>> invoice = Invoice(purchase.invoices[0].id)
>>> invoice_line, = invoice.lines
>>> entry, = invoice_line.analytic_accounts
>>> entry.account

View File

@@ -0,0 +1,12 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.tests.test_tryton import ModuleTestCase
class AnalyticPurchaseTestCase(ModuleTestCase):
'Test AnalyticPurchase module'
module = 'analytic_purchase'
del ModuleTestCase

View File

@@ -0,0 +1,8 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.tests.test_tryton import load_doc_tests
def load_tests(*args, **kwargs):
return load_doc_tests(__name__, __file__, *args, **kwargs)

View File

@@ -0,0 +1,8 @@
[tryton]
version=7.2.0
depends:
analytic_account
analytic_invoice
purchase
xml:
purchase.xml

View File

@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/form/notebook" position="inside">
<page string="Analytic" id="analytic_accounts">
<field name="analytic_accounts" colspan="4"/>
</page>
</xpath>
</data>