This commit is contained in:
yumoqing 2025-03-04 12:19:47 +08:00
parent cea916f316
commit 21fcae435b

56
platformbiz/product.py Normal file
View File

@ -0,0 +1,56 @@
from appPublic.uniqueID import getID
from appPublic.log import debug
from accounting.openaccount import openRetailRelationshipAccounts
asunc def get_accounting_orgid(sor):
return '0'
async def agree_products_clone(sor, orgid, agreeid):
"""
adid:agreedetailid
sor:
return None
"""
sql = """select a.id,
a.name,
a.prodtypeid,
a.description,
a.prod_state,
a.product_code,
a.spec_note,
d.id as agreeid,
d.providerid,
d.resellerid
from product a, agreeproduct b, agreedetail c, agreement d
where a.id = b.providerpid
and b.resellerpid is null
and c.id = b.agreedetailid
and d.id = c.agreeid
and d.id = ${agreeid}$
and a.orgid = ${orgid}$
"""
recs = await sor.sqlExe(sql, {'agreeid':agreeid, 'orgid':orgid})
if len(recs) < 1:
debug(f'{orgid=}, {agreeid=}, {sql=}: found no data')
return
for rec in recs:
d = {
"id":getID(),
"name":rec.name,
"prodtypeid":rec.prodtypeid,
"orgid":rec.resellerid,
"providerid":rec.providerid,
"agreeid":rec.agreeid,
"providerpid":rec.id,
"description":rec.description,
"prod_state":rec.prod_state,
"product_code":rec.product_code,
"spec_note":rec.spec_note
}
await sor.C('product', d)
async def open_agree_account(sor, providerid, sellerid):
accounting_orgid = await get_accounting_orgid(sor)
await openRetailRelationshipAccounts(sor, accounting_orgid, providerid, sellerid)