first commit

This commit is contained in:
root
2026-03-14 09:42:12 +00:00
commit 0adbd20c2c
10991 changed files with 1646955 additions and 0 deletions

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,20 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.product_supplier,weekdays:"
msgid "Week Days"
msgstr "Дни от седмицата"
msgctxt "field:purchase.product_supplier.day,day:"
msgid "Day"
msgstr ""
msgctxt "field:purchase.product_supplier.day,product_supplier:"
msgid "Supplier"
msgstr "Доставчик"
#, fuzzy
msgctxt "model:purchase.product_supplier.day,string:"
msgid "Purchase Product Supplier Day"
msgstr "Ден на доставчик на наличност"

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.product_supplier,weekdays:"
msgid "Week Days"
msgstr "Dies de la setmana"
msgctxt "field:purchase.product_supplier.day,day:"
msgid "Day"
msgstr "Dia"
msgctxt "field:purchase.product_supplier.day,product_supplier:"
msgid "Supplier"
msgstr "Proveïdor"
msgctxt "model:purchase.product_supplier.day,string:"
msgid "Purchase Product Supplier Day"
msgstr "Dia del proveïdor del producte"

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.product_supplier,weekdays:"
msgid "Week Days"
msgstr ""
msgctxt "field:purchase.product_supplier.day,day:"
msgid "Day"
msgstr ""
msgctxt "field:purchase.product_supplier.day,product_supplier:"
msgid "Supplier"
msgstr ""
msgctxt "model:purchase.product_supplier.day,string:"
msgid "Purchase Product Supplier Day"
msgstr ""

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.product_supplier,weekdays:"
msgid "Week Days"
msgstr "Wochentage"
msgctxt "field:purchase.product_supplier.day,day:"
msgid "Day"
msgstr "Tag"
msgctxt "field:purchase.product_supplier.day,product_supplier:"
msgid "Supplier"
msgstr "Lieferant"
msgctxt "model:purchase.product_supplier.day,string:"
msgid "Purchase Product Supplier Day"
msgstr "Einkauf Artikel Lieferant Tag"

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.product_supplier,weekdays:"
msgid "Week Days"
msgstr "Días de la semana"
msgctxt "field:purchase.product_supplier.day,day:"
msgid "Day"
msgstr "Día"
msgctxt "field:purchase.product_supplier.day,product_supplier:"
msgid "Supplier"
msgstr "Proveedor"
msgctxt "model:purchase.product_supplier.day,string:"
msgid "Purchase Product Supplier Day"
msgstr "Día del proveedor del producto"

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.product_supplier,weekdays:"
msgid "Week Days"
msgstr ""
msgctxt "field:purchase.product_supplier.day,day:"
msgid "Day"
msgstr ""
msgctxt "field:purchase.product_supplier.day,product_supplier:"
msgid "Supplier"
msgstr ""
msgctxt "model:purchase.product_supplier.day,string:"
msgid "Purchase Product Supplier Day"
msgstr ""

View File

@@ -0,0 +1,20 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.product_supplier,weekdays:"
msgid "Week Days"
msgstr "Nädalapäevad"
msgctxt "field:purchase.product_supplier.day,day:"
msgid "Day"
msgstr "Päev"
msgctxt "field:purchase.product_supplier.day,product_supplier:"
msgid "Supplier"
msgstr "Hankija"
#, fuzzy
msgctxt "model:purchase.product_supplier.day,string:"
msgid "Purchase Product Supplier Day"
msgstr "Toote hankija päev"

View File

