在 product.supplierinfo 我可以创建多个具有多个单价的供应商: product.supplierinfo 供应商:JDoe(序列:1)
**pricelist.partnerinfo**
Quantity: 200 Unit price: 250
Quantity 300 Unit price 235
Quantity 500 Unit price 215
在自定义模型中,我想根据条件使用单价:例如
If quantity = 299 or less select unit price 250,
Elif quantity => 300 and <= 500 unit price 235,
Elif quantity => 500 unit price 215
在不使用价目表的情况下,我希望能够使用 pricelist.partnerinfo 价格在新产品中进行进一步计算。
#-------------------------------------------------------------------------------
# paper qualities e.g: product.template
#-------------------------------------------------------------------------------
class qualities(models.Model):
_name = 'qualities'
_description = 'Sheet Qualities'
name = fields.Char('Kwaliteit', required=True, help='Kwaliteit naam')
code_id = fields.Char('Interne code')
marge = fields.Integer('Marge (%)', help="Marge in % = inkoopprijs vs werkprijs")
samenstelling = fields.Char('Samenstelling')
golfdikte = fields.Float('Golfdikte in mm', digits=(3, 1))
golftype = fields.Char('Golf type code')
gramsgewicht = fields.Float('Gramsgewicht / m2', digits=(3, 1))
state = fields.Boolean('active', default=True)
quality_oms = fields.Text('Opmerkingen')
reseller_ids = fields.One2many('kwaliteitinfo', 'product_qual_id', 'Quality Supplier')
#-------------------------------------------------------------------------------
# Quality supplier e.g.: product.supplierinfo
#-------------------------------------------------------------------------------
class kwaliteitinfo(models.Model):
_name = 'kwaliteitinfo'
_description = "Information about a quality supplier"
name = fields.Many2one('res.partner', 'Supplier', required=True,domain = [('supplier','=',True)], ondelete='cascade')
product_name = fields.Char('Supplier Product Name')
product_code = fields.Char('Supplier Product Code')
sequence = fields.Integer('Sequence')
min_qty = fields.Float('Minimal Quantity', required=True)
qty = fields.Float(compute=_calc_qty, store=True, string='Quantity', multi="qty")
product_qual_id = fields.Many2one('qualities', 'Quality Template', ondelete='cascade', select=True)
delay = fields.Integer('Delivery Lead Time', required=True)
pricelist_ids = fields.One2many('qualitylist.partnerinfo', 'suppinfo_id', 'Supplier Pricelist', copy=True)
company_id = fields.Many2one('res.company','Company',select=1)
#-------------------------------------------------------------------------------
# Quality suppliers prices E.g.: Pricelist.partnerinfo
#-------------------------------------------------------------------------------
class qualitylist_partnerinfo(models.Model):
_name = 'qualitylist.partnerinfo'
name = fields.Char('Description')
suppinfo_id = fields.Many2one('kwaliteitinfo', 'Partner Information', required=True, ondelete='cascade')
min_quantity = fields.Float('Quantity', required=True)
price = fields.Float('Unit Price', required=True)
_order = 'min_quantity asc'
我如何: 1:按顺序选择首选供应商:设置关系 2:根据条件(数量)选择价格 3:将价格填写到自定义字段以进行进一步计算