@@ -0,0 +1,20 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.product_supplier,weekdays:"
msgid "Week Days"
msgstr "روزهای هفته"
msgctxt "field:purchase.product_supplier.day,day:"
msgid "Day"
msgstr ""
msgctxt "field:purchase.product_supplier.day,product_supplier:"
msgid "Supplier"
msgstr "تأمین کننده"
#, fuzzy
msgctxt "model:purchase.product_supplier.day,string:"
msgid "Purchase Product Supplier Day"
msgstr "روز عرضه محصولات"

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.product_supplier,weekdays:"
msgid "Week Days"
msgstr ""
msgctxt "field:purchase.product_supplier.day,day:"
msgid "Day"
msgstr ""
msgctxt "field:purchase.product_supplier.day,product_supplier:"
msgid "Supplier"
msgstr ""
msgctxt "model:purchase.product_supplier.day,string:"
msgid "Purchase Product Supplier Day"
msgstr ""

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.product_supplier,weekdays:"
msgid "Week Days"
msgstr "Jours de la semaine"
msgctxt "field:purchase.product_supplier.day,day:"
msgid "Day"
msgstr "Jour"
msgctxt "field:purchase.product_supplier.day,product_supplier:"
msgid "Supplier"
msgstr "Fournisseur"
msgctxt "model:purchase.product_supplier.day,string:"
msgid "Purchase Product Supplier Day"
msgstr "Jour du fournisseur de produit d'achat"

View File

@@ -0,0 +1,20 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.product_supplier,weekdays:"
msgid "Week Days"
msgstr "Hét napjai"
msgctxt "field:purchase.product_supplier.day,day:"
msgid "Day"
msgstr "Nap"
msgctxt "field:purchase.product_supplier.day,product_supplier:"
msgid "Supplier"
msgstr "Szállító"
#, fuzzy
msgctxt "model:purchase.product_supplier.day,string:"
msgid "Purchase Product Supplier Day"
msgstr "Terméket szállító nap"

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.product_supplier,weekdays:"
msgid "Week Days"
msgstr ""
msgctxt "field:purchase.product_supplier.day,day:"
msgid "Day"
msgstr "Hari"
msgctxt "field:purchase.product_supplier.day,product_supplier:"
msgid "Supplier"
msgstr "Pemasok"
msgctxt "model:purchase.product_supplier.day,string:"
msgid "Purchase Product Supplier Day"
msgstr ""

View File

@@ -0,0 +1,20 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.product_supplier,weekdays:"
msgid "Week Days"
msgstr "Giorni della settimana"
msgctxt "field:purchase.product_supplier.day,day:"
msgid "Day"
msgstr "Giorno"
msgctxt "field:purchase.product_supplier.day,product_supplier:"
msgid "Supplier"
msgstr "Fornitore"
#, fuzzy
msgctxt "model:purchase.product_supplier.day,string:"
msgid "Purchase Product Supplier Day"
msgstr "Giornata del fornitore del prodotto"

View File

@@ -0,0 +1,20 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.product_supplier,weekdays:"
msgid "Week Days"
msgstr "ວັນໃນອາທິດ"
msgctxt "field:purchase.product_supplier.day,day:"
msgid "Day"
msgstr ""
msgctxt "field:purchase.product_supplier.day,product_supplier:"
msgid "Supplier"
msgstr "ຜູ້ສະໜອງ"
#, fuzzy
msgctxt "model:purchase.product_supplier.day,string:"
msgid "Purchase Product Supplier Day"
msgstr "ມື້ສະໜອງຜະລິດຕະພັນ"

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.product_supplier,weekdays:"
msgid "Week Days"
msgstr ""
msgctxt "field:purchase.product_supplier.day,day:"
msgid "Day"
msgstr ""
msgctxt "field:purchase.product_supplier.day,product_supplier:"
msgid "Supplier"
msgstr ""
msgctxt "model:purchase.product_supplier.day,string:"
msgid "Purchase Product Supplier Day"
msgstr ""

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.product_supplier,weekdays:"
msgid "Week Days"
msgstr "Weekdagen"
msgctxt "field:purchase.product_supplier.day,day:"
msgid "Day"
msgstr "Dag"
msgctxt "field:purchase.product_supplier.day,product_supplier:"
msgid "Supplier"
msgstr "Leverancier"
msgctxt "model:purchase.product_supplier.day,string:"
msgid "Purchase Product Supplier Day"
msgstr "Inkoop product leveranciers dag"

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.product_supplier,weekdays:"
msgid "Week Days"
msgstr "Dni tygodnia"
msgctxt "field:purchase.product_supplier.day,day:"
msgid "Day"
msgstr ""
msgctxt "field:purchase.product_supplier.day,product_supplier:"
msgid "Supplier"
msgstr "Dostawca"
msgctxt "model:purchase.product_supplier.day,string:"
msgid "Purchase Product Supplier Day"
msgstr ""

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.product_supplier,weekdays:"
msgid "Week Days"
msgstr "Dias da semana"
msgctxt "field:purchase.product_supplier.day,day:"
msgid "Day"
msgstr "Dia"
msgctxt "field:purchase.product_supplier.day,product_supplier:"
msgid "Supplier"
msgstr "Fornecedor"
msgctxt "model:purchase.product_supplier.day,string:"
msgid "Purchase Product Supplier Day"
msgstr "Dia do Fornecedor do Produto"

View File

@@ -0,0 +1,20 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.product_supplier,weekdays:"
msgid "Week Days"
msgstr "Zile Săptămânii"
msgctxt "field:purchase.product_supplier.day,day:"
msgid "Day"
msgstr "Ziua"
msgctxt "field:purchase.product_supplier.day,product_supplier:"
msgid "Supplier"
msgstr "Furnizor"
#, fuzzy
msgctxt "model:purchase.product_supplier.day,string:"
msgid "Purchase Product Supplier Day"
msgstr "Produs Furnizor Zi"

View File

@@ -0,0 +1,21 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
#, fuzzy
msgctxt "field:purchase.product_supplier,weekdays:"
msgid "Week Days"
msgstr "День недели"
msgctxt "field:purchase.product_supplier.day,day:"
msgid "Day"
msgstr ""
#, fuzzy
msgctxt "field:purchase.product_supplier.day,product_supplier:"
msgid "Supplier"
msgstr "Поставщик"
msgctxt "model:purchase.product_supplier.day,string:"
msgid "Purchase Product Supplier Day"
msgstr ""

View File

@@ -0,0 +1,20 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.product_supplier,weekdays:"
msgid "Week Days"
msgstr "Dnevi v tednu"
msgctxt "field:purchase.product_supplier.day,day:"
msgid "Day"
msgstr ""
msgctxt "field:purchase.product_supplier.day,product_supplier:"
msgid "Supplier"
msgstr "Dobavitelj"
#, fuzzy
msgctxt "model:purchase.product_supplier.day,string:"
msgid "Purchase Product Supplier Day"
msgstr "Dobaviteljev dan"

View File

@@ -0,0 +1,20 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.product_supplier,weekdays:"
msgid "Week Days"
msgstr ""
msgctxt "field:purchase.product_supplier.day,day:"
msgid "Day"
msgstr ""
msgctxt "field:purchase.product_supplier.day,product_supplier:"
msgid "Supplier"
msgstr "Tedarikçi"
#, fuzzy
msgctxt "model:purchase.product_supplier.day,string:"
msgid "Purchase Product Supplier Day"
msgstr "Ürün Tedarikçi Günü"

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.product_supplier,weekdays:"
msgid "Week Days"
msgstr ""
msgctxt "field:purchase.product_supplier.day,day:"
msgid "Day"
msgstr ""
msgctxt "field:purchase.product_supplier.day,product_supplier:"
msgid "Supplier"
msgstr ""
msgctxt "model:purchase.product_supplier.day,string:"
msgid "Purchase Product Supplier Day"
msgstr ""

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:purchase.product_supplier,weekdays:"
msgid "Week Days"
msgstr ""
msgctxt "field:purchase.product_supplier.day,day:"
msgid "Day"
msgstr ""
msgctxt "field:purchase.product_supplier.day,product_supplier:"
msgid "Supplier"
msgstr ""
msgctxt "model:purchase.product_supplier.day,string:"
msgid "Purchase Product Supplier Day"
msgstr ""

View File

@@ -0,0 +1,48 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
import datetime
from trytond.model import ModelSQL, fields
from trytond.pool import PoolMeta
class ProductSupplier(metaclass=PoolMeta):
__name__ = 'purchase.product_supplier'
weekdays = fields.Many2Many(
'purchase.product_supplier.day', 'product_supplier', 'day',
"Week Days")
def compute_supply_date(self, date=None):
date = super().compute_supply_date(date=date)
earlier_date = None
if date != datetime.date.max:
for weekday in self.weekdays:
diff = weekday.index - date.weekday()
if diff < 0:
diff += 7
new_date = date + datetime.timedelta(diff)
if earlier_date and earlier_date <= new_date:
continue
earlier_date = new_date
return earlier_date or date
def compute_purchase_date(self, date):
later_date = None
for weekday in self.weekdays:
diff = (date.weekday() - weekday.index) % 7
new_date = date - datetime.timedelta(diff)
if later_date and later_date >= new_date:
continue
later_date = new_date
if later_date:
date = later_date
return super().compute_purchase_date(date)
class ProductSupplierDay(ModelSQL):
__name__ = 'purchase.product_supplier.day'
product_supplier = fields.Many2One(
'purchase.product_supplier', 'Supplier',
required=True, ondelete='CASCADE')
day = fields.Many2One('ir.calendar.day', "Day", required=True)

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="product_supplier_view_form">
<field name="model">purchase.product_supplier</field>
<field name="inherit" ref="purchase.product_supplier_view_form"/>
<field name="name">product_supplier_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,158 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
import datetime
from trytond.modules.account.tests import create_chart
from trytond.modules.company.tests import (
CompanyTestMixin, create_company, set_company)
from trytond.pool import Pool
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
class StockSupplyDayTestCase(CompanyTestMixin, ModuleTestCase):
'Test StockSupplyDay module'
module = 'stock_supply_day'
def test_compute_supply_date(self):
'Test compute_supply_date'
dates = [
# purchase date, lead time, weekday, supply date
(datetime.date(2011, 11, 21), datetime.timedelta(10), 0,
datetime.date(2011, 12, 5)),
(datetime.date(2011, 11, 21), datetime.timedelta(9), 1,
datetime.date(2011, 12, 6)),
(datetime.date(2011, 11, 21), datetime.timedelta(8), 2,
datetime.date(2011, 11, 30)),
(datetime.date(2011, 11, 21), datetime.timedelta(7), 3,
datetime.date(2011, 12, 1)),
(datetime.date(2011, 11, 21), datetime.timedelta(6), 4,
datetime.date(2011, 12, 2)),
(datetime.date(2011, 11, 21), datetime.timedelta(5), 5,
datetime.date(2011, 11, 26)),
(datetime.date(2011, 11, 21), datetime.timedelta(4), 6,
datetime.date(2011, 11, 27)),
(datetime.date(2011, 12, 22), datetime.timedelta(12), 6,
datetime.date(2012, 1, 8)),
(datetime.date(2011, 11, 21), datetime.timedelta(10), None,
datetime.date(2011, 12, 1)),
(datetime.date(2011, 11, 21), None, 0, datetime.date.max),
]
# Purchase date is Monday, 2011-11-21, the regular days to deliver is
# 10 days, which would be Wednesday 2011-12-01. But with the supplier
# weekday 0 (Monday) the forecast supply date is next Monday, the
# 2011-12-05.
@with_transaction()
def run(purchase_date, lead_time, weekday, supply_date):
product_supplier = self.create_product_supplier_day(
lead_time, weekday)
date = product_supplier.compute_supply_date(purchase_date)
self.assertEqual(date, supply_date)
for purchase_date, lead_time, weekday, supply_date in dates:
run(purchase_date, lead_time, weekday, supply_date)
def test_compute_purchase_date(self):
'Test compute_purchase_date'
dates = [
# purchase date, lead time, weekday, supply date
(datetime.date(2011, 11, 25), datetime.timedelta(10), 0,
datetime.date(2011, 12, 6)),
(datetime.date(2011, 11, 27), datetime.timedelta(9), 1,
datetime.date(2011, 12, 6)),
(datetime.date(2011, 11, 22), datetime.timedelta(8), 2,
datetime.date(2011, 12, 6)),
(datetime.date(2011, 11, 24), datetime.timedelta(7), 3,
datetime.date(2011, 12, 6)),
(datetime.date(2011, 11, 26), datetime.timedelta(6), 4,
datetime.date(2011, 12, 6)),
(datetime.date(2011, 11, 28), datetime.timedelta(5), 5,
datetime.date(2011, 12, 6)),
(datetime.date(2011, 11, 30), datetime.timedelta(4), 6,
datetime.date(2011, 12, 6)),
(datetime.date(2011, 12, 27), datetime.timedelta(6), 0,
datetime.date(2012, 1, 3)),
]
# Supply date max is Tuesday, 2012-01-03, the supplier weekday 0 which
# would be Monday 2012-01-02. But with the 6 days of delivery the
# forecast purchase date is the 2011-12-27.
@with_transaction()
def run(purchase_date, lead_time, weekday, supply_date):
product_supplier = self.create_product_supplier_day(
lead_time, weekday)
date = product_supplier.compute_purchase_date(supply_date)
self.assertEqual(date, purchase_date)
for purchase_date, lead_time, weekday, supply_date in dates:
run(purchase_date, lead_time, weekday, supply_date)
def create_product_supplier_day(self, lead_time, weekday):
'''
Create a Product with a Product Supplier Day
:param lead_time: minimal timedelta needed to supply
:param weekday: supply day of the week (0 - 6)
:return: the id of the Product Supplier Day
'''
pool = Pool()
Uom = pool.get('product.uom')
UomCategory = pool.get('product.uom.category')
Template = pool.get('product.template')
Product = pool.get('product.product')
Party = pool.get('party.party')
Account = pool.get('account.account')
ProductSupplier = pool.get('purchase.product_supplier')
ProductSupplierDay = pool.get('purchase.product_supplier.day')
Day = pool.get('ir.calendar.day')
uom_category, = UomCategory.create([{'name': 'Test'}])
uom, = Uom.create([{
'name': 'Test',
'symbol': 'T',
'category': uom_category.id,
'rate': 1.0,
'factor': 1.0,
}])
template, = Template.create([{
'name': 'ProductTest',
'default_uom': uom.id,
}])
product, = Product.create([{
'template': template.id,
}])
company = create_company()
with set_company(company):
create_chart(company)
receivable, = Account.search([
('closed', '!=', True),
('type.receivable', '=', True),
('party_required', '=', True),
('company', '=', company.id),
], limit=1)
payable, = Account.search([
('closed', '!=', True),
('type.payable', '=', True),
('party_required', '=', True),
('company', '=', company.id),
], limit=1)
supplier, = Party.create([{
'name': 'supplier',
'account_receivable': receivable.id,
'account_payable': payable.id,
}])
product_supplier, = ProductSupplier.create([{
'template': template.id,
'company': company.id,
'party': supplier.id,
'lead_time': lead_time,
}])
if weekday is not None:
day, = Day.search([('index', '=', weekday)])
ProductSupplierDay.create([{
'product_supplier': product_supplier.id,
'day': day.id,
}])
return product_supplier
del ModuleTestCase

View File

@@ -0,0 +1,12 @@
[tryton]
version=7.8.1
depends:
ir
purchase
xml:
purchase.xml
[register]
model:
purchase.ProductSupplier
purchase.ProductSupplierDay

View File

@@ -0,0 +1,9 @@
<?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/field[@name='lead_time']" position="after">
<label name="weekdays"/>
<field name="weekdays" widget="multiselection" yexpand="0"/>
</xpath>
</data